Skip to content

Commit

Permalink
ran yarn lint-apply to pre merge checks pass
Browse files Browse the repository at this point in the history
  • Loading branch information
MathumithaVe committed Aug 7, 2023
1 parent da93256 commit 18f93b9
Show file tree
Hide file tree
Showing 5 changed files with 382 additions and 386 deletions.
152 changes: 76 additions & 76 deletions test/browser/pages/DVADetailsEntryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")]'
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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) {
Expand Down Expand Up @@ -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
);
}
};
Loading

0 comments on commit 18f93b9

Please sign in to comment.