From 6ab4e3247b3b07e8971f217379471df8c603ca8c Mon Sep 17 00:00:00 2001 From: FahadDarw Date: Tue, 9 Jul 2024 13:39:51 +0100 Subject: [PATCH 1/3] cypress-refactoring --- .../Pages/Shared/_TransferDatesSummary.cshtml | 2 +- .../cypress/pages/newTransferProjectWithDecisions.ts | 2 +- .../cypress/pages/trustInformationProjectDates.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dfe.PrepareTransfers.Web/Pages/Shared/_TransferDatesSummary.cshtml b/Dfe.PrepareTransfers.Web/Pages/Shared/_TransferDatesSummary.cshtml index e98ca18c5..452bfbddc 100644 --- a/Dfe.PrepareTransfers.Web/Pages/Shared/_TransferDatesSummary.cshtml +++ b/Dfe.PrepareTransfers.Web/Pages/Shared/_TransferDatesSummary.cshtml @@ -25,7 +25,7 @@
- Change Previous advisory board diff --git a/end-to-end-tests/cypress/pages/newTransferProjectWithDecisions.ts b/end-to-end-tests/cypress/pages/newTransferProjectWithDecisions.ts index 4aaa1aaec..744b74415 100644 --- a/end-to-end-tests/cypress/pages/newTransferProjectWithDecisions.ts +++ b/end-to-end-tests/cypress/pages/newTransferProjectWithDecisions.ts @@ -83,7 +83,7 @@ export class NewTransferProjectWithDecisions { public verifyDecisionDetails(): this { cy.contains('Record a decision').click(); cy.get('#decision').should('contain', 'Deferred'); - cy.get('#decision-made-by').should('contain', 'Deputy Director'); + cy.get('#decision-made-by').should('contain', 'Grade 6'); cy.get('#deferred-reasons').should('contain', 'Performance concerns:'); cy.get('#deferred-reasons').should('contain', 'Cypress Test'); cy.get('#decision-date').should('contain', '12 December 2023'); diff --git a/end-to-end-tests/cypress/pages/trustInformationProjectDates.ts b/end-to-end-tests/cypress/pages/trustInformationProjectDates.ts index ab05e537a..58844be1e 100644 --- a/end-to-end-tests/cypress/pages/trustInformationProjectDates.ts +++ b/end-to-end-tests/cypress/pages/trustInformationProjectDates.ts @@ -28,8 +28,8 @@ class TrustInformationProjectDatesPage { cy.get('button').contains('Save and continue').click() // Check the table has been updated - cy.get('dd').eq(1).should('contain.text', 'Approve') - cy.get('dd').eq(3).should('contain.text', 'Chris Sherlock') + cy.get('dd').eq(0).should('contain.text', 'Approve') + cy.get('dd').eq(2).should('contain.text', 'Chris Sherlock') return this } From db0ee44c85d59d70785df52891a758439aea1548 Mon Sep 17 00:00:00 2001 From: FahadDarw Date: Wed, 10 Jul 2024 17:02:07 +0100 Subject: [PATCH 2/3] Cypress_refactoring_with_Transfer_Dates --- end-to-end-tests/cypress/e2e/createTransfer.cy.ts | 3 ++- end-to-end-tests/cypress/pages/dates.ts | 9 +++------ .../cypress/pages/trustInformationProjectDates.ts | 6 ++++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/end-to-end-tests/cypress/e2e/createTransfer.cy.ts b/end-to-end-tests/cypress/e2e/createTransfer.cy.ts index 234643189..885c72539 100644 --- a/end-to-end-tests/cypress/e2e/createTransfer.cy.ts +++ b/end-to-end-tests/cypress/e2e/createTransfer.cy.ts @@ -144,7 +144,7 @@ describe('Create a new transfer', () => { .confirmDates() projectPage - .checkTransferDatesStatus('Completed') + .checkTransferDatesStatus('IN PROGRESS') }) it('Fill in Benefits and Risks', () => { @@ -214,6 +214,7 @@ describe('Create a new transfer', () => { trustInformationProjectDatesPage .completeRecommendationAndAuthor() + .confirmTrustInformationProjectDates() .checkOtherTableData(advisoryBoardDate, incomingTrustData.name, transferDate) .confirmTrustInformationProjectDates() diff --git a/end-to-end-tests/cypress/pages/dates.ts b/end-to-end-tests/cypress/pages/dates.ts index 816631974..c4e9812b0 100644 --- a/end-to-end-tests/cypress/pages/dates.ts +++ b/end-to-end-tests/cypress/pages/dates.ts @@ -7,8 +7,7 @@ class DatesPage { cy.get('[data-test="ab-date"]').click() cy.get('h1').should('contain.text', 'Advisory board date') - // Check 'I don't know' checkbox is available - cy.get('[id="AdvisoryBoardViewModel_AdvisoryBoardDate_UnknownDate"]').should('exist') + cy.get('[data-test="day"]').clear() cy.get('[data-test="day"]').type(date.date()) @@ -29,9 +28,7 @@ class DatesPage { cy.get('[data-test="target-date"]').click() - cy.get('h1').should('contain.text', 'When is the expected date for the transfer?') - // Check 'I don't know' checkbox is available - cy.get('[id="TargetDateViewModel_TargetDate_UnknownDate"]').should('exist') + cy.get('[data-test="month"]').clear() cy.get('[data-test="month"]').type(date.month() + 1) @@ -41,7 +38,7 @@ class DatesPage { cy.get('button').contains('Save and continue').click() // Check the table has been updated - cy.get('dd').eq(2).should('contain.text', date.format('1 MMMM YYYY')) + cy.get('dd').eq(4).should('contain.text', date.format('1 MMMM YYYY')) return this } diff --git a/end-to-end-tests/cypress/pages/trustInformationProjectDates.ts b/end-to-end-tests/cypress/pages/trustInformationProjectDates.ts index 58844be1e..23809558b 100644 --- a/end-to-end-tests/cypress/pages/trustInformationProjectDates.ts +++ b/end-to-end-tests/cypress/pages/trustInformationProjectDates.ts @@ -36,9 +36,11 @@ class TrustInformationProjectDatesPage { public checkOtherTableData(advisoryBoardDate, projectName, transferDate): this { + cy.get('[data-test="transfer-dates"]').click() cy.get('dd').eq(0).should('contain.text', advisoryBoardDate.format('D MMMM YYYY')) - cy.get('dd').eq(5).should('contain.text', projectName) - cy.get('dd').eq(7).should('contain.text', transferDate.format('1 MMMM YYYY')) + cy.get('[data-test="trust_name"]').should('contain.text', projectName) + cy.get('dd').eq(4).should('contain.text', transferDate.format('1 MMMM YYYY')) + return this } From d0f26bbbb19374e171121a62cdcd4d07ab9c8258 Mon Sep 17 00:00:00 2001 From: FahadDarw Date: Wed, 10 Jul 2024 17:03:02 +0100 Subject: [PATCH 3/3] cypress refactoring with tests for transfer dates --- .../Pages/Projects/TransferDates/Index.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/TransferDates/Index.cshtml b/Dfe.PrepareTransfers.Web/Pages/Projects/TransferDates/Index.cshtml index 40ac3000b..43e23a311 100644 --- a/Dfe.PrepareTransfers.Web/Pages/Projects/TransferDates/Index.cshtml +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/TransferDates/Index.cshtml @@ -15,7 +15,7 @@
- + @Model.IncomingTrustName?.ToTitleCase()