Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIME-722: Added frontend tests to cover welsh translation #146

Merged
merged 4 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/browser/features/DVA_Driving_Licence.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: DVA Driving licence CRI Error Validations
@mock-api:dva-invalidDrivingLicenceNumber @validation-regression @build @staging
Scenario Outline: DVA Driving Licence number less than 8 characters error validation
Given User enters DVA data as a <DVADrivingLicenceSubject>
And User re-enters drivingLicenceNumber as <InvalidLicenceNumber>
And DVA User re-enters drivingLicenceNumber as <InvalidLicenceNumber>
When User clicks on continue
Then I see the DVA licence number error in the summary as Your licence number should be 8 characters long
And I can see the DVA licence number error in the field as Your licence number should be 8 characters long
Expand All @@ -23,7 +23,7 @@ Feature: DVA Driving licence CRI Error Validations
@mock-api:dva-invalidDrivingLicenceNumber @validation-regression @build @staging
Scenario Outline: DVA Driving Licence number with special characters and spaces error validation
Given User enters DVA data as a <DVADrivingLicenceSubject>
And User re-enters drivingLicenceNumber as <InvalidLicenceNumber>
And DVA User re-enters drivingLicenceNumber as <InvalidLicenceNumber>
When User clicks on continue
Then I see the DVA licence number error in the summary as Your licence number should not include any symbols or spaces
And I can see the DVA licence number error in the field as Your licence number should not include any symbols or spaces
Expand All @@ -32,11 +32,11 @@ Feature: DVA Driving licence CRI Error Validations
|DVADrivingLicenceSubject |InvalidLicenceNumber|
|DrivingLicenceSubjectHappyBilly|55667^&* |

##### DrivingLicenceNumberWithAlphaNumericChar, DrivingLicenceNumberWithAlphaChar, NoDrivingLicenceNumber #####
###### DrivingLicenceNumberWithAlphaNumericChar, DrivingLicenceNumberWithAlphaChar, NoDrivingLicenceNumber #####
@mock-api:dva-invalidDrivingLicenceNumber @validation-regression @build @staging
Scenario Outline: DVA Driving Licence number with alpha numeric characters or alpha characters or no licence number error validation
Given User enters DVA data as a <DVADrivingLicenceSubject>
And User re-enters drivingLicenceNumber as <InvalidLicenceNumber>
And DVA User re-enters drivingLicenceNumber as <InvalidLicenceNumber>
When User clicks on continue
Then I see the DVA licence number error in the summary as Enter the number exactly as it appears on your driving licence
And I can see the DVA licence number error in the field as Enter the number exactly as it appears on your driving licence
Expand Down Expand Up @@ -83,7 +83,7 @@ Feature: DVA Driving licence CRI Error Validations
|DVADrivingLicenceSubject |InvalidPostcode |
|DrivingLicenceSubjectHappyBilly|CA 95128 |

###### PostcodeWithSpecialChar #####
##### PostcodeWithSpecialChar #####
@mock-api:dva-invalidPostcode @validation-regression @build @staging
Scenario Outline: DVA Driving Licence Postcode with special characters error validation
Given User enters DVA data as a <DVADrivingLicenceSubject>
Expand Down
368 changes: 368 additions & 0 deletions test/browser/features/WelshDrivingLicence.feature

Large diffs are not rendered by default.

304 changes: 304 additions & 0 deletions test/browser/features/Welsh_DVA_Driving_Licence.feature

Large diffs are not rendered by default.

