Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #800 from DFE-Digital/cypress-refactoring
Browse files Browse the repository at this point in the history
Cypress refactoring
  • Loading branch information
FahadDarw authored Jul 12, 2024
2 parents 06b0e82 + d0f26bb commit 8f8ad60
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<span class="govuk-caption-l">
<span class="govuk-caption-l" data-test="trust_name">
@Model.IncomingTrustName?.ToTitleCase()
</span>
<h1 class="govuk-heading-xl">
Expand Down
3 changes: 2 additions & 1 deletion end-to-end-tests/cypress/e2e/createTransfer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('Create a new transfer', () => {
.confirmDates()

projectPage
.checkTransferDatesStatus('Completed')
.checkTransferDatesStatus('IN PROGRESS')
})

it('Fill in Benefits and Risks', () => {
Expand Down Expand Up @@ -214,6 +214,7 @@ describe('Create a new transfer', () => {

trustInformationProjectDatesPage
.completeRecommendationAndAuthor()
.confirmTrustInformationProjectDates()
.checkOtherTableData(advisoryBoardDate, incomingTrustData.name, transferDate)
.confirmTrustInformationProjectDates()

Expand Down
9 changes: 3 additions & 6 deletions end-to-end-tests/cypress/pages/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 8f8ad60

Please sign in to comment.