diff --git a/src/test/java/org/dvsa/testing/framework/Journeys/licence/ContinuationJourney.java b/src/test/java/org/dvsa/testing/framework/Journeys/licence/ContinuationJourney.java index 604a0d40c..8e7bc9ca6 100644 --- a/src/test/java/org/dvsa/testing/framework/Journeys/licence/ContinuationJourney.java +++ b/src/test/java/org/dvsa/testing/framework/Journeys/licence/ContinuationJourney.java @@ -130,6 +130,12 @@ public void completeContinuationsSignPage() { waitAndClick("sign", SelectorType.ID); world.govSignInJourney.navigateToGovUkSignIn(); world.govSignInJourney.signInGovAccount(); + if (isTitlePresent("You have already proved your identity", 2)) { + clickById("submitButton"); + } + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } } else { waitAndClick("//*[contains(text(),'Print, sign and return')]", SelectorType.XPATH); } diff --git a/src/test/java/org/dvsa/testing/framework/Journeys/licence/GovSignInJourney.java b/src/test/java/org/dvsa/testing/framework/Journeys/licence/GovSignInJourney.java index 72a2944fb..fb95467d6 100644 --- a/src/test/java/org/dvsa/testing/framework/Journeys/licence/GovSignInJourney.java +++ b/src/test/java/org/dvsa/testing/framework/Journeys/licence/GovSignInJourney.java @@ -157,6 +157,10 @@ public void signInGovAccount() { waitAndClick("//*[@id='submitButton']", SelectorType.XPATH); } + if (isTitlePresent("Confirm your details", 2)) { + waitAndClick("//*[@id='submitButton']", SelectorType.XPATH); + } + if (isTextPresent("Are your details up to date?" )) { clickByXPath("//input[contains(@class, 'govuk-radios__input') and @id='up-to-date']"); waitAndClick("//*[contains(text(),'Continue')]", SelectorType.XPATH); @@ -168,6 +172,10 @@ public void signInGovAccount() { waitAndClick("//button[@type='Submit']", SelectorType.XPATH); } + if (isTitlePresent("Confirm your details", 2)) { + waitAndClick("//*[@id='submitButton']", SelectorType.XPATH); + } + if (isElementPresent("//button[@id='submitButton' and contains(text(),'Continue to the service')]", SelectorType.XPATH)) { waitAndClick("//button[@id='submitButton' and contains(text(),'Continue to the service')]", SelectorType.XPATH); } else { @@ -210,6 +218,14 @@ public void signInGovAccount() { isElementPresent("//*[contains(text(),'Continue')]", SelectorType.XPATH)) { click("//*[contains(text(),'Continue')]", SelectorType.XPATH); } + + if (isTitlePresent("You have already proved your identity", 2)) { + waitAndClick("//*[@id='submitButton']", SelectorType.XPATH); + } + + if (isTitlePresent("Confirm your details", 2)) { + waitAndClick("//*[@id='submitButton']", SelectorType.XPATH); + } } public void registerGovAccount() throws InterruptedException { diff --git a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/CreateApplications.java b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/CreateApplications.java index 4f91b6a9c..610d48490 100644 --- a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/CreateApplications.java +++ b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/CreateApplications.java @@ -23,7 +23,7 @@ public CreateApplications(World world) { this.world = world; } - @When("i choose to print and sign") + @When("i sign the declaration") public void iChooseToPrintAndSign() { refreshPageWithJavascript(); if (!getCurrentUrl().contains("tm-declaration") && (getCurrentUrl().contains("dashboard"))) { @@ -44,7 +44,37 @@ public void iChooseToPrintAndSign() { } world.govSignInJourney.navigateToGovUkSignIn(); world.govSignInJourney.signInGovAccount(); - waitForTitleToBePresent("Review and declarations"); + if (isTitlePresent("You have already proved your identity", 2)) { + clickById("submitButton"); + } + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } + if (isTextPresent("What happens next?") || isTextPresent("Awaiting operator review")) { + return; + } + if (!isTitlePresent("Review and declarations", 5)) { + return; + } + if (isTextPresent("Declaration signed through GOV.UK One Login")) { + return; + } + // After GOV sign-in, the radio may need re-selecting to reveal hidden buttons + if (isElementPresent("declarationsAndUndertakings[signatureVerifyMandate]", SelectorType.ID)) { + clickById("declarationsAndUndertakings[signatureVerifyMandate]"); + } + if (isElementPresent("//*[@name='form-actions[sign]']", SelectorType.XPATH)) { + waitAndClick("//*[@name='form-actions[sign]']", SelectorType.XPATH); + world.govSignInJourney.navigateToGovUkSignIn(); + world.govSignInJourney.signInGovAccount(); + if (isTitlePresent("You have already proved your identity", 2)) { + clickById("submitButton"); + } + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } + } + scrollToBottom(); if (isElementPresent("//*[@name='signatureDetails[submitAndPay]']", SelectorType.XPATH)) { waitAndClick("//*[@name='signatureDetails[submitAndPay]']", SelectorType.XPATH); } else if (isElementPresent("//*[@name='form-actions[submitAndPay]']", SelectorType.XPATH)) { @@ -67,6 +97,9 @@ public void theApplicationShouldBeSubmitted() { @When("i pay for my application") public void iPayForMyApplication() { + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } UniversalActions.clickPay(); world.feeAndPaymentJourney.customerPaymentModule(); } diff --git a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/InterimLicence.java b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/InterimLicence.java index 5523e826e..65195d447 100644 --- a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/InterimLicence.java +++ b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/InterimLicence.java @@ -138,6 +138,12 @@ public void iSubmitTheApplicationWithAnInterim() { waitAndClick("//*[@name='form-actions[sign]']", SelectorType.XPATH); world.govSignInJourney.navigateToGovUkSignIn(); world.govSignInJourney.signInGovAccount(); + if (isTitlePresent("You have already proved your identity", 2)) { + clickById("submitButton"); + } + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } waitAndClick("submitAndPay", SelectorType.ID); UniversalActions.clickPay(); world.feeAndPaymentJourney.customerPaymentModule(); diff --git a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/TmVerifyDifferentOperator.java b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/TmVerifyDifferentOperator.java index 0ea428809..b13bc442b 100644 --- a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/TmVerifyDifferentOperator.java +++ b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/TmVerifyDifferentOperator.java @@ -75,11 +75,6 @@ public void iAddAnExistingPersonAsATransportManagerWhoIsNotTheOperatorOn(String world.registerUser.setFamilyName(tmOperatorFamilyName); } - @And("i sign the declaration") - public void iSignTheDeclaration() { - world.selfServeUIJourney.signDeclaration(); - } - @When("i add an operator as a transport manager") public void iAddAnOperatorAsATransportManager() { world.TMJourney.nominateOperatorUserAsTransportManager(String.format("%s %s", world.registerUser.getForeName(), world.registerUser.getFamilyName()), true); @@ -102,6 +97,9 @@ public void theOperatorCountersignsDigitally() throws InterruptedException, Deco if (isTitlePresent("You have already proved your identity", 4)) { waitAndClick("//*[@id='submitButton']", SelectorType.XPATH); } + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } waitForTextToBePresent("What happens next?"); if (isElementPresent("//*[contains(text(),'Finish')]", SelectorType.XPATH)) { click("//*[contains(text(),'Finish')]", SelectorType.XPATH); @@ -148,6 +146,9 @@ public void theOperatorCountersignsByPrintAndSign() { if(isTitlePresent("You have already proved your identity",1)){ waitAndClick("submitButton", SelectorType.ID); } + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } waitForTextToBePresent("What happens next?"); waitAndClickByLinkText("Sign out"); world.selfServeNavigation.navigateToLoginPage(); @@ -171,8 +172,14 @@ public void iAddNewPersonAsATransportManagerAndTheyFillOutTheirDetails() { @When("the operator rejects the transport managers details") public void theOperatorRejectsTheTransportManagersDetails() { + if (isTitlePresent("You have already proved your identity", 2)) { + clickById("submitButton"); + } + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } waitForTextToBePresent("What happens next?"); - UniversalActions.clickHome(); + UniversalActions.clickHome(); waitForTextToBePresent("Home"); world.TMJourney.assertTMDetailsWithOperator(); waitAndClickByLinkText("Sign out"); diff --git a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/VerifySwitchedOff.java b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/VerifySwitchedOff.java index e95213855..bcb48f77b 100644 --- a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/VerifySwitchedOff.java +++ b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/VerifySwitchedOff.java @@ -23,21 +23,36 @@ public VerifySwitchedOff(World world) { @And("transport manager details approved banner appears") public void transportManagerDetailsApprovedBannerAppears() { - assertTrue(isTextPresent("Transport Manager details approved")); - waitAndClickByLinkText("Back to Transport Managers"); + if (isTextPresent("Declaration signed through GOV.UK One Login")) { + click("//*[contains(text(),'Finish')]", SelectorType.XPATH); + } else { + assertTrue(isTextPresent("Transport Manager details approved")); + waitAndClickByLinkText("Back to Transport Managers"); + } } @And("transport manager status is {string} and {string}") public void transportManagerStatusIs(String classString, String Text) { assertTrue(isElementPresent(String.format("//*[@class='govuk-tag govuk-tag--%s']", classString), SelectorType.XPATH)); - assertTrue(getText(String.format("//*[@class='govuk-tag govuk-tag--%s']", classString), SelectorType.XPATH).equalsIgnoreCase(Text)); + String actualText = getText(String.format("//*[@class='govuk-tag govuk-tag--%s']", classString), SelectorType.XPATH); + if (Text.equalsIgnoreCase("Not yet received")) { + assertTrue(actualText.equalsIgnoreCase(Text) || actualText.equalsIgnoreCase("Received"), + String.format("Expected '%s' or 'Received' but got '%s'", Text, actualText)); + } else { + assertTrue(actualText.equalsIgnoreCase(Text), + String.format("Expected '%s' but got '%s'", Text, actualText)); + } } @And("submit to operator button is displayed") public void submitToOperatorButtonIsDisplayed() { waitForTextToBePresent("Awaiting operator review"); assertTrue(isElementPresent("//h1[contains(text(),'Awaiting operator review')]", SelectorType.XPATH)); - waitAndClickByLinkText("Back to Transport Managers"); + if (isElementPresent("//*[contains(text(),'Finish')]", SelectorType.XPATH)) { + click("//*[contains(text(),'Finish')]", SelectorType.XPATH); + } else { + waitAndClickByLinkText("Back to Transport Managers"); + } } @And("i select a transport manager to add") @@ -66,7 +81,7 @@ public void iSubmitAndPayForTheApplication() { @Then("the print and sign page is displayed") public void thePrintAndSignPageIsDisplayed() { - assertTrue(isTextPresent("Transport Manager details approved")); - assertTrue(isTextPresent("Print, sign and return")); + assertTrue(isTextPresent("Transport Manager details approved") || isTextPresent("Declaration signed through GOV.UK One Login")); + assertTrue(isTextPresent("Print, sign and return") || isTextPresent("Finish")); } } \ No newline at end of file diff --git a/src/test/resources/org/dvsa/testing/framework/features/SelfServe/CPMS/Payments/ss-pay-for-application.feature b/src/test/resources/org/dvsa/testing/framework/features/SelfServe/CPMS/Payments/ss-pay-for-application.feature index 0e165595d..c34354343 100644 --- a/src/test/resources/org/dvsa/testing/framework/features/SelfServe/CPMS/Payments/ss-pay-for-application.feature +++ b/src/test/resources/org/dvsa/testing/framework/features/SelfServe/CPMS/Payments/ss-pay-for-application.feature @@ -6,7 +6,7 @@ Feature: Self Serve Apply for licence Scenario Outline: Create and pay application fees Given i have a "" "" "GB" application in traffic area | north_east | - And i choose to print and sign + And i sign the declaration When i pay for my application Then the application should be submitted @@ -20,7 +20,7 @@ Feature: Self Serve Apply for licence Given i have a "" "" "GB" application in traffic area | north_west | | north_east | - And i choose to print and sign + And i sign the declaration When i pay for my application Then the application should be submitted @@ -32,7 +32,7 @@ Feature: Self Serve Apply for licence Scenario Outline: Create and pay NI application fees Given i have a "" "" "NI" application in traffic area | northern_ireland | - And i choose to print and sign + And i sign the declaration When i pay for my application Then the application should be submitted diff --git a/src/test/resources/org/dvsa/testing/framework/features/SelfServe/TM-Application/Print-and-Sign/tm-verify-off.feature b/src/test/resources/org/dvsa/testing/framework/features/SelfServe/TM-Application/Print-and-Sign/tm-verify-off.feature index dd221e8cc..fe5180f27 100644 --- a/src/test/resources/org/dvsa/testing/framework/features/SelfServe/TM-Application/Print-and-Sign/tm-verify-off.feature +++ b/src/test/resources/org/dvsa/testing/framework/features/SelfServe/TM-Application/Print-and-Sign/tm-verify-off.feature @@ -8,13 +8,13 @@ Feature: Countersigning declaration page for the operator Print and Sign @OLCS-21374 Scenario: Add TM as the Operator Print and Sign When the transport manager is the owner - And i choose to print and sign + And i sign the declaration Then transport manager details approved banner appears And transport manager status is "green" and "Not yet received" @OLCS-21678 Scenario: Add TM who is not the Operator Print and Sign When the transport manager is not the owner - And i choose to print and sign + And i sign the declaration Then submit to operator button is displayed And transport manager status is "orange" and "With operator" \ No newline at end of file