174 changes: 166 additions & 8 deletions test/browser/pages/DVADetailsEntryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage {
this.page = page;
this.url = "http://localhost:5030/details";

this.licenceNumber = this.page.getByLabel(" Licence number ");
this.licenceNumber = this.page.locator('xpath=//*[@id="dvaLicenceNumber"]');

this.lastName = this.page.getByLabel(" Last name ");
this.firstName = this.page.getByLabel(" First name ");
this.middleNames = this.page.getByLabel(" Middle names ");
this.lastName = this.page.locator('xpath=//*[@id="surname"]');
this.firstName = this.page.locator('xpath=//*[@id="firstName"]');
this.middleNames = this.page.locator('xpath=//*[@id="middleNames"]');

this.dvaBirthDay = this.page.locator('xpath=//*[@id="dvaDateOfBirth-day"]');
this.dvaBirthMonth = this.page.locator(
Expand Down Expand Up @@ -40,10 +40,10 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage {
'xpath=//*[@id="dateOfIssue-year"]'
);

this.postcode = this.page.getByLabel(" Postcode ");
this.postcode = this.page.locator('xpath=//*[@id="postcode"]');

this.consentDVACheckbox = this.page.getByLabel(
"Give DVA your consent to check your driving licence details"
this.consentDVACheckbox = this.page.locator(
'xpath=//*[@id="consentDVACheckbox"]'
);

// DVA Error summary items
Expand All @@ -69,19 +69,79 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage {
this.dvaDrivingLicenceFieldError = this.page.locator(
'xpath=//*[@id="dvaLicenceNumber-error"]'
);

this.invalidDobDvaFieldError = this.page.locator(
'xpath=//*[@id="dvaDateOfBirth-error"]'
);

this.invalidDvaIssueDateFieldError = this.page.locator(
'xpath=//*[@id="dateOfIssue-error"]'
);

this.invalidConsentDVAFieldError = this.page.locator(
'xpath=//*[@id="consentDVACheckbox-error"]'
);

//Page Content - DVA
this.header = this.page.locator('xpath=//*[@id="header"]');

this.dateOfBirthLegend = this.page.locator(
'xpath=//*[@id="dvaDateOfBirth-fieldset"]/legend'
);

this.dateOfBirthHint = this.page.locator(
'xpath=//*[@id="dvaDateOfBirth-hint"]'
);

this.dayLabel = this.page.locator(
'xpath=//*[@id="dvaDateOfBirth"]/div[1]/div/label'
);

this.monthLabel = this.page.locator(
'xpath=//*[@id="dvaDateOfBirth"]/div[2]/div/label'
);

this.yearLabel = this.page.locator(
'xpath=//*[@id="dvaDateOfBirth"]/div[3]/div/label'
);

this.dateOfIssueLegend = this.page.locator(
'xpath=//*[@id="dateOfIssue-fieldset"]/legend'
);

this.dateOfIssueHint = this.page.locator(
'xpath=//*[@id="dateOfIssue-hint"]'
);

this.dateOfIssueDayLabel = this.page.locator(
'xpath=//*[@id="dateOfIssue"]/div[1]/div/label'
);

this.dateOfIssueMonthLabel = this.page.locator(
'xpath=//*[@id="dateOfIssue"]/div[2]/div/label'
);

this.dateOfIssueYearLabel = this.page.locator(
'xpath=//*[@id="dateOfIssue"]/div[3]/div/label'
);

this.licenceNumberLabel = this.page.locator(
'xpath=//*[@id="dvaLicenceNumber-label"]'
);

this.licenceNumberHint = this.page.locator(
'xpath=//*[@id="dvaLicenceNumber-hint"]'
);

this.serviceDescription = this.page.locator(
'xpath=//*[@id="main-content"]/div/div/div'
);
}

isCurrentPage() {
return this.page.url() === this.url;
return (
this.page.url() === this.url || this.page.url() === this.url + "?lang=cy"
);
}

async assertDVAPageTitle(dvaDetailsEntryPageTitle) {
Expand Down Expand Up @@ -138,6 +198,10 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage {

// Re-enter test data

async dvaUserReEntersLicenceNumber(InvalidLicenceNumber) {
await this.licenceNumber.fill(InvalidLicenceNumber);
}

async dvaUserReEntersDayOfBirth(InvalidDayOfBirth) {
await this.dvaBirthDay.fill(InvalidDayOfBirth);
}
Expand Down Expand Up @@ -233,4 +297,98 @@ exports.DVADetailsEntryPage = class PlaywrightDevPage {
fieldErrorText
);
}

// DVA text content

async assertDVAPageHeading(pageHeadingDVA) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.header.innerText()).to.equal(pageHeadingDVA);
}

async assertDVAPageHeadingSentence(pageHeadingDVASentence) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.serviceDescription.innerText()).to.equal(
pageHeadingDVASentence
);
}

async assertDVADoBFieldTitle(dobFieldTitle) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.dateOfBirthLegend.innerText()).to.equal(dobFieldTitle);
}

async assertDVADobExample(dobExample) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.dateOfBirthHint.innerText()).to.equal(dobExample);
}

async assertDVADay(day) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
await expect(await this.dayLabel.innerText()).to.contains(day);
}

async assertDVAMonth(month) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
await expect(await this.monthLabel.innerText()).to.contains(month);
}

async assertDVAYear(year) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
await expect(await this.yearLabel.innerText()).to.contains(year);
}

async assertDVAIssueDateFieldTitle(issueFieldTitle) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.dateOfIssueLegend.innerText()).to.equal(issueFieldTitle);
}

async assertDVAIssueDateExample(issueDateExample) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.dateOfIssueHint.innerText()).to.equal(issueDateExample);
}

async assertDVAIssueDay(issueDay) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.dateOfIssueDayLabel.innerText()).to.contains(issueDay);
}

async assertDVAIssueMonth(issueMonth) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.dateOfIssueMonthLabel.innerText()).to.contains(
issueMonth
);
}

async assertDVAIssueYear(issueYear) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.dateOfIssueYearLabel.innerText()).to.contains(issueYear);
}

async assertDVALicenceTitle(validLicenceTitle) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.licenceNumberLabel.innerText()).to.equal(
validLicenceTitle
);
}

async assertDVALicenceExample(validLicenceExample) {
await this.page.waitForLoadState("domcontentloaded");
expect(await this.isCurrentPage()).to.be.true;
expect(await this.licenceNumberHint.innerText()).to.equal(
validLicenceExample
);
}
};
Loading
Loading