diff --git a/test/browser/features/DVA_Driving_Licence.feature b/test/browser/features/DVA_Driving_Licence.feature index 0bde289e..902c3229 100644 --- a/test/browser/features/DVA_Driving_Licence.feature +++ b/test/browser/features/DVA_Driving_Licence.feature @@ -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 - And User re-enters drivingLicenceNumber as + And DVA User re-enters drivingLicenceNumber as 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 @@ -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 - And User re-enters drivingLicenceNumber as + And DVA User re-enters drivingLicenceNumber as 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 @@ -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 - And User re-enters drivingLicenceNumber as + And DVA User re-enters drivingLicenceNumber as 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 @@ -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 diff --git a/test/browser/features/WelshDrivingLicence.feature b/test/browser/features/WelshDrivingLicence.feature new file mode 100644 index 00000000..749f15f8 --- /dev/null +++ b/test/browser/features/WelshDrivingLicence.feature @@ -0,0 +1,368 @@ +@mock-api:dl-success @success @DVLA +Feature: DVLA Driving licence CRI Error Validations + + Background: + Given Authenticatable Anita is using the system + And they have provided their details + And they have started the DL journey + And I click on DVLA radio button and Continue + And I add a cookie to change the language to Welsh + + @mock-api:dva-PageHeading @language-regression + Scenario:User Selects DVA and landed in DVA page and Page title and sub-text + Given I check the page title Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Then I see the heading Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru + And I see sentence Os nad oes gennych drwydded yrru y DU neu os na allwch gofio'ch manylion, gallwch brofi pwy ydych chi mewn ffordd arall yn lle. + + @mock-api:dvla-WelshBetaBanner @language-regression + Scenario: Beta Banner + Given I view the beta banner + And the beta banner reads Mae hwn yn wasanaeth newydd – bydd eich adborth (agor mewn tab newydd) yn ein helpu i'w wella. + + @mock-api:dvla-NameField @language-regression + Scenario: DVLA Name fields + Given I can see the lastname as Enw olaf + And I can see the givenName as Enwau a roddwyd + And I can see the firstName as Enw cyntaf + And I can see the middleName as Enwau canol + And I can see the first name sentence Mae hwn yn adran 2 o'ch trwydded. Nid oes angen i chi gynnwys eich teitl. + And I can see the middle name sentence Gadewch hyn yn wag os nad oes gennych unrhyw enwau canol + + @mock-api:dvla-DobField @language-regression + Scenario: DVLA DoB Fields + Given I can see the DoB fields titled Dyddiad geni + When I can see example as Er enghraifft, 5 9 1973 + Then I can see date as Diwrnod + And I can see month as Mis + And I can see year as Blwyddyn + + @mock-api:dvla-IssueDateField @language-regression + @Language-regression + Scenario: DVLA Issue date fields + Given I can see the Issue date field titled Dyddiad cyhoeddi + Then I can see Issue date sentence as Dyma'r dyddiad yn adran 4a o'ch trwydded, er enghraifft 27 5 2019 + And I can see issue day as Diwrnod + Then I can see issue month as Mis + And I can see issue year as Blwyddyn + + @mock-api:dvla-ValidToDateField @language-regression + Scenario: DVLA Valid to date field + Given I can see the Valid to date field titled Yn ddilys tan + And I can see Valid to date sentence as Dyma'r dyddiad yn adran 4b o'ch trwydded, er enghraifft 27 5 2019 + Then I can see Valid To day as Diwrnod + And I can see Valid To month as Mis + Then I can see Valid To year as Blwyddyn + + @mock-api:dvla-LicenceField @language-regression + Scenario: DVLA Licence number + Given I can see the licence number field titled Rhif trwydded + Then I see the Licence number sentence Dyma'r rhif hir yn adran 5 ar eich trwydded er enghraifft HARRI559146MJ931 + + @mock-api:dvla-IssueNumberField @language-regression + Scenario: DVLA Issue number + Given I can see the issue number field titled Rhif cyhoeddi + And I can see issue sentence as Dyma'r rhif 2 ddigid ar ôl y gofod yn adran 5 o'ch trwydded + + @mock-api:dvla-PostcodeField @language-regression + Scenario: DVLA Postcode + Given I can see the postcode field titled Cod post + Then I can see postcode sentence as Rhowch y cod post yn y cyfeiriad yn adran 8 o'ch trwydded + + #### Summary Error validation ###### + + @mock-api:dvla-unhappyPath @language-regression + Scenario Outline: DVLA Driving Licence details page unhappy path when licence number date format does not match with User's Date Of Birth + Given User enters DVLA data as a + And User re-enters day of birth as + And User re-enters month of birth as + And User re-enters year of birth as + When User clicks on continue + Then I see the licence number error in the summary as Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru + And I can see the licence number error in the field as Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru + Then I see the date of birth error summary as Gwiriwch eich bod wedi rhoi eich dyddiad geni yn gywir + And I see the date of birth error in the field as Gwiriwch eich bod wedi rhoi eich dyddiad geni yn gywir + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidDayOfBirth|InvalidMonthOfBirth|InvalidYearOfBirth| + |DrivingLicenceSubjectHappyPeter| 12 | 08 | 1985 | + + ##### InvalidLastNameWithNumbers, InvalidLastNameWithSpecialCharacters, NoLastName ##### + @mock-api:dvla-invalidLastName @language-regression + Scenario Outline: DVLA Driving Licence Last name with numbers or special characters or no last name error validation + Given User enters DVLA data as a + And User re-enters last name as + When User clicks on continue + Then I see the Lastname error in the error summary as Rhowch eich enw olaf fel y mae'n ymddangos ar eich trwydded yrru + And I see the Lastname error in the error field as Rhowch eich enw olaf fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidLastName | + |DrivingLicenceSubjectHappyPeter|KYLE123 | + |DrivingLicenceSubjectHappyPeter|KYLE^&( | + |DrivingLicenceSubjectHappyPeter| | + + ##### InvalidFirstNameWithNumbers, InvalidFirstNameWithSpecialCharacters, NoFirstName ##### + @mock-api:dvla-invalidFirstName @language-regression + Scenario Outline: DVLA Driving Licence First name with numbers or special characters or no first name error validation + Given User enters DVLA data as a + And User re-enters first name as + When User clicks on continue + Then I see the Firstname error summary as Rhowch eich enw cyntaf fel y mae'n ymddangos ar eich trwydded yrru + And I see the Firstname error in the error field as Rhowch eich enw cyntaf fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidFirstName| + |DrivingLicenceSubjectHappyPeter|SELINA987 | + |DrivingLicenceSubjectHappyPeter|SELINA%$@ | + |DrivingLicenceSubjectHappyPeter| | + + ##### InvalidMiddleNamesWithNumbers, InvalidMiddleNamesWithSpecialCharacters ##### + @mock-api:dvla-invalidMiddleNames @language-regression + Scenario Outline: DVLA Driving Licence Middle names with numbers or special characters error validation + Given User enters DVLA data as a + And User re-enters middle names as + When User clicks on continue + Then I see the middlenames error summary as Rhowch unrhyw enwau canol fel y maent yn ymddangos ar eich trwydded yrru + And I see the middlenames error in the error field as Rhowch unrhyw enwau canol fel y maent yn ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidMiddleNames| + |DrivingLicenceSubjectHappyPeter|SELINA987 | + |DrivingLicenceSubjectHappyPeter|SELINA%$@ | + +##### DateOfBirthWithSpecialCharacters, DateOfBirthNotReal, NoDateOfBirth ##### + @mock-api:dvla-invalidDateOfBirth @language-regression + Scenario Outline: DVLA Driving Licence Date of birth that are not real or with special characters or no date of birth error validation + Given User enters DVLA data as a + And User re-enters day of birth as + And User re-enters month of birth as + And User re-enters year of birth as + When User clicks on continue + Then I see the date of birth error summary as Rhowch eich dyddiad geni fel y mae'n ymddangos ar eich trwydded yrru + And I see the date of birth error in the field as Rhowch eich dyddiad geni fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidDayOfBirth|InvalidMonthOfBirth|InvalidYearOfBirth| + |DrivingLicenceSubjectHappyPeter| @ | *& | 19 7 | + |DrivingLicenceSubjectHappyPeter| 51 | 71 | 198 | + #DVLA Driving licence with no date of birth scenario is not displaying the expected error message and has been raised as a bug LIME-694 + #|DrivingLicenceSubjectHappyPeter| | | | + + @mock-api:dvla-invalidDateOfBirth @language-regression + Scenario Outline: DVLA Driving Licence Date of birth in the future error validation + Given User enters DVLA data as a + And User re-enters day of birth as + And User re-enters month of birth as + And User re-enters year of birth as + When User clicks on continue + Then I see the date of birth error summary as Rhaid i'ch dyddiad geni fod yn y gorffennol + And I see the date of birth error in the field as Rhaid i'ch dyddiad geni fod yn y gorffennol + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidDayOfBirth|InvalidMonthOfBirth|InvalidYearOfBirth| + |DrivingLicenceSubjectHappyPeter| 10 | 10 | 2042 | + + ##### InvalidIssueDate, NoIssueDate ##### + @mock-api:dvla-invalidIssueDate @language-regression + Scenario Outline: DVLA Driving Licence Issue date that are not real or with special characters or no issue date error validation + Given User enters DVLA data as a + And User re-enters day of issue as + And User re-enters month of issue as + And User re-enters year of issue as + When User clicks on continue + Then I see issue date error in summary as Rhowch y dyddiad fel y mae'n ymddangos ar eich trwydded yrru + And I see invalid issue date field error as Rhowch y dyddiad fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + + Examples: + |DrivingLicenceSubject |InvalidDayOfIssue|InvalidMonthOfIssue|InvalidYearOfIssue| + |DrivingLicenceSubjectHappyPeter| AA | BB | AABC | + |DrivingLicenceSubjectHappyPeter| & | ^% | £$ ^ | + |DrivingLicenceSubjectHappyPeter| | | | + + @mock-api:dvla-invalidIssueDate @language-regression + Scenario Outline: DVLA Driving Licence Issue date in the future error validation + Given User enters DVLA data as a + And User re-enters day of issue as + And User re-enters month of issue as + And User re-enters year of issue as + When User clicks on continue + Then I see issue date error in summary as Rhaid i ddyddiad cyhoeddi fod yn y gorffennol + And I see invalid issue date field error as Rhaid i ddyddiad cyhoeddi fod yn y gorffennol + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidDayOfIssue|InvalidMonthOfIssue|InvalidYearOfIssue| + |DrivingLicenceSubjectHappyPeter| 01 | 10 | 2043 | + + #### InvalidValidToDate, ValidToDateWithSpecialCharacters, NoValidToDate ##### + @mock-api:dvla-invalidExpiryDate @language-regression + Scenario Outline: DVLA Driving Licence Valid to date that are not real or with special characters or no valid to date error validation + Given User enters DVLA data as a + And User re-enters valid to day as + And User re-enters valid to month as + And User re-enters valid to year + When User clicks on continue + Then I can see the valid to date error in the error summary as Rhowch y dyddiad fel y mae'n ymddangos ar eich trwydded yrru + And I can see the Valid to date field error as Rhowch y dyddiad fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidValidToDay|InvalidValidToMonth|InvalidValidToYear| + |DrivingLicenceSubjectHappyPeter| AA | BC | AABD | + |DrivingLicenceSubjectHappyPeter| !@ | £$ | %^ * | + |DrivingLicenceSubjectHappyPeter| | | | + + @mock-api:dvla-invalidExpiryDate @language-regression + Scenario Outline: DVLA Driving Licence Valid to date in the past error validation + Given User enters DVLA data as a + And User re-enters valid to day as + And User re-enters valid to month as + And User re-enters valid to year + When User clicks on continue + Then I can see the valid to date error in the error summary as Ni allwch ddefnyddio trwydded yrru sydd wedi dod i ben + And I can see the Valid to date field error as Ni allwch ddefnyddio trwydded yrru sydd wedi dod i ben + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidValidToDay|InvalidValidToMonth|InvalidValidToYear| + |DrivingLicenceSubjectHappyPeter| 10 | 01 | 2010 | + + + @mock-api:dvla-invalidDrivingLicenceNumber @language-regression + Scenario Outline: DVLA Driving Licence number less than 16 characters error validation + Given User enters DVLA data as a + And User re-enters drivingLicenceNumber as + When User clicks on continue + Then I see the licence number error in the summary as Dylai rhif eich trwydded fod yn 16 nod o hyd + And I can see the licence number error in the field as Dylai rhif eich trwydded fod yn 16 nod o hyd + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidLicenceNumber| + |DrivingLicenceSubjectHappyPeter|PARKE610112PBF | + + @mock-api:dvla-invalidDrivingLicenceNumber @language-regression + Scenario Outline: DVLA Driving Licence number with special characters and spaces error validation + Given User enters DVLA data as a + And User re-enters drivingLicenceNumber as + When User clicks on continue + Then I see the licence number error in the summary as Ni ddylai rhif eich trwydded gynnwys unrhyw symbolau neu ofodau + And I can see the licence number error in the field as Ni ddylai rhif eich trwydded gynnwys unrhyw symbolau neu ofodau + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidLicenceNumber| + |DrivingLicenceSubjectHappyPeter|12345678901112@@ | + +####### DrivingLicenceNumberWithNumericChar, DrivingLicenceNumberWithAlphaChar, NoDrivingLicenceNumber ####### + @mock-api:dvla-invalidDrivingLicenceNumber @language-regression + Scenario Outline: DVLA Driving Licence number with numeric characters or alpha characters or no licence number error validation + Given User enters DVLA data as a + And User re-enters drivingLicenceNumber as + When User clicks on continue + Then I see the licence number error in the summary as Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru + And I can see the licence number error in the field as Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidLicenceNumber| + |DrivingLicenceSubjectHappyPeter|1234567890111213 | + |DrivingLicenceSubjectHappyPeter|abcdefghijklomnp | + |DrivingLicenceSubjectHappyPeter| | + + @mock-api:dvla-invalidIssueNumber @language-regression + Scenario Outline: DVLA Driving Licence Issue number less than 2 characters error validation + Given User enters DVLA data as a + And User re-enters issue number as + When User clicks on continue + Then I see the issue number error in summary as Dylai eich rhif cyhoeddi fod yn 2 rif o hyd + And I see the issue number error in field as Dylai eich rhif cyhoeddi fod yn 2 rif o hyd + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidIssueNumber| + |DrivingLicenceSubjectHappyPeter|1 | + + @mock-api:dvla-invalidIssueNumber @language-regression + Scenario Outline: DVLA Driving Licence Issue number with special characters error validation + Given User enters DVLA data as a + And User re-enters issue number as + When User clicks on continue + Then I see the issue number error in summary as Ni ddylai eich rhif cyhoeddi gynnwys unrhyw symbolau neu ofodau + And I see the issue number error in field as Ni ddylai eich rhif cyhoeddi gynnwys unrhyw symbolau neu ofodau + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidIssueNumber| + |DrivingLicenceSubjectHappyPeter|A@ | + +##### IssueNumberWithAlphanumericChar, IssueNumberWithAlphaChar, NoIssueNumber ##### + @mock-api:dvla-invalidIssueNumber @language-regression + Scenario Outline: DVLA Driving Licence Issue number with alphanumeric characters or alpha characters No issue number error validation + Given User enters DVLA data as a + And User re-enters issue number as + When User clicks on continue + Then I see the issue number error in summary as Rhowch y rhif cyhoeddi fel y mae'n ymddangos ar eich trwydded yrru + And I see the issue number error in field as Rhowch y rhif cyhoeddi fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidIssueNumber| +# |DrivingLicenceSubjectHappyPeter|A1 |bug raised -LIME-751 +# |DrivingLicenceSubjectHappyPeter|AB |bug rasied - LIME-751 + |DrivingLicenceSubjectHappyPeter| | + + @mock-api:dvla-invalidPostcode @language-regression + Scenario Outline: DVLA Driving Licence Postcode less than 5 characters error validation + Given User enters DVLA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Dylai eich rhowch eich cod post fod rhwng 5 a 7 nod + And I see the postcode error in field as Dylai eich rhowch eich cod post fod rhwng 5 a 7 nod + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidPostcode | + |DrivingLicenceSubjectHappyPeter|E20A | + + @mock-api:dvla-invalidPostcode @language-regression + Scenario Outline: DVLA Driving Licence - No Postcode in the Postcode field error validation + Given User enters DVLA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Rhowch eich cod post + And I see the postcode error in field as Rhowch eich cod post + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidPostcode | + |DrivingLicenceSubjectHappyPeter| | + + @mock-api:dvla-invalidPostcode @language-regression + Scenario Outline: DVLA Driving Licence International Postcode error validation + Given User enters DVLA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Rhowch god post yn y DU + And I see the postcode error in field as Rhowch god post yn y DU + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidPostcode | + |DrivingLicenceSubjectHappyPeter|CA 95128 | + +##### PostcodeWithSpecialChar ##### + @mock-api:dvla-invalidPostcode @language-regression + Scenario Outline: DVLA Driving Licence Postcode with special characters error validation + Given User enters DVLA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Dylai eich rhowch eich cod post ond cynnwys rhifau a llythrennau yn unig + And I see the postcode error in field as Dylai eich rhowch eich cod post ond cynnwys rhifau a llythrennau yn unig + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidPostcode | + |DrivingLicenceSubjectHappyPeter|NW* ^%G | + +###### PostcodeWithNumericChar, PostcodeWithAlphaChar ##### (need clarification) + @mock-api:dvla-invalidPostcode @language-regression + Scenario Outline: DVLA Driving Licence Postcode with numeric characters or alpha characters error validation + Given User enters DVLA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Dylai eich rhowch eich cod post ond cynnwys rhifau a llythrennau + And I see the postcode error in field as Dylai eich rhowch eich cod post ond cynnwys rhifau a llythrennau + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DrivingLicenceSubject |InvalidPostcode | + #|DrivingLicenceSubjectHappyPeter|123 456 | Bug raised -LIME-750 + |DrivingLicenceSubjectHappyPeter|ABC XYZ | diff --git a/test/browser/features/Welsh_DVA_Driving_Licence.feature b/test/browser/features/Welsh_DVA_Driving_Licence.feature new file mode 100644 index 00000000..7a8f2dfe --- /dev/null +++ b/test/browser/features/Welsh_DVA_Driving_Licence.feature @@ -0,0 +1,304 @@ +@mock-api:dl-success @success @DVA +Feature: DVA Driving licence CRI Error Validations + + Background: + Given Authenticatable Anita is using the system + And they have provided their details + And they have started the DL journey + And I click on DVA radio button and Continue + And I add a cookie to change the language to Welsh + + @mock-api:dva-PageHeading @language-regression + Scenario:User Selects DVA and landed in DVA page and Page title and sub-text + Given I check the page title Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Then I see the heading Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru + And I see sentence Os nad oes gennych drwydded yrru y DU neu os na allwch gofio'ch manylion, gallwch brofi pwy ydych chi mewn ffordd arall yn lle. + + @mock-api:dvla-WelshBetaBanner @validation-regression + Scenario: Beta Banner + Given I view the beta banner + And the beta banner reads Mae hwn yn wasanaeth newydd – bydd eich adborth (agor mewn tab newydd) yn ein helpu i'w wella. + + @mock-api:dva-NameFiled @language-regression + Scenario: DVA Name fields + Given I can see the lastname as Enw olaf + And I can see the givenName as Enwau a roddwyd + And I can see the firstName as Enw cyntaf + And I can see the middleName as Enwau canol + And I can see the first name sentence Mae hwn yn adran 2 o'ch trwydded. Nid oes angen i chi gynnwys eich teitl. + And I can see the middle name sentence Gadewch hyn yn wag os nad oes gennych unrhyw enwau canol + + @mock-api:dva-DoBField @language-regression + Scenario: DVA DoB Field + Given I can see the DVA DoB fields titled Dyddiad geni + Then I can see DVA DoB example DVA as Er enghraifft, 5 9 1973 + Then I can see DVA day as Diwrnod + And I can see DVA month as Mis + And I can see DVA year as Blwyddyn + + @mock-api:dva-IssueField @language-regression + Scenario: DVA Issue date field + Given I see the DVA Issue date field titled Dyddiad cyhoeddi + Then I see DVA date section example as Dyma'r dyddiad yn adran 4a o'ch trwydded, er enghraifft 27 5 2019 + Then I can see DVA Issue day as Diwrnod + And I can see DVA issue month as Mis + And I can see DVA issue year as Blwyddyn + + @mock-api:dva-ValidToDateField @language-regression + Scenario: DVLA Valid to date field + Given I can see the Valid to date field titled Yn ddilys tan + And I can see Valid to date sentence as Dyma'r dyddiad yn adran 4b o'ch trwydded, er enghraifft 27 5 2019 + Then I can see Valid To day as Diwrnod + And I can see Valid To month as Mis + Then I can see Valid To year as Blwyddyn + + @mock-api:dva-LicenceField @language-regression + Scenario: DVA Licence number + Given I can see DVA licence number field titled as Rhif trwydded + And I see the DVA licence sentence as Dyma'r rhif hir yn adran 5 ar eich trwydded + + @mock-api:dva-PostcodeField @language-regression + Scenario: DVA Postcode + Given I can see the postcode field titled Cod post + Then I can see postcode sentence as Rhowch y cod post yn y cyfeiriad yn adran 8 o'ch trwydded + + ##### Summary Error Validation ###### + + @mock-api:dva-invalidDrivingLicenceNumber @language-regression + Scenario Outline: DVA Driving Licence number less than 8 characters error validation + Given User enters DVA data as a + And DVA User re-enters drivingLicenceNumber as + When User clicks on continue + Then I see the DVA licence number error in the summary as Dylai rhif eich trwydded fod yn 8 nod o hyd + And I can see the DVA licence number error in the field as Dylai rhif eich trwydded fod yn 8 nod o hyd + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidLicenceNumber| + |DrivingLicenceSubjectHappyBilly|5566778 | + + @mock-api:dva-invalidDrivingLicenceNumber @language-regression + Scenario Outline: DVA Driving Licence number with special characters and spaces error validation + Given User enters DVA data as a + And DVA User re-enters drivingLicenceNumber as + When User clicks on continue + Then I see the DVA licence number error in the summary as Ni ddylai rhif eich trwydded gynnwys unrhyw symbolau neu ofodau + And I can see the DVA licence number error in the field as Ni ddylai rhif eich trwydded gynnwys unrhyw symbolau neu ofodau + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidLicenceNumber| + |DrivingLicenceSubjectHappyBilly|55667^&* | + +##### DrivingLicenceNumberWithAlphaNumericChar, DrivingLicenceNumberWithAlphaChar, NoDrivingLicenceNumber ##### + @mock-api:dva-invalidDrivingLicenceNumber @language-regression + Scenario Outline: DVA Driving Licence number with alpha numeric characters or alpha characters or no licence number error validation + Given DVA User re-enters drivingLicenceNumber as + And DVA User re-enters drivingLicenceNumber as + When User clicks on continue + Then I see the DVA licence number error in the summary as Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru + And I can see the DVA licence number error in the field as Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidLicenceNumber| +# |DrivingLicenceSubjectHappyBilly|55667ABC | - bug raised +# |DrivingLicenceSubjectHappyBilly|XYZabdAB | - bug raised + |DrivingLicenceSubjectHappyBilly | | + + @mock-api:dva-invalidPostcode @language-regression + Scenario Outline: DVA Driving Licence Postcode less than 5 characters error validation + Given User enters DVA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Dylai eich rhowch eich cod post fod rhwng 5 a 7 nod + And I see the postcode error in field as Dylai eich rhowch eich cod post fod rhwng 5 a 7 nod + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidPostcode | + |DrivingLicenceSubjectHappyBilly|E20A | + + @mock-api:dva-invalidPostcode @language-regression + Scenario Outline: DVA Driving Licence - No Postcode in the Postcode field error validation + Given User enters DVA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Rhowch eich cod post + And I see the postcode error in field as Rhowch eich cod post + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidPostcode | + |DrivingLicenceSubjectHappyBilly| | + + @mock-api:dva-invalidPostcode @language-regression + Scenario Outline: DVA Driving Licence International Postcode error validation + Given User enters DVA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Rhowch god post yn y DU + And I see the postcode error in field as Rhowch god post yn y DU + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidPostcode | + |DrivingLicenceSubjectHappyBilly|CA 95128 | + +###### PostcodeWithSpecialChar ##### + @mock-api:dva-invalidPostcode @language-regression + Scenario Outline: DVA Driving Licence Postcode with special characters error validation + Given User enters DVA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Dylai eich rhowch eich cod post ond cynnwys rhifau a llythrennau yn unig + And I see the postcode error in field as Dylai eich rhowch eich cod post ond cynnwys rhifau a llythrennau yn unig + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidPostcode | + |DrivingLicenceSubjectHappyBilly|NW* ^%G | + +####### PostcodeWithNumericChar, PostcodeWithAlphaChar ##### + @mock-api:dva-invalidPostcode @language-regression + Scenario Outline: DVA Driving Licence Postcode with numeric characters or alpha characters error validation + Given User enters DVA data as a + And User re-enters postcode as + When User clicks on continue + Then I see the postcode error in summary as Dylai eich rhowch eich cod post ond cynnwys rhifau a llythrennau + And I see the postcode error in field as Dylai eich rhowch eich cod post ond cynnwys rhifau a llythrennau + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidPostcode | + # |DrivingLicenceSubjectHappyBilly|123 456 | Bug raised -LIME-750 + |DrivingLicenceSubjectHappyBilly|ABC XYZ | + +###### InvalidLastNameWithNumbers, InvalidLastNameWithSpecialCharacters, NoLastName ##### + @mock-api:dva-invalidLastName @language-regression + Scenario Outline: DVA Driving Licence Last name with numbers or special characters or no last name error validation + Given User enters DVA data as a + And User re-enters last name as + When User clicks on continue + Then I see the Lastname error in the error summary as Rhowch eich enw olaf fel y mae'n ymddangos ar eich trwydded yrru + And I see the Lastname error in the error field as Rhowch eich enw olaf fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidLastName | + |DrivingLicenceSubjectHappyBilly|KYLE123 | + |DrivingLicenceSubjectHappyBilly|KYLE^&( | + |DrivingLicenceSubjectHappyBilly| | + +###### InvalidFirstNameWithNumbers, InvalidFirstNameWithSpecialCharacters, NoFirstName ##### + @mock-api:dva-invalidFirstName @language-regression + Scenario Outline: DVA Driving Licence First name with numbers or special characters or no first name error validation + Given User enters DVA data as a + And User re-enters first name as + When User clicks on continue + Then I see the Firstname error summary as Rhowch eich enw cyntaf fel y mae'n ymddangos ar eich trwydded yrru + And I see the Firstname error in the error field as Rhowch eich enw cyntaf fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidFirstName| + |DrivingLicenceSubjectHappyBilly|SELINA987 | + |DrivingLicenceSubjectHappyBilly|SELINA%$@ | + |DrivingLicenceSubjectHappyBilly| | + +####### InvalidMiddleNamesWithNumbers, InvalidMiddleNamesWithSpecialCharacters ##### + @mock-api:dva-invalidMiddleNames @language-regression + Scenario Outline: DVA Driving Licence Middle names with numbers or special characters error validation + Given User enters DVA data as a + And User re-enters middle names as + When User clicks on continue + Then I see the middlenames error summary as Rhowch unrhyw enwau canol fel y maent yn ymddangos ar eich trwydded yrru + And I see the middlenames error in the error field as Rhowch unrhyw enwau canol fel y maent yn ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidMiddleNames| + |DrivingLicenceSubjectHappyBilly|SELINA987 | + |DrivingLicenceSubjectHappyBilly|SELINA%$@ | + +##### DateOfBirthNotReal, DateOfBirthWithSpecialCharacters, NoDateOfBirth ##### Need confirmation with summary + @mock-api:dva-invalidDateOfBirth @language-regression + Scenario Outline: DVA Driving Licence Date of birth that are not real or with special characters or no date of birth error validation + Given User enters DVA data as a + And DVA user re-enters day of birth as + And DVA user re-enters month of birth as + And DVA user re-enters year of birth as + When User clicks on continue + Then DVA user can see the date of birth error summary as Rhowch eich dyddiad geni fel y mae'n ymddangos ar eich trwydded yrru + And DVA user can see the date of birth error in the field as Rhowch eich dyddiad geni fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidDayOfBirth|InvalidMonthOfBirth|InvalidYearOfBirth| + |DrivingLicenceSubjectHappyBilly| 51 | 71 | 198 | + |DrivingLicenceSubjectHappyBilly| @ | *& | 19 7 | + |DrivingLicenceSubjectHappyBilly| | | | + + @mock-api:dva-invalidDateOfBirth @language-regression + Scenario Outline: DVA Driving Licence Date of birth in the future error validation + Given User enters DVA data as a + And DVA user re-enters day of birth as + And DVA user re-enters month of birth as + And DVA user re-enters year of birth as + When User clicks on continue + Then DVA user can see the date of birth error summary as Rhaid i'ch dyddiad geni fod yn y gorffennol + And DVA user can see the date of birth error in the field as Rhaid i'ch dyddiad geni fod yn y gorffennol + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidDayOfBirth|InvalidMonthOfBirth|InvalidYearOfBirth| + |DrivingLicenceSubjectHappyBilly| 10 | 10 | 2042 | + +##### IssueDateWithAlphaCharacters, IssueDateWithSpecialCharacters, NoIssueDate ##### + @mock-api:dva-invalidIssueDate @language-regression + Scenario Outline: DVA Driving Licence Issue date that are not real or with special characters or no issue date error validation + Given User enters DVA data as a + And DVA user re-enters day of issue as + And DVA user re-enters month of issue as + And DVA user re-enters year of issue as + When User clicks on continue + Then I see DVA issue date error in summary as Rhowch y dyddiad fel y mae'n ymddangos ar eich trwydded yrru + And I see DVA invalid issue date field error as Rhowch y dyddiad fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidDayOfIssue|InvalidMonthOfIssue|InvalidYearOfIssue| + |DrivingLicenceSubjectHappyBilly| AA | BB | AABC | + |DrivingLicenceSubjectHappyBilly| & | ^% | £$ ^ | + |DrivingLicenceSubjectHappyBilly| | | | + + @mock-api:dva-invalidIssueDate @language-regression + Scenario Outline: DVA Driving Licence Issue date in the future error validation + Given User enters DVA data as a + And DVA user re-enters day of issue as + And DVA user re-enters month of issue as + And DVA user re-enters year of issue as + When User clicks on continue + Then I see DVA issue date error in summary as Rhaid i ddyddiad cyhoeddi fod yn y gorffennol + And I see DVA issue date error in summary as Rhaid i ddyddiad cyhoeddi fod yn y gorffennol + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidDayOfIssue|InvalidMonthOfIssue|InvalidYearOfIssue| + |DrivingLicenceSubjectHappyBilly| 01 | 10 | 2043 | + +##### InvalidValidToDate, ValidToDateWithSpecialCharacters, NoValidToDate ##### + @mock-api:dva-invalidExpiryDate @language-regression + Scenario Outline: DVA Driving Licence Valid to date that are not real or with special characters or no valid to date error validation + Given User enters DVA data as a + And User re-enters valid to day as + And User re-enters valid to month as + And User re-enters valid to year + When User clicks on continue + Then I can see the valid to date error in the error summary as Rhowch y dyddiad fel y mae'n ymddangos ar eich trwydded yrru + And I can see the Valid to date field error as Rhowch y dyddiad fel y mae'n ymddangos ar eich trwydded yrru + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidValidToDay|InvalidValidToMonth|InvalidValidToYear| + |DrivingLicenceSubjectHappyBilly| AA | BC | AABD | + |DrivingLicenceSubjectHappyBilly| !@ | £$ | %^ * | + |DrivingLicenceSubjectHappyBilly| | | | + + @mock-api:dva-invalidExpiryDate @language-regression + Scenario Outline: DVA Driving Licence Valid to date in the past error validation + Given User enters DVA data as a + And User re-enters valid to day as + And User re-enters valid to month as + And User re-enters valid to year + When User clicks on continue + Then I can see the valid to date error in the error summary as Ni allwch ddefnyddio trwydded yrru sydd wedi dod i ben + And I can see the Valid to date field error as Ni allwch ddefnyddio trwydded yrru sydd wedi dod i ben + And I check the page Title Gwall: Rhowch eich manylion yn union fel maent yn ymddangos ar eich trwydded yrru – Profi pwy ydych chi – GOV.UK + Examples: + |DVADrivingLicenceSubject |InvalidValidToDay|InvalidValidToMonth|InvalidValidToYear| + |DrivingLicenceSubjectHappyBilly| 10 | 01 | 2010 | diff --git a/test/browser/pages/DVADetailsEntryPage.js b/test/browser/pages/DVADetailsEntryPage.js index 675ab395..77a1686f 100644 --- a/test/browser/pages/DVADetailsEntryPage.js +++ b/test/browser/pages/DVADetailsEntryPage.js @@ -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( @@ -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 @@ -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) { @@ -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); } @@ -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 + ); + } }; diff --git a/test/browser/pages/DrivingLicencePage.js b/test/browser/pages/DrivingLicencePage.js index fb152ef7..7da33638 100644 --- a/test/browser/pages/DrivingLicencePage.js +++ b/test/browser/pages/DrivingLicencePage.js @@ -7,11 +7,13 @@ exports.DrivingLicencePage = 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="drivingLicenceNumber"]' + ); - 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.birthDay = this.page.locator('xpath=//*[@id="dateOfBirth-day"]'); this.birthMonth = this.page.locator('xpath=//*[@id="dateOfBirth-month"]'); @@ -35,12 +37,12 @@ exports.DrivingLicencePage = class PlaywrightDevPage { 'xpath=//*[@id="issueDate-year"]' ); - this.issueNumber = this.page.getByLabel(" Issue number "); + this.issueNumber = this.page.locator('xpath=//*[@id="issueNumber"]'); - this.postcode = this.page.getByLabel(" Postcode "); + this.postcode = this.page.locator('xpath=//*[@id="postcode"]'); - this.consentDVLACheckbox = this.page.getByLabel( - "Give DVLA your consent to check your driving licence details" + this.consentDVLACheckbox = this.page.locator( + 'xpath=//*[@id="consentCheckbox"]' ); // Error summary items @@ -130,10 +132,113 @@ exports.DrivingLicencePage = class PlaywrightDevPage { this.invalidConsentErrorFieldError = this.page.locator( 'xpath=//*[@id="consentCheckbox-error"]' ); + + this.Continue = this.page.locator('xpath=//*[@id="continue"]'); + + // Content Fields + + 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.lastNameLabel = this.page.locator('xpath=//*[@id="surname-label"]'); + + this.givenNameLegend = this.page.locator( + 'xpath=//*[@id="main-content"]/div/div/form/div[2]/fieldset/legend' + ); + + this.firstNameLabel = this.page.locator('xpath=//*[@id="firstName-label"]'); + + this.middleNames = this.page.locator('xpath=//*[@id="middleNames-label"]'); + + this.firstNameSentence = this.page.locator( + 'xpath=//*[@id="firstName-hint"]' + ); + this.middleNameSentence = this.page.locator( + 'xpath=//*[@id="middleNames-hint"]' + ); + + this.dobFieldTitleLegend = this.page.locator( + 'xpath=//*[@id="dateOfBirth-fieldset"]/legend' + ); + + this.dobExample = this.page.locator('xpath=//*[@id="dateOfBirth-hint"]'); + + this.dayLabel = this.page.locator( + 'xpath=//*[@id="dateOfBirth"]/div[1]/div/label' + ); + + this.monthLabel = this.page.locator( + 'xpath=//*[@id="dateOfBirth"]/div[2]/div/label' + ); + + this.yearLabel = this.page.locator( + 'xpath=//*[@id="dateOfBirth"]/div[3]/div/label' + ); + + this.issueFieldTitleLegend = this.page.locator( + 'xpath=//*[@id="issueDate-fieldset"]/legend' + ); + this.issueFieldHint = this.page.locator('xpath=//*[@id="issueDate-hint"]'); + + this.issueDayLabel = this.page.locator( + 'xpath=//*[@id="issueDate"]/div[1]/div/label' + ); + + this.issueMonthLabel = this.page.locator( + 'xpath=//*[@id="issueDate"]/div[2]/div/label' + ); + this.issueYearLabel = this.page.locator( + 'xpath=//*[@id="issueDate"]/div[3]/div/label' + ); + + this.validToFieldTitleLegend = this.page.locator( + 'xpath=//*[@id="expiryDate-fieldset"]/legend' + ); + + this.validToFieldHint = this.page.locator( + 'xpath=//*[@id="expiryDate-hint"]' + ); + + this.validTodayLabel = this.page.locator( + 'xpath=//*[@id="expiryDate"]/div[1]/div/label' + ); + + this.validToMonthLabel = this.page.locator( + 'xpath=//*[@id="expiryDate"]/div[2]/div/label' + ); + + this.validToYearLabel = this.page.locator( + 'xpath=//*[@id="expiryDate"]/div[3]/div/label' + ); + + this.licenceNumberLabel = this.page.locator( + 'xpath=//*[@id="drivingLicenceNumber-label"]' + ); + + this.licenceNumberHint = this.page.locator( + 'xpath=//*[@id="drivingLicenceNumber-hint"]' + ); + + this.issueNumberLabel = this.page.locator( + 'xpath=//*[@id="issueNumber-label"]' + ); + + this.issueNumberHint = this.page.locator( + 'xpath=//*[@id="issueNumber-hint"]' + ); + + this.postcodeLabel = this.page.locator('xpath=//*[@id="postcode-label"]'); + + this.postcodeHint = this.page.locator('xpath=//*[@id="postcode-hint"]'); } isCurrentPage() { - return this.page.url() === this.url; + return ( + this.page.url() === this.url || this.page.url() === this.url + "?lang=cy" + ); } async assertDVLAPageTitle(dvlaDetailsEntryPageTitle) { @@ -452,4 +557,203 @@ exports.DrivingLicencePage = class PlaywrightDevPage { fieldErrorText ); } + + // Language + async assertBetaBanner(betaBannerLabel) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.betaBanner.textContent()).to.contains( + betaBannerLabel + ); + } + + async assertBetaBannerText(assertBetaBannerText) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.betaBannerReads.textContent()).to.contains( + assertBetaBannerText + ); + } + + async assertLastName(dvlalastNameLabel) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.lastNameLabel.textContent()).to.contains( + dvlalastNameLabel + ); + } + + async assertGivenName(dvlagivenNameLegend) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.givenNameLegend.textContent()).to.contain( + dvlagivenNameLegend + ); + } + + async assertFirstName(dvlaFirstName) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.firstNameLabel.textContent()).to.contain(dvlaFirstName); + } + + async assertMiddleName(dvlaMiddleName) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.middleNames.textContent()).to.contain(dvlaMiddleName); + } + + async assertFirstNameSentence(dvlaFirstNameSent) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.firstNameSentence.innerText()).to.equal( + dvlaFirstNameSent + ); + } + + async assertMiddleNameSentence(dvlaMiddleNameSentence) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.middleNameSentence.innerText()).to.equal( + dvlaMiddleNameSentence + ); + } + + async assertDoBFieldTitle(dobFieldTitleLegend) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.dobFieldTitleLegend.innerText()).to.equal( + dobFieldTitleLegend + ); + } + + async assertDobExample(dobExample) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.dobExample.innerText()).to.equal(dobExample); + } + + async assertDay(day) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.dayLabel.innerText()).to.contains(day); + } + + async assertMonth(month) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.monthLabel.innerText()).to.contains(month); + } + + async assertYear(year) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + await expect(await this.yearLabel.innerText()).to.contains(year); + } + + async assertIssueDateFieldTitle(issueFieldTitleLegend) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueFieldTitleLegend.innerText()).to.equal( + issueFieldTitleLegend + ); + } + + async assertIssueDateExample(issueDateExample) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueFieldHint.innerText()).to.equal(issueDateExample); + } + + async assertValidDateFieldTitle(validDateFieldTitle) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToFieldTitleLegend.innerText()).to.equal( + validDateFieldTitle + ); + } + + async assertValidDateExample(validDateExample) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToFieldHint.innerText()).to.equal(validDateExample); + } + + async assertLicenceTitle(validlicenceNumberLabel) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.licenceNumberLabel.innerText()).to.equal( + validlicenceNumberLabel + ); + } + + async assertLicenceExample(validlicenceNumberHint) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.licenceNumberHint.innerText()).to.equal( + validlicenceNumberHint + ); + } + + async assertIssueNumberTitle(issueNumberLabel) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueNumberLabel.innerText()).to.equal(issueNumberLabel); + } + + async assertIssueSentenceExample(issueNumberSentence) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueNumberHint.innerText()).to.equal( + issueNumberSentence + ); + } + + async assertPostcodeTitle(postcodeTitle) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.postcodeLabel.innerText()).to.equal(postcodeTitle); + } + + async assertPostcodeSentence(postcodeSentence) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.postcodeHint.innerText()).to.equal(postcodeSentence); + } + + async assertIssueDay(issueDay) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueDayLabel.innerText()).to.contains(issueDay); + } + + async assertIssueMonth(issueMonth) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueMonthLabel.innerText()).to.contains(issueMonth); + } + + async assertIssueYear(issueYear) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.issueYearLabel.innerText()).to.contains(issueYear); + } + + async assertValidToDay(validToDay) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validTodayLabel.innerText()).to.contains(validToDay); + } + + async assertValidToMonth(validToMonth) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToMonthLabel.innerText()).to.contains(validToMonth); + } + + async assertValidToYear(validToYear) { + await this.page.waitForLoadState("domcontentloaded"); + expect(await this.isCurrentPage()).to.be.true; + expect(await this.validToYearLabel.innerText()).to.contains(validToYear); + } }; diff --git a/test/browser/pages/UniversalSteps.js b/test/browser/pages/UniversalSteps.js index 19aa793f..938fc184 100644 --- a/test/browser/pages/UniversalSteps.js +++ b/test/browser/pages/UniversalSteps.js @@ -1,7 +1,10 @@ const { assertTrue, fail } = require("assert"); -module.exports = class PlaywrightDevPage { - constructor() {} +exports.UniversalSteps = class PlaywrightDevPage { + constructor(page, url) { + this.page = page; + this.url = url; + } async waitForTextToAppear(text) { const header = await this.driver.getTitle(); @@ -25,6 +28,10 @@ module.exports = class PlaywrightDevPage { } async changeLanguageTo(language) { - this.driver.get(this.driver.currentUrl + "?lang=" + language); + var languageIsoCode = "eng"; + if (language === "Welsh") { + languageIsoCode = "cy"; + } + await this.page.goto(this.page.url() + "?lang=" + languageIsoCode); } }; diff --git a/test/browser/pages/index.js b/test/browser/pages/index.js index 053f739e..e2e3b584 100644 --- a/test/browser/pages/index.js +++ b/test/browser/pages/index.js @@ -1,5 +1,6 @@ module.exports = { LicenceIssuerPage: require("./licence-issuer.js"), + UniversalSteps: require("./UniversalSteps.js"), DrivingLicencePage: require("./DrivingLicencePage.js"), DVADetailsEntryPage: require("./DVADetailsEntryPage.js"), RelyingPartyPage: require("./relying-party.js"), diff --git a/test/browser/step_definitions/DrivingLicenceStepDefs.js b/test/browser/step_definitions/DrivingLicenceStepDefs.js index 4bc7902c..1b1d6125 100644 --- a/test/browser/step_definitions/DrivingLicenceStepDefs.js +++ b/test/browser/step_definitions/DrivingLicenceStepDefs.js @@ -13,7 +13,7 @@ Then( } ); -Then(/^User clicks on continue$/, async function () { +Then(/^User clicks on continue$/, { timeout: 2 * 5000 }, async function () { const drivingLicencePage = new DrivingLicencePage(this.page); await drivingLicencePage.clickOnContinue(); }); @@ -407,7 +407,7 @@ Then( Given( /^User enters DVA data as a (.*)$/, - { timeout: 2 * 5000 }, + { timeout: 3 * 5000 }, async function (dvaDrivingLicenceSubject) { const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); await dvaDetailsEntryPage.userEntersDVAData( @@ -424,6 +424,17 @@ Then(/^I check the page Title (.*)$/, async function (dvaErrorPageTitle) { // Re-enter DVA test data step-defs +Then( + /^DVA User re-enters drivingLicenceNumber as (.*)$/, + { timeout: 3 * 5000 }, + async function (InvalidLicenceNumber) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.dvaUserReEntersLicenceNumber( + InvalidLicenceNumber + ); + } +); + Then( /^DVA user re-enters day of birth as (.*)$/, { timeout: 2 * 5000 }, @@ -560,3 +571,296 @@ Then( await dvaDetailsEntryPage.assertConsentDVAErrorOnField(fieldErrorText); } ); + +//################### Text content comparisons ######################## + +Then( + /^I view the (.*) banner$/, + { timeout: 2 * 5000 }, + async function (betaBannerLabel) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertBetaBanner(betaBannerLabel); + } +); + +Then(/^the beta banner reads (.*)$/, async function (betaBannerText) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertBetaBannerText(betaBannerText); +}); + +Then(/^I can see the lastname as (.*)$/, async function (dvlaLastName) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertLastName(dvlaLastName); +}); + +Then(/^I can see the givenName as (.*)$/, async function (dvlaGivenName) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertGivenName(dvlaGivenName); +}); + +Then(/^I can see the firstName as (.*)$/, async function (dvlaFirstName) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertFirstName(dvlaFirstName); +}); + +Then(/^I can see the middleName as (.*)$/, async function (dvlaMiddleName) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertMiddleName(dvlaMiddleName); +}); + +Then( + /^I can see the first name sentence (.*)$/, + async function (dvlaFirstNameSent) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertFirstNameSentence(dvlaFirstNameSent); + } +); + +Then( + /^I can see the middle name sentence (.*)$/, + async function (dvlaMiddleNameSentence) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertMiddleNameSentence(dvlaMiddleNameSentence); + } +); + +Then(/^I can see the DoB fields titled (.*)$/, async function (dobFieldTitle) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertDoBFieldTitle(dobFieldTitle); +}); + +Then(/^I can see example as (.*)$/, async function (dobExample) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertDobExample(dobExample); +}); + +Then(/^I can see date as (.*)$/, async function (day) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertDay(day); +}); + +Then(/^I can see month as (.*)$/, async function (month) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertMonth(month); +}); + +Then(/^I can see year as (.*)$/, async function (year) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertYear(year); +}); + +Then( + /^I can see the Issue date field titled (.*)$/, + async function (issueFieldTitle) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertIssueDateFieldTitle(issueFieldTitle); + } +); + +Then( + /^I can see Issue date sentence as (.*)$/, + async function (issueDateExample) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertIssueDateExample(issueDateExample); + } +); + +Then(/^I can see issue day as (.*)$/, async function (issueDay) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertIssueDay(issueDay); +}); + +Then(/^I can see issue month as (.*)$/, async function (issueMonth) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertIssueMonth(issueMonth); +}); + +Then(/^I can see issue year as (.*)$/, async function (issueYear) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertIssueYear(issueYear); +}); + +Then( + /^I can see the Valid to date field titled (.*)$/, + async function (validDateFieldTitle) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertValidDateFieldTitle(validDateFieldTitle); + } +); + +Then( + /^I can see Valid to date sentence as (.*)$/, + async function (validDateExample) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertValidDateExample(validDateExample); + } +); + +Then(/^I can see Valid To day as (.*)$/, async function (validToDay) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertValidToDay(validToDay); +}); + +Then(/^I can see Valid To month as (.*)$/, async function (validToMonth) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertValidToMonth(validToMonth); +}); + +Then(/^I can see Valid To year as (.*)$/, async function (validToYear) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertValidToYear(validToYear); +}); + +Then( + /^I can see the licence number field titled (.*)$/, + async function (validLicenceTitle) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertLicenceTitle(validLicenceTitle); + } +); + +Then( + /^I see the Licence number sentence (.*)$/, + async function (validLicenceExample) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertLicenceExample(validLicenceExample); + } +); + +Then( + /^I can see the issue number field titled (.*)$/, + async function (issueNumberTitle) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertIssueNumberTitle(issueNumberTitle); + } +); + +Then( + /^I can see issue sentence as (.*)$/, + async function (issueNumberSentence) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertIssueSentenceExample(issueNumberSentence); + } +); + +Then( + /^I can see the postcode field titled (.*)$/, + async function (postcodeTitle) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertPostcodeTitle(postcodeTitle); + } +); + +Then( + /^I can see postcode sentence as (.*)$/, + async function (postcodeSentence) { + const drivingLicencePage = new DrivingLicencePage(this.page); + await drivingLicencePage.assertPostcodeSentence(postcodeSentence); + } +); + +//########### Text Content Comparisions - DVA ############## + +Then( + /^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 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.assertDVAPageTitle(dvaPageTitle); +}); + +Then( + /^I can see the DVA DoB fields titled (.*)$/, + async function (dobFieldTitle) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVADoBFieldTitle(dobFieldTitle); + } +); + +Then(/^I can see DVA DoB example DVA as (.*)$/, async function (dobExample) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVADobExample(dobExample); +}); + +Then(/^I can see DVA day as (.*)$/, async function (day) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVADay(day); +}); + +Then(/^I can see DVA month as (.*)$/, async function (month) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAMonth(month); +}); + +Then(/^I can see DVA year as (.*)$/, async function (year) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAYear(year); +}); + +Then( + /^I see the DVA Issue date field titled (.*)$/, + async function (issueFieldTitle) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAIssueDateFieldTitle(issueFieldTitle); + } +); + +Then( + /^I see DVA date section example as (.*)$/, + async function (issueDateExample) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAIssueDateExample(issueDateExample); + } +); + +Then(/^I can see DVA Issue day as (.*)$/, async function (issueDay) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAIssueDay(issueDay); +}); + +Then(/^I can see DVA issue month as (.*)$/, async function (issueMonth) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAIssueMonth(issueMonth); +}); + +Then(/^I can see DVA issue year as (.*)$/, async function (issueYear) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVAIssueYear(issueYear); +}); + +Then( + /^I can see DVA licence number field titled as (.*)$/, + async function (validLicenceTitle) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVALicenceTitle(validLicenceTitle); + } +); + +Then( + /^I see the DVA licence sentence as (.*)$/, + async function (validLicenceExample) { + const dvaDetailsEntryPage = new DVADetailsEntryPage(this.page); + await dvaDetailsEntryPage.assertDVALicenceExample(validLicenceExample); + } +); diff --git a/test/browser/step_definitions/UniversalStepDefs.js b/test/browser/step_definitions/UniversalStepDefs.js index f5f8b0f6..b59e071b 100644 --- a/test/browser/step_definitions/UniversalStepDefs.js +++ b/test/browser/step_definitions/UniversalStepDefs.js @@ -1,11 +1,11 @@ const { Given, When, Then } = require("@cucumber/cucumber"); const { UniversalSteps } = require("../pages/UniversalSteps"); -When( +Then( /^I add a cookie to change the language to (.*)$/, + { timeout: 2 * 5000 }, async function (language) { - const universalSteps = new UniversalSteps(); - - universalSteps.changeLanguageTo(language); + const universalSteps = new UniversalSteps(this.page, this.page.url()); + await universalSteps.changeLanguageTo(language); } );