diff --git a/test/browser/pages/DVADetailsEntryPage.js b/test/browser/pages/DVADetailsEntryPage.js index 2f441eda..d6f432a7 100644 --- a/test/browser/pages/DVADetailsEntryPage.js +++ b/test/browser/pages/DVADetailsEntryPage.js @@ -46,7 +46,7 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage { 'xpath=//*[@id="consentDVACheckbox"]' ); - // DVA Error summary items + // DVA Error summary items this.dvaErrorSummaryBoxLicenceNumber = this.page.locator( 'xpath=//*[@class="govuk-error-summary error-summary"]//*[@class="govuk-error-summary__body"]//*[@class="govuk-list govuk-error-summary__list"]//*[contains(@href,"#dvaLicenceNumber")]' @@ -79,24 +79,22 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage { ); this.invalidConsentDVAFieldError = this.page.locator( - 'xpath=//*[@id="consentDVACheckbox-error"]' - ); + 'xpath=//*[@id="consentDVACheckbox-error"]' + ); - //Welsh - DVA - this.headingDVAWelsh = this.page.locator( - 'xpath=//*[@id="header"]' - ); + //Welsh - DVA + this.headingDVAWelsh = this.page.locator('xpath=//*[@id="header"]'); this.dVADobFieldTitleWelsh = this.page.locator( 'xpath=//*[@id="dvaDateOfBirth-fieldset"]/legend' ); this.dVADobHintWelsh = this.page.locator( - 'xpath=//*[@id="dvaDateOfBirth-hint"]' + 'xpath=//*[@id="dvaDateOfBirth-hint"]' ); this.dayInWelshDVA = this.page.locator( - 'xpath=//*[@id="dvaDateOfBirth"]/div[1]/div/label' + 'xpath=//*[@id="dvaDateOfBirth"]/div[1]/div/label' ); this.monthInWelshDVA = this.page.locator( @@ -116,7 +114,7 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage { ); this.issueDVADayInWelsh = this.page.locator( - 'xpath=//*[@id="dateOfIssue"]/div[1]/div/label' + 'xpath=//*[@id="dateOfIssue"]/div[1]/div/label' ); this.issueDVAMonthInWelsh = this.page.locator( @@ -141,7 +139,9 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage { } isCurrentPage() { - return this.page.url() === this.url || this.page.url() === this.url + "?lang=cy"; + return ( + this.page.url() === this.url || this.page.url() === this.url + "?lang=cy" + ); } async assertDVAPageTitle(dvaDetailsEntryPageTitle) { @@ -277,130 +277,130 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage { } async consentDVACheckBoxUnselect() { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - return await this.consentDVACheckbox.click(); - } + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + return await this.consentDVACheckbox.click(); + } - async assertConsentDVAErrorSummary(errorSummaryText) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.invalidDVAConsentErrorSummary.innerText()).to.contains( - errorSummaryText - ); - } + async assertConsentDVAErrorSummary(errorSummaryText) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.invalidDVAConsentErrorSummary.innerText()).to.contains( + errorSummaryText + ); + } - async assertConsentDVAErrorOnField(fieldErrorText) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.invalidConsentDVAFieldError.innerText()).to.contains( - fieldErrorText - ); - } + async assertConsentDVAErrorOnField(fieldErrorText) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.invalidConsentDVAFieldError.innerText()).to.contains( + fieldErrorText + ); + } // Welsh DVA async assertDVAPageTitleWelsh(dvaPageTitle) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.page.title()).to.equal(dvaPageTitle); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.page.title()).to.equal(dvaPageTitle); } async assertDVAPageHeading(pageHeadingDVA) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; - expect(await this.headingDVAWelsh.innerText()).to.equal( - pageHeadingDVA); + expect(await this.headingDVAWelsh.innerText()).to.equal(pageHeadingDVA); } async assertDVAPageHeadingSentence(pageHeadingDVASentence) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; expect(await this.headingDVASentenceWelsh.innerText()).to.equal( - pageHeadingDVASentence); + pageHeadingDVASentence + ); } async assertDVADoBFieldTitle(dobFieldTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.dVADobFieldTitleWelsh.innerText()).to.equal( - dobFieldTitleWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.dVADobFieldTitleWelsh.innerText()).to.equal( + dobFieldTitleWelsh + ); } async assertDVADobExample(dobExampleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.dVADobHintWelsh.innerText()).to.equal( - dobExampleWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.dVADobHintWelsh.innerText()).to.equal(dobExampleWelsh); } async assertDVADayWelsh(dayWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - await expect(await this.dayInWelshDVA.innerText()).to.equal( - dayWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.dayInWelshDVA.innerText()).to.equal(dayWelsh); } async assertDVAMonthWelsh(monthWelsh) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; - await expect(await this.monthInWelshDVA.innerText()).to.equal( - monthWelsh); + await expect(await this.monthInWelshDVA.innerText()).to.equal(monthWelsh); } async assertDVAYearWelsh(yearWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - await expect(await this.yearInWelshDVA.innerText()).to.equal( - yearWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.yearInWelshDVA.innerText()).to.equal(yearWelsh); } async assertDVAIssueDateFieldTitleWelsh(issueFieldTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueDVAFieldTitleWelsh.innerText()).to.equal( - issueFieldTitleWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueDVAFieldTitleWelsh.innerText()).to.equal( + issueFieldTitleWelsh + ); } async assertDVAIssueDateExample(issueDateExampleWelsh) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; expect(await this.issueDVAFieldHint.innerText()).to.equal( - issueDateExampleWelsh); + issueDateExampleWelsh + ); } async assertDVAIssueDayWelsh(issueDayWelsh) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueDVADayInWelsh.innerText()).to.equal( - issueDayWelsh); + expect(await this.issueDVADayInWelsh.innerText()).to.equal(issueDayWelsh); } async assertDVAIssueMonthWelsh(issueMonthWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueDVAMonthInWelsh.innerText()).to.equal( - issueMonthWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueDVAMonthInWelsh.innerText()).to.equal( + issueMonthWelsh + ); } async assertDVAIssueYearWelsh(issueYearWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueDVAYearInWelsh.innerText()).to.equal( - issueYearWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueDVAYearInWelsh.innerText()).to.equal(issueYearWelsh); } async assertDVALicenceTitle(validLicenceTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.licenceDVATitleWelsh.innerText()).to.equal( - validLicenceTitleWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.licenceDVATitleWelsh.innerText()).to.equal( + validLicenceTitleWelsh + ); } async assertDVALicenceExample(validLicenceExampleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.licenceDVAExampleWelsh.innerText()).to.equal( - validLicenceExampleWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.licenceDVAExampleWelsh.innerText()).to.equal( + validLicenceExampleWelsh + ); } }; diff --git a/test/browser/pages/DrivingLicencePage.js b/test/browser/pages/DrivingLicencePage.js index 1ef5c3c3..62ad29d0 100644 --- a/test/browser/pages/DrivingLicencePage.js +++ b/test/browser/pages/DrivingLicencePage.js @@ -6,7 +6,9 @@ exports.DrivingLicencePage = class PlaywrightDevPage { this.page = page; this.url = "http://localhost:5030/details"; - this.licenceNumber = this.page.locator('xpath=//*[@id="drivingLicenceNumber"]'); + this.licenceNumber = this.page.locator( + 'xpath=//*[@id="drivingLicenceNumber"]' + ); this.lastName = this.page.locator('xpath=//*[@id="surname"]'); this.firstName = this.page.locator('xpath=//*[@id="firstName"]'); @@ -123,18 +125,18 @@ exports.DrivingLicencePage = class PlaywrightDevPage { ); this.invalidConsentErrorFieldError = this.page.locator( - 'xpath=//*[@id="consentCheckbox-error"]' + 'xpath=//*[@id="consentCheckbox-error"]' ); this.Continue = this.page.locator('xpath=//*[@id="continue"]'); // Welsh Translation - this.betaBannerReads = this.page.locator( - 'xpath=/html/body/div[2]/div/p/span' + this.betaBannerReads = this.page.locator( + "xpath=/html/body/div[2]/div/p/span" ); - this.betaBanner = this.page.locator('xpath=/html/body/div[2]/div/p/strong'); + this.betaBanner = this.page.locator("xpath=/html/body/div[2]/div/p/strong"); this.lastNameWelsh = this.page.locator('xpath=//*[@id="surname-label"]'); @@ -157,87 +159,87 @@ exports.DrivingLicencePage = class PlaywrightDevPage { 'xpath=//*[@id="dateOfBirth-fieldset"]/legend' ); - this.dobExample = this.page.locator( - 'xpath=//*[@id="dateOfBirth-hint"]' - ); + this.dobExample = this.page.locator('xpath=//*[@id="dateOfBirth-hint"]'); this.dayInWelsh = this.page.locator( 'xpath=//*[@id="dateOfBirth"]/div[1]/div/label' ); this.monthInWelsh = this.page.locator( - 'xpath=//*[@id="dateOfBirth"]/div[2]/div/label' + 'xpath=//*[@id="dateOfBirth"]/div[2]/div/label' ); this.yearInWelsh = this.page.locator( 'xpath=//*[@id="dateOfBirth"]/div[3]/div/label' ); - this.issueFieldTitleWelsh = this.page.locator( - 'xpath=//*[@id="issueDate-fieldset"]/legend' - ); - this.issueFieldExample = this.page.locator( - 'xpath=//*[@id="issueDate-hint"]' - ); + this.issueFieldTitleWelsh = this.page.locator( + 'xpath=//*[@id="issueDate-fieldset"]/legend' + ); + this.issueFieldExample = this.page.locator( + 'xpath=//*[@id="issueDate-hint"]' + ); - this.issueDayInWelsh = this.page.locator( - 'xpath=//*[@id="issueDate"]/div[1]/div/label' - ); + this.issueDayInWelsh = this.page.locator( + 'xpath=//*[@id="issueDate"]/div[1]/div/label' + ); - this.issueMonthInWelsh = this.page.locator( - 'xpath=//*[@id="issueDate"]/div[2]/div/label' - ); - this.issueYearInWelsh = this.page.locator( - 'xpath=//*[@id="issueDate"]/div[3]/div/label' - ); + this.issueMonthInWelsh = this.page.locator( + 'xpath=//*[@id="issueDate"]/div[2]/div/label' + ); + this.issueYearInWelsh = this.page.locator( + 'xpath=//*[@id="issueDate"]/div[3]/div/label' + ); - this.validToFieldTitleWelsh = this.page.locator( + this.validToFieldTitleWelsh = this.page.locator( 'xpath=//*[@id="expiryDate-fieldset"]/legend' - ); + ); - this.validToFieldExample = this.page.locator( - 'xpath=//*[@id="expiryDate-hint"]' - ); + this.validToFieldExample = this.page.locator( + 'xpath=//*[@id="expiryDate-hint"]' + ); - this.validToDayInWelsh = this.page.locator( - 'xpath=//*[@id="expiryDate"]/div[1]/div/label' - ); + this.validToDayInWelsh = this.page.locator( + 'xpath=//*[@id="expiryDate"]/div[1]/div/label' + ); - this.validToMonthInWelsh = this.page.locator( - 'xpath=//*[@id="expiryDate"]/div[2]/div/label' - ); + this.validToMonthInWelsh = this.page.locator( + 'xpath=//*[@id="expiryDate"]/div[2]/div/label' + ); - this.validToYearInWelsh = this.page.locator( - 'xpath=//*[@id="expiryDate"]/div[3]/div/label' - ); + this.validToYearInWelsh = this.page.locator( + 'xpath=//*[@id="expiryDate"]/div[3]/div/label' + ); - this.licenceTitleWelsh = this.page.locator( - 'xpath=//*[@id="drivingLicenceNumber-label"]' - ); + this.licenceTitleWelsh = this.page.locator( + 'xpath=//*[@id="drivingLicenceNumber-label"]' + ); - this.licenceExampleWelsh = this.page.locator( - 'xpath=//*[@id="drivingLicenceNumber-hint"]' - ); + this.licenceExampleWelsh = this.page.locator( + 'xpath=//*[@id="drivingLicenceNumber-hint"]' + ); - this.issueNumberTitleWelsh = this.page.locator( + this.issueNumberTitleWelsh = this.page.locator( 'xpath=//*[@id="issueNumber-label"]' - ); + ); - this.issueNumberExampleWelsh = this.page.locator( + this.issueNumberExampleWelsh = this.page.locator( 'xpath=//*[@id="issueNumber-hint"]' - ); + ); - this.postcodeLabelWelsh = this.page.locator( - 'xpath=//*[@id="postcode-label"]' - ); + this.postcodeLabelWelsh = this.page.locator( + 'xpath=//*[@id="postcode-label"]' + ); - this.postcodeLabelExampleWelsh = this.page.locator( + this.postcodeLabelExampleWelsh = this.page.locator( 'xpath=//*[@id="postcode-hint"]' - ); - } + ); + } isCurrentPage() { - return this.page.url() === this.url || this.page.url() === this.url + "?lang=cy"; + return ( + this.page.url() === this.url || this.page.url() === this.url + "?lang=cy" + ); } async assertDVLAPageTitle(dvlaDetailsEntryPageTitle) { @@ -508,62 +510,72 @@ exports.DrivingLicencePage = class PlaywrightDevPage { } async consentCheckBoxUnselect() { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - return await this.consentDVLACheckbox.click(); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + return await this.consentDVLACheckbox.click(); } async assertConsentErrorSummary(errorSummaryText) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.invalidConsentErrorSummary.innerText()).to.contains( - errorSummaryText - ); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.invalidConsentErrorSummary.innerText()).to.contains( + errorSummaryText + ); } async assertConsentErrorOnField(fieldErrorText) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.invalidConsentErrorFieldError.innerText()).to.contains( - fieldErrorText - ); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.invalidConsentErrorFieldError.innerText()).to.contains( + fieldErrorText + ); } // Welsh Language - async assertBetaBanner(betaBannerLabel) { + async assertBetaBanner(betaBannerLabel) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; - await expect(await this.betaBanner.textContent()).to.contains(betaBannerLabel); + await expect(await this.betaBanner.textContent()).to.contains( + betaBannerLabel + ); } - async assertBetaBannerText(assertBetaBannerText) { + async assertBetaBannerText(assertBetaBannerText) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; - await expect(await this.betaBannerReads.textContent()).to.contains(assertBetaBannerText); - } + await expect(await this.betaBannerReads.textContent()).to.contains( + assertBetaBannerText + ); + } - async assertLastName(dvlaLastNameWelsh) { + async assertLastName(dvlaLastNameWelsh) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; - await expect(await this.lastNameWelsh.textContent()).to.contains(dvlaLastNameWelsh ); + await expect(await this.lastNameWelsh.textContent()).to.contains( + dvlaLastNameWelsh + ); } - async assertGivenName(dvlaGivenNameWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.givenNameWelsh.textContent()).to.contain(dvlaGivenNameWelsh); - } + async assertGivenName(dvlaGivenNameWelsh) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.givenNameWelsh.textContent()).to.contain( + dvlaGivenNameWelsh + ); + } - async assertFirstName(dvlaFirstNameWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.firstName.textContent()).to.contain(dvlaFirstNameWelsh); - } + async assertFirstName(dvlaFirstNameWelsh) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.firstName.textContent()).to.contain(dvlaFirstNameWelsh); + } async assertMiddleName(dvlaMiddleNameWelsh) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; - expect(await this.middleNames.textContent()).to.contain(dvlaMiddleNameWelsh); + expect(await this.middleNames.textContent()).to.contain( + dvlaMiddleNameWelsh + ); } async assertFirstNameSentence(dvlaFirstNameSentWelsh) { @@ -583,149 +595,154 @@ exports.DrivingLicencePage = class PlaywrightDevPage { } async assertDoBFieldTitle(dobFieldTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.dobFieldTitleWelsh.innerText()).to.equal( - dobFieldTitleWelsh); - } + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.dobFieldTitleWelsh.innerText()).to.equal( + dobFieldTitleWelsh + ); + } async assertDobExample(dobExampleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.dobExample.innerText()).to.equal( - dobExampleWelsh); - } + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.dobExample.innerText()).to.equal(dobExampleWelsh); + } async assertDayWelsh(dayWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - await expect(await this.dayInWelsh.innerText()).to.equal( - dayWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.dayInWelsh.innerText()).to.equal(dayWelsh); } async assertMonthWelsh(monthWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - await expect(await this.monthInWelsh.innerText()).to.equal( - monthWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.monthInWelsh.innerText()).to.equal(monthWelsh); } - async assertYearWelsh(yearWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - await expect(await this.yearInWelsh.innerText()).to.equal( - yearWelsh); - } + async assertYearWelsh(yearWelsh) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.yearInWelsh.innerText()).to.equal(yearWelsh); + } - async assertIssueDateFieldTitleWelsh(issueFieldTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueFieldTitleWelsh.innerText()).to.equal( - issueFieldTitleWelsh); - } + async assertIssueDateFieldTitleWelsh(issueFieldTitleWelsh) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueFieldTitleWelsh.innerText()).to.equal( + issueFieldTitleWelsh + ); + } - async assertIssueDateExample(issueDateExampleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueFieldExample.innerText()).to.equal( - issueDateExampleWelsh); - } + async assertIssueDateExample(issueDateExampleWelsh) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueFieldExample.innerText()).to.equal( + issueDateExampleWelsh + ); + } - async assertValidDateFieldTitleWelsh(validDateFieldTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.validToFieldTitleWelsh.innerText()).to.equal( - validDateFieldTitleWelsh); - } + async assertValidDateFieldTitleWelsh(validDateFieldTitleWelsh) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToFieldTitleWelsh.innerText()).to.equal( + validDateFieldTitleWelsh + ); + } async assertValidDateExample(validDateExampleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.validToFieldExample.innerText()).to.equal( - validDateExampleWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToFieldExample.innerText()).to.equal( + validDateExampleWelsh + ); } async assertLicenceTitle(validLicenceTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.licenceTitleWelsh.innerText()).to.equal( - validLicenceTitleWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.licenceTitleWelsh.innerText()).to.equal( + validLicenceTitleWelsh + ); } async assertLicenceExample(validLicenceExampleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.licenceExampleWelsh.innerText()).to.equal( - validLicenceExampleWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.licenceExampleWelsh.innerText()).to.equal( + validLicenceExampleWelsh + ); } async assertIssueNumberTitle(issueNumberTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueNumberTitleWelsh.innerText()).to.equal( - issueNumberTitleWelsh); - } + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueNumberTitleWelsh.innerText()).to.equal( + issueNumberTitleWelsh + ); + } async assertIssueSentenceExample(issueNumberSentenceWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueNumberExampleWelsh.innerText()).to.equal( - issueNumberSentenceWelsh); - } + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueNumberExampleWelsh.innerText()).to.equal( + issueNumberSentenceWelsh + ); + } async assertPostcodeTitle(postcodeTitleWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.postcodeLabelWelsh.innerText()).to.equal( - postcodeTitleWelsh); - } + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.postcodeLabelWelsh.innerText()).to.equal( + postcodeTitleWelsh + ); + } - async assertPostcodeSentence(postcodeSentenceWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.postcodeLabelExampleWelsh.innerText()).to.equal( - postcodeSentenceWelsh); - } + async assertPostcodeSentence(postcodeSentenceWelsh) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.postcodeLabelExampleWelsh.innerText()).to.equal( + postcodeSentenceWelsh + ); + } async assertIssueDayWelsh(issueDayWelsh) { await this.page.waitForLoadState("domcontentloaded"); expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueDayInWelsh.innerText()).to.equal( - issueDayWelsh); + expect(await this.issueDayInWelsh.innerText()).to.equal(issueDayWelsh); } async assertIssueMonthWelsh(issueMonthWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueMonthInWelsh.innerText()).to.equal( - issueMonthWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueMonthInWelsh.innerText()).to.equal(issueMonthWelsh); } async assertIssueYearWelsh(issueYearWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.issueYearInWelsh.innerText()).to.equal( - issueYearWelsh); + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueYearInWelsh.innerText()).to.equal(issueYearWelsh); } async assertValidToDayWelsh(validToDayWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.validToDayInWelsh.innerText()).to.equal( - validToDayWelsh); - } + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToDayInWelsh.innerText()).to.equal(validToDayWelsh); + } async assertValidToMonthWelsh(validToMonthWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.validToMonthInWelsh.innerText()).to.equal( - validToMonthWelsh); - } - - async assertValidToYearWelsh(validToYearWelsh) { - await this.page.waitForLoadState("domcontentloaded"); - expect(await this.isCurrentPage()).to.be.true; - expect(await this.validToYearInWelsh.innerText()).to.equal( - validToYearWelsh); - } + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToMonthInWelsh.innerText()).to.equal( + validToMonthWelsh + ); + } + + async assertValidToYearWelsh(validToYearWelsh) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToYearInWelsh.innerText()).to.equal( + validToYearWelsh + ); + } }; diff --git a/test/browser/pages/UniversalSteps.js b/test/browser/pages/UniversalSteps.js index 96121b19..ead1b736 100644 --- a/test/browser/pages/UniversalSteps.js +++ b/test/browser/pages/UniversalSteps.js @@ -3,8 +3,8 @@ const { assertTrue, fail } = require("assert"); exports.UniversalSteps = class PlaywrightDevPage { constructor(page, url) { - this.page = page; - this.url = url; + this.page = page; + this.url = url; } async waitForTextToAppear(text) { diff --git a/test/browser/step_definitions/DrivingLicenceStepDefs.js b/test/browser/step_definitions/DrivingLicenceStepDefs.js index 6660ea63..4541e53c 100644 --- a/test/browser/step_definitions/DrivingLicenceStepDefs.js +++ b/test/browser/step_definitions/DrivingLicenceStepDefs.js @@ -13,9 +13,7 @@ Then( } ); -Then(/^User clicks on continue$/, - { timeout: 2 * 5000 }, - async function () { +Then(/^User clicks on continue$/, { timeout: 2 * 5000 }, async function () { const drivingLicencePage = new DrivingLicencePage(this.page); await drivingLicencePage.clickOnContinue(); }); @@ -545,13 +543,10 @@ Then( } ); -Then( - /^the beta banner reads (.*)$/, - async function (betaBannerTextWelsh) { - const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertBetaBannerText(betaBannerTextWelsh); - } -); +Then(/^the beta banner reads (.*)$/, async function (betaBannerTextWelsh) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertBetaBannerText(betaBannerTextWelsh); +}); Then(/^I can see the lastname as (.*)$/, async function (dvlaLastNameWelsh) { const drivingLicencePage = new DrivingLicencePage(this.page); @@ -580,9 +575,7 @@ Then( /^I can see the first name sentence (.*)$/, async function (dvlaFirstNameSentWelsh) { const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertFirstNameSentence( - dvlaFirstNameSentWelsh - ); + await drivingLicencePage.assertFirstNameSentence(dvlaFirstNameSentWelsh); } ); @@ -604,21 +597,15 @@ Then( } ); -Then( - /^I can see example as (.*)$/, - async function (dobExampleWelsh) { - const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertDobExample(dobExampleWelsh); - } -); +Then(/^I can see example as (.*)$/, async function (dobExampleWelsh) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertDobExample(dobExampleWelsh); +}); -Then( - /^I can see date as (.*)$/, - async function (dayWelsh) { - const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertDayWelsh(dayWelsh); - } -); +Then(/^I can see date as (.*)$/, async function (dayWelsh) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertDayWelsh(dayWelsh); +}); Then(/^I can see month as (.*)$/, async function (monthWelsh) { const drivingLicencePage = new DrivingLicencePage(this.page); @@ -634,7 +621,9 @@ Then( /^I can see the Issue date field titled (.*)$/, async function (issueFieldTitleWelsh) { const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertIssueDateFieldTitleWelsh(issueFieldTitleWelsh); + await drivingLicencePage.assertIssueDateFieldTitleWelsh( + issueFieldTitleWelsh + ); } ); @@ -646,13 +635,10 @@ Then( } ); -Then( - /^I can see issue day as (.*)$/, - async function (issueDayWelsh) { - const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertIssueDayWelsh(issueDayWelsh); - } -); +Then(/^I can see issue day as (.*)$/, async function (issueDayWelsh) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertIssueDayWelsh(issueDayWelsh); +}); Then(/^I can see issue month as (.*)$/, async function (issueMonthWelsh) { const drivingLicencePage = new DrivingLicencePage(this.page); @@ -668,7 +654,9 @@ Then( /^I can see the Valid to date field titled (.*)$/, async function (validDateFieldTitleWelsh) { const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertValidDateFieldTitleWelsh(validDateFieldTitleWelsh); + await drivingLicencePage.assertValidDateFieldTitleWelsh( + validDateFieldTitleWelsh + ); } ); @@ -680,13 +668,10 @@ Then( } ); -Then( - /^I can see Valid To day as (.*)$/, - async function (validToDayWelsh) { - const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertValidToDayWelsh(validToDayWelsh); - } -); +Then(/^I can see Valid To day as (.*)$/, async function (validToDayWelsh) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertValidToDayWelsh(validToDayWelsh); +}); Then(/^I can see Valid To month as (.*)$/, async function (validToMonthWelsh) { const drivingLicencePage = new DrivingLicencePage(this.page); @@ -726,7 +711,9 @@ Then( /^I can see issue sentence as (.*)$/, async function (issueNumberSentenceWelsh) { const drivingLicencePage = new DrivingLicencePage(this.page); - await drivingLicencePage.assertIssueSentenceExample(issueNumberSentenceWelsh); + await drivingLicencePage.assertIssueSentenceExample( + issueNumberSentenceWelsh + ); } ); @@ -749,66 +736,59 @@ Then( //########### Welsh - DVA ############## Then( - /^I see the heading (.*)$/, - { timeout: 2 * 5000 }, - async function (pageHeadingDVA) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVAPageHeading(pageHeadingDVA); + /^I see the heading (.*)$/, + { timeout: 2 * 5000 }, + async function (pageHeadingDVA) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAPageHeading(pageHeadingDVA); } - ); +); - Then( - /^I see sentence (.*)$/, - async function (pageHeadingDVASentence) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVAPageHeadingSentence(pageHeadingDVASentence); - } +Then(/^I see sentence (.*)$/, async function (pageHeadingDVASentence) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAPageHeadingSentence( + pageHeadingDVASentence ); +}); - Then( - /^I see We will check your details as (.*)$/, - async function (dVAPageSentence) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertdvaPageSentenceTwo(dVAPageSentence); - } - ); - - Then( - /^I check the page title (.*)$/, - async function (dvaPageTitle) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVAPageTitleWelsh(dvaPageTitle); - } - ); +Then( + /^I see We will check your details as (.*)$/, + async function (dVAPageSentence) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertdvaPageSentenceTwo(dVAPageSentence); + } +); + +Then(/^I check the page title (.*)$/, async function (dvaPageTitle) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAPageTitleWelsh(dvaPageTitle); +}); Then( /^I can see the DVA DoB fields titled (.*)$/, async function (dobFieldTitleWelsh) { const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVADoBFieldTitle(dobFieldTitleWelsh); - } - ); + await dvaDetailsEntryPage.assertDVADoBFieldTitle(dobFieldTitleWelsh); + } +); Then( /^I can see DVA DoB example DVA as (.*)$/, async function (dobExampleWelsh) { const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVADobExample(dobExampleWelsh); - } + await dvaDetailsEntryPage.assertDVADobExample(dobExampleWelsh); + } ); -Then( - /^I can see DVA day as (.*)$/, - async function (dayWelsh) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVADayWelsh(dayWelsh); - } -); +Then(/^I can see DVA day as (.*)$/, async function (dayWelsh) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVADayWelsh(dayWelsh); +}); Then(/^I can see DVA month as (.*)$/, async function (monthWelsh) { const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); await dvaDetailsEntryPage.assertDVAMonthWelsh(monthWelsh); - }); +}); Then(/^I can see DVA year as (.*)$/, async function (yearWelsh) { const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); @@ -816,51 +796,50 @@ Then(/^I can see DVA year as (.*)$/, async function (yearWelsh) { }); Then( - /^I see the DVA Issue date field titled (.*)$/, - async function (issueFieldTitleWelsh) { + /^I see the DVA Issue date field titled (.*)$/, + async function (issueFieldTitleWelsh) { const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVAIssueDateFieldTitleWelsh(issueFieldTitleWelsh); - } + await dvaDetailsEntryPage.assertDVAIssueDateFieldTitleWelsh( + issueFieldTitleWelsh + ); + } ); Then( - /^I see DVA date section example as (.*)$/, - async function (issueDateExampleWelsh) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + /^I see DVA date section example as (.*)$/, + async function (issueDateExampleWelsh) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); await dvaDetailsEntryPage.assertDVAIssueDateExample(issueDateExampleWelsh); - } + } ); -Then( - /^I can see DVA Issue day as (.*)$/, - async function (issueDayWelsh) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVAIssueDayWelsh(issueDayWelsh); - } -); +Then(/^I can see DVA Issue day as (.*)$/, async function (issueDayWelsh) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAIssueDayWelsh(issueDayWelsh); +}); Then(/^I can see DVA issue month as (.*)$/, async function (issueMonthWelsh) { const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); await dvaDetailsEntryPage.assertDVAIssueMonthWelsh(issueMonthWelsh); - }); - - Then(/^I can see DVA issue year as (.*)$/, async function (issueYearWelsh) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVAIssueYearWelsh(issueYearWelsh); - }); - - Then( - /^I can see DVA licence number field titled as (.*)$/, - async function (validLicenceTitleWelsh) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVALicenceTitle(validLicenceTitleWelsh); - } - ); +}); + +Then(/^I can see DVA issue year as (.*)$/, async function (issueYearWelsh) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAIssueYearWelsh(issueYearWelsh); +}); - Then( - /^I see the DVA licence sentence as (.*)$/, - async function (validLicenceExampleWelsh) { - const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); - await dvaDetailsEntryPage.assertDVALicenceExample(validLicenceExampleWelsh); +Then( + /^I can see DVA licence number field titled as (.*)$/, + async function (validLicenceTitleWelsh) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVALicenceTitle(validLicenceTitleWelsh); + } +); + +Then( + /^I see the DVA licence sentence as (.*)$/, + async function (validLicenceExampleWelsh) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVALicenceExample(validLicenceExampleWelsh); } - ); +); diff --git a/test/browser/step_definitions/UniversalStepDefs.js b/test/browser/step_definitions/UniversalStepDefs.js index 43e10fb2..b59e071b 100644 --- a/test/browser/step_definitions/UniversalStepDefs.js +++ b/test/browser/step_definitions/UniversalStepDefs.js @@ -3,7 +3,7 @@ const { UniversalSteps } = require("../pages/UniversalSteps"); Then( /^I add a cookie to change the language to (.*)$/, - { timeout: 2 * 5000 }, + { timeout: 2 * 5000 }, async function (language) { const universalSteps = new UniversalSteps(this.page, this.page.url()); await universalSteps.changeLanguageTo(language);