-
Notifications
You must be signed in to change notification settings - Fork 0
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 #487 from DFE-Digital/AddInviteAndRemoveContributo…
…rCypressTest Add invite and remove contributor cypress test
- Loading branch information
Showing
7 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
Dfe.Academies.External.Web/CypressTests/cypress/e2e/inviteAndRemoveContributor.cy.ts
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
import Header from "../page-objects/components/Header"; | ||
import CookieHeaderModal from "../page-objects/components/CookieHeaderModal"; | ||
import A2BHome from "../page-objects/pages/A2BHome"; | ||
import A2BLogin from "../page-objects/pages/A2BLogin"; | ||
import A2BYourApplications from "../page-objects/pages/A2BYourApplications"; | ||
import A2BYourApplication from "../page-objects/pages/A2BYourApplication"; | ||
import A2BInviteContributor from "../page-objects/pages/A2BInviteContributor"; | ||
import A2BConfirmInviteContributorDelete from "../page-objects/pages/A2BConfirmInviteContributorDelete"; | ||
import Footer from "../page-objects/components/Footer"; | ||
|
||
describe("Invite / Remove Contributor", () => { | ||
beforeEach(function () { | ||
cy.visit(Cypress.env('URL')); | ||
|
||
Header.govUkHeaderVisible(); | ||
Header.applyToBecomeAnAcademyHeaderLinkVisible(); | ||
|
||
A2BHome.homePageElementsVisible(); | ||
|
||
Footer.checkFooterLinksVisible(); | ||
|
||
CookieHeaderModal.clickAcceptAnalyticsCookies(); | ||
A2BHome.clickStartNow(); | ||
}); | ||
|
||
it("should add and remove a contributor to a JAM application", () => { | ||
|
||
A2BLogin.login(Cypress.env('LOGIN_USERNAME'), Cypress.env('LOGIN_PASSWORD')); | ||
|
||
A2BYourApplications.selectApplicationForInviteContributor() | ||
|
||
A2BYourApplication.selectInviteContributorLink() | ||
|
||
A2BInviteContributor.fillDetailsAndSubmit() | ||
|
||
A2BInviteContributor.verifySuccessBannerAndContributorList() | ||
|
||
A2BInviteContributor.selectRemoveContributorLink() | ||
|
||
A2BConfirmInviteContributorDelete.confirmRemoveContributor() | ||
|
||
A2BInviteContributor.verifyContributorRemovedAndSuccessRemoved() | ||
}) | ||
}) | ||
|
||
|
9 changes: 9 additions & 0 deletions
9
...External.Web/CypressTests/cypress/page-objects/pages/A2BConfirmInviteContributorDelete.ts
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import BasePage from "../BasePage" | ||
export default class A2BConfirmInviteContributorDelete extends BasePage { | ||
|
||
static confirmRemoveContributor() | ||
{ | ||
cy.get('.govuk-button').eq(0).click() | ||
} | ||
|
||
} |
Empty file.
25 changes: 25 additions & 0 deletions
25
Dfe.Academies.External.Web/CypressTests/cypress/page-objects/pages/A2BInviteContributor.ts
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import BasePage from "../BasePage" | ||
|
||
export default class A2BInviteContributor extends BasePage { | ||
static fillDetailsAndSubmit() | ||
{ | ||
cy.fillDetailsAndSubmit() | ||
} | ||
|
||
static verifySuccessBannerAndContributorList() | ||
{ | ||
cy.verifySuccessBannerAndContributorList() | ||
} | ||
|
||
static selectRemoveContributorLink() | ||
{ | ||
cy.contains('Remove contributor').click() | ||
} | ||
|
||
static verifyContributorRemovedAndSuccessRemoved() | ||
{ | ||
cy.verifyContributorRemovedAndSuccessRemoved() | ||
} | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -29,6 +29,64 @@ Cypress.Commands.add("excuteAccessibilityTests", () => { | |
continueOnFail | ||
); | ||
}); | ||
|
||
Cypress.Commands.add('fillDetailsAndSubmit', ():void => { | ||
cy.get('#EmailAddress').click() | ||
cy.get('#EmailAddress').type('[email protected]') | ||
|
||
cy.get('#Name').click() | ||
cy.get('#Name').type('Daniel') | ||
|
||
cy.get('#role-2').click() | ||
|
||
cy.get('#role-description').click() | ||
cy.get('#role-description').type('Headmaster') | ||
|
||
cy.get('input[type="submit"]').click() | ||
}) | ||
|
||
Cypress.Commands.add('verifySuccessBannerAndContributorList', ():void => { | ||
cy.get('div[role="alert"]').contains('Success') | ||
cy.get('div[role="alert"]').contains('Contributor added') | ||
cy.get('div[role="alert"]').contains('Daniel has been sent an invitation to help with this application.') | ||
|
||
cy.get('.govuk-form-group').contains('Daniel') | ||
cy.get('.govuk-form-group').contains('Headmaster') | ||
cy.get('.govuk-form-group').contains('Remove contributor') | ||
|
||
}) | ||
|
||
Cypress.Commands.add('verifyContributorRemovedAndSuccessRemoved', ():void => { | ||
cy.get('div[role="alert"]').contains('Success') | ||
cy.get('div[role="alert"]').contains('Contributor removed') | ||
cy.get('div[role="alert"]').contains('Daniel can no longer contribute to this application.') | ||
|
||
cy.get('.govuk-form-group').contains('Daniel').should('not.exist') | ||
}) | ||
|
||
Cypress.Commands.add('checkAppIDIsCorrectAndselectConfirmDelete', ():void => { | ||
cy.log(`Global Application ID = ${globalApplicationId}`) | ||
|
||
|
||
cy.get('.govuk-caption-xl').contains(`Application reference: A2B_${globalApplicationId}`) | ||
|
||
|
||
cy.get('#deleteButton').should('be.visible').contains('Yes, delete') | ||
cy.get('a[class="govuk-button govuk-button--secondary"]').should('be.visible').contains('No, take me back') | ||
|
||
cy.get('#deleteButton').should('be.visible').contains('Yes, delete').click() | ||
|
||
}) | ||
|
||
Cypress.Commands.add('verifyApplicationDeleted', ():void => { | ||
cy.log(`Global Application ID = ${globalApplicationId}`) | ||
|
||
cy.get('.govuk-body').eq(0).contains(`trust A2B_${globalApplicationId} has been successfully removed.`) | ||
|
||
cy.get('.govuk-table').contains(`${globalApplicationId}`).should('not.exist') | ||
|
||
|
||
}) | ||
|
||
|
||
Cypress.Commands.add('checkAppIDIsCorrectAndselectConfirmDelete', ():void => { | ||
|