Skip to content

Commit

Permalink
add two tests and supporting PO items
Browse files Browse the repository at this point in the history
  • Loading branch information
CMurrell148 committed Jan 2, 2025
1 parent 3d45abb commit dcf0d2e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,26 @@ describe("Testing the components of the Trust contacts page", () => {
.checkSuccessPopup('Changes made to the SFSO (Schools financial support and oversight) lead name and email were updated')
.checkErrorPopupNotPresent();
});

it(`Checks that when cancelling the edit of a TRM contact that I am taken back to the previous page and that entered data is not saved`, () => {
contactsPage
.editTrustRelationshipManager("Should Notbe Seen", "[email protected]")
.clickContactUpdateCancelButton()
.checkTrustRelationshipManagerIsNotUpdated();

navigation
.checkCurrentURLIsCorrect(`/trusts/contacts/in-dfe?uid=${uid}`);
});

it.only(`Checks that when cancelling the edit of a SFSO contact that I am taken back to the previous page and that entered data is not saved`, () => {
contactsPage
.editSfsoLead("Should Notbe Seen", "[email protected]")
.clickContactUpdateCancelButton()
.checkSfsoLeadIsNotUpdated();

navigation
.checkCurrentURLIsCorrect(`/trusts/contacts/in-dfe?uid=${uid}`);
});
});

describe(`On the edit Trust relationship manager contact details page for a ${typeOfTrust}`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class ContactsPage {
editContacts: {
nameInput: () => cy.get('[name="Name"]'),
emailInput: () => cy.get('[name="Email"]'),
saveButton: () => cy.contains('Save and continue')
saveButton: () => cy.contains('Save and continue'),
cancelButton: () => cy.contains('Cancel')
},

accountingOfficer: {
Expand Down Expand Up @@ -59,6 +60,12 @@ class ContactsPage {
},
};


public clickContactUpdateCancelButton(): this {
this.elements.editContacts.cancelButton().click();
return this;
}

public editTrustRelationshipManager(name: string, email: string): this {
const { trustRelationshipManager, editContacts } = this.elements;
trustRelationshipManager.editLink().click();
Expand All @@ -74,6 +81,18 @@ class ContactsPage {
return this;
}

public checkTrustRelationshipManagerIsNotUpdated(): this {
this.elements.trustRelationshipManager.name().should('not.contain.text', 'Should Notbe Seen');
this.elements.trustRelationshipManager.email().should('not.contain.text', '[email protected]');
return this;
}

public checkSfsoLeadIsNotUpdated(): this {
this.elements.schoolsFinancialSupportOversight.name().should('not.contain.text', 'Should Notbe Seen');
this.elements.schoolsFinancialSupportOversight.email().should('not.contain.text', '[email protected]');
return this;
}

public editSfsoLead(name: string, email: string): this {
const { schoolsFinancialSupportOversight, editContacts: EditContacts } = this.elements;
schoolsFinancialSupportOversight.editLink().click();
Expand Down

0 comments on commit dcf0d2e

Please sign in to comment.