-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1188 from ORCID/fix-even-more-cy-tests
fix even more cypress tests
- Loading branch information
Showing
16 changed files
with
107 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,62 @@ | ||
/// <reference types="cypress" /> | ||
import data from '../../fixtures/test-data.json'; | ||
import credentials from '../../fixtures/credentials.json'; | ||
import data from "../../fixtures/test-data.json"; | ||
import credentials from "../../fixtures/credentials.json"; | ||
const { salesforceId, clientName, clientId } = data.member; | ||
|
||
describe('Test "Add member" functionality', () => { | ||
it('Add member', function() { | ||
it("Add member", function () { | ||
cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword); | ||
cy.visit('/member'); | ||
cy.get('tbody') | ||
cy.visit("ui/en/members"); | ||
cy.get("tbody") | ||
.children() | ||
// Fetch existing salesforce id | ||
.first().children().first().then(existingSfId => { | ||
.first() | ||
.children() | ||
.first() | ||
.then((existingSfId) => { | ||
// Check required field flags | ||
cy.visit('/member/new') | ||
cy.get('#field_salesforceId').should('have.class', 'ng-invalid'); | ||
cy.get('#field_clientName').should('have.class', 'ng-invalid'); | ||
cy.visit("ui/en/members/new"); | ||
cy.get("#field_salesforceId").should("have.class", "ng-invalid"); | ||
cy.get("#field_clientName").should("have.class", "ng-invalid"); | ||
// Save button should be disabled | ||
cy.get('#save-entity') | ||
.invoke('attr', 'disabled') | ||
.should('exist'); | ||
cy.get("#save-entity").invoke("attr", "disabled").should("exist"); | ||
// Check salesforce id warning message when field is clear | ||
cy.get('#field_salesforceId') | ||
.type(salesforceId) | ||
.clear(); | ||
cy.get('small').should('exist'); | ||
cy.get('#save-entity') | ||
.invoke('attr', 'disabled') | ||
.should('exist'); | ||
cy.get("#field_salesforceId").type(salesforceId).clear(); | ||
cy.get("small").should("exist"); | ||
cy.get("#save-entity").invoke("attr", "disabled").should("exist"); | ||
// Enter existing salesforce id to generate an error | ||
cy.get('#field_salesforceId').type(existingSfId.text()); | ||
cy.get('#field_parentSalesforceId').type(clientName); | ||
cy.get("#field_salesforceId").type(existingSfId.text()); | ||
cy.get("#field_parentSalesforceId").type(clientName); | ||
// Enter invalid client name to generate an error | ||
cy.get('#field_clientName') | ||
.type(data.invalidString) | ||
.clear(); | ||
cy.get('small').should('exist'); | ||
cy.get('#save-entity') | ||
.invoke('attr', 'disabled') | ||
.should('exist'); | ||
cy.get('#field_clientName').type(data.populatedMember.clientName); | ||
cy.get('#save-entity').click(); | ||
cy.get("#field_clientName").type(data.invalidString).clear(); | ||
cy.get("small").should("exist"); | ||
cy.get("#save-entity").invoke("attr", "disabled").should("exist"); | ||
cy.get("#field_clientName").type(data.populatedMember.clientName); | ||
cy.get("#save-entity").click(); | ||
// Two error messages should appear for existing salesforce id and member name | ||
cy.get('.validation-errors') | ||
.children() | ||
.should('have.length', 2); | ||
cy.get(".validation-errors").children().should("have.length", 2); | ||
// Enter invalid client id to generate an error | ||
cy.get('#field_clientId').type(data.invalidString); | ||
cy.get('small').should('exist'); | ||
cy.get("#field_clientId").type(data.invalidString); | ||
cy.get("small").should("exist"); | ||
// Check for flag on client id input field | ||
cy.get('#field_clientId').should('have.class', 'ng-invalid'); | ||
cy.get('#save-entity') | ||
.invoke('attr', 'disabled') | ||
.should('exist'); | ||
cy.get("#field_clientId").should("have.class", "ng-invalid"); | ||
cy.get("#save-entity").invoke("attr", "disabled").should("exist"); | ||
// Check the enable assertions checkbox | ||
cy.get('#field_assertionServiceEnabled').check(); | ||
cy.get('#field_clientId') | ||
.clear() | ||
.type(clientId); | ||
cy.get('#field_clientName') | ||
.clear() | ||
.type(clientName); | ||
cy.get("#field_assertionServiceEnabled").check(); | ||
cy.get("#field_clientId").clear().type(clientId); | ||
cy.get("#field_clientName").clear().type(clientName); | ||
// Checkbox should be unchecked after clearing client id field | ||
cy.get('#field_assertionServiceEnabled') | ||
.should('not.be.checked') | ||
cy.get("#field_assertionServiceEnabled") | ||
.should("not.be.checked") | ||
.check(); | ||
// Parent salesforce id for consortium lead members must match salesforce id or be blank | ||
cy.get('#field_isConsortiumLead') | ||
.should('not.be.checked') | ||
.check(); | ||
cy.get('#save-entity') | ||
.invoke('attr', 'disabled') | ||
.should('exist'); | ||
cy.get('#field_parentSalesforceId') | ||
.clear() | ||
.type(salesforceId); | ||
cy.get("#field_isConsortiumLead").should("not.be.checked").check(); | ||
cy.get("#save-entity").invoke("attr", "disabled").should("exist"); | ||
cy.get("#field_parentSalesforceId").clear().type(salesforceId); | ||
// Save button should still be disabled due to invalid parent SF id | ||
cy.get('#save-entity') | ||
.invoke('attr', 'disabled') | ||
.should('exist'); | ||
cy.get('#field_parentSalesforceId') | ||
.clear() | ||
.type(existingSfId.text()); | ||
cy.get('#save-entity') | ||
.invoke('attr', 'disabled') | ||
.should('not.exist'); | ||
cy.get("#save-entity").invoke("attr", "disabled").should("exist"); | ||
cy.get("#field_parentSalesforceId").clear().type(existingSfId.text()); | ||
cy.get("#save-entity").invoke("attr", "disabled").should("not.exist"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,15 +55,15 @@ describe("Test homepage", () => { | |
cy.get(".side-bar").contains("Public details"); | ||
cy.get(".side-bar").contains("Website"); | ||
cy.get(".side-bar").contains("Email"); | ||
cy.get(".side-bar").contains("https://orcid.org"); | ||
cy.get(".side-bar").contains("No website added"); | ||
cy.get(".side-bar").contains("@orcid.org"); | ||
cy.get(".main-section").contains( | ||
"Consortium/Parent organization: Mambo No 5", | ||
); | ||
cy.get(".main-section").first().contains("Membership:"); | ||
cy.get(".main-section").first().contains("Active"); | ||
cy.get(".main-section").contains("The Almond Forest"); | ||
cy.get(".main-section").contains("Lorem ipsum"); | ||
cy.get(".main-section").contains("Description"); | ||
cy.get(".main-section").contains("Contacts"); | ||
cy.get(".main-section").contains("Agreement signatory (OFFICIAL)"); | ||
cy.get(".main-section").contains("[email protected]"); | ||
|
@@ -102,9 +102,8 @@ describe("Test homepage", () => { | |
cy.get(".side-bar").contains("www.haevesting.com"); | ||
cy.get(".side-bar").contains("[email protected]"); | ||
cy.get(".main-section").contains("Consortium lead"); | ||
cy.get(".main-section").contains("Consortium Members (2)"); | ||
cy.get(".main-section").contains("Consortium Members (1)"); | ||
cy.get(".main-section").contains("Member name"); | ||
cy.get(".main-section").contains("Yellow member"); | ||
cy.get(".main-section").contains("The Harvest Ascendancy"); | ||
cy.get(".main-section").contains("Contacts"); | ||
cy.get(".main-section").contains("Product Contact"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"invalidEmail": "@[email protected]", | ||
"invalidWebsite": "orcid.org", | ||
"invalidString": "a", | ||
"italianLanguageCode": "7: it", | ||
"italianLanguageCode": "4: it", | ||
"outbox": { | ||
"email": "[email protected]", | ||
"updateEmail": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.