From 87d5aae386e5ece4c7b086a1f2288cbcd8b4c68d Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Thu, 28 May 2026 11:06:20 +0100 Subject: [PATCH 1/8] fix: sign in --- .../framework/stepdefs/vol/CreateApplications.java | 13 ++++++++++++- .../stepdefs/vol/TmVerifyDifferentOperator.java | 8 +++++++- .../framework/stepdefs/vol/VerifySwitchedOff.java | 6 +++++- 3 files changed, 24 insertions(+), 3 deletions(-) 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..eb9010b04 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 @@ -44,7 +44,18 @@ 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 (isElementPresent("//*[@name='signatureDetails[submitAndPay]']", SelectorType.XPATH)) { waitAndClick("//*[@name='signatureDetails[submitAndPay]']", SelectorType.XPATH); } else if (isElementPresent("//*[@name='form-actions[submitAndPay]']", SelectorType.XPATH)) { 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..9b2dc3b94 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 @@ -171,8 +171,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..2360e2084 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 @@ -37,7 +37,11 @@ public void transportManagerStatusIs(String classString, String Text) { 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") From 9f6dc332c4269fdd37814a6289812db15e1542d2 Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Thu, 28 May 2026 12:05:58 +0100 Subject: [PATCH 2/8] fix: digial sign --- .../framework/Journeys/licence/ContinuationJourney.java | 6 ++++++ .../dvsa/testing/framework/stepdefs/vol/InterimLicence.java | 6 ++++++ 2 files changed, 12 insertions(+) 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/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(); From 39696340b6cb6651ff78345264867b5d030302fa Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Thu, 28 May 2026 12:21:52 +0100 Subject: [PATCH 3/8] Handle 'Confirm your details' page centrally in signInGovAccount Added handling for 'You have already proved your identity' and 'Confirm your details' pages at the end of signInGovAccount() so all callers benefit. Also added handling in operator countersigns steps in TmVerifyDifferentOperator. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../framework/Journeys/licence/GovSignInJourney.java | 8 ++++++++ .../framework/stepdefs/vol/TmVerifyDifferentOperator.java | 6 ++++++ 2 files changed, 14 insertions(+) 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..be61b1318 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 @@ -210,6 +210,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/TmVerifyDifferentOperator.java b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/TmVerifyDifferentOperator.java index 9b2dc3b94..d7bb53731 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 @@ -102,6 +102,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 +151,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(); From f39ea431767ae29733df5fde037e8656ad538449 Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Thu, 28 May 2026 15:37:53 +0100 Subject: [PATCH 4/8] Fix: handle 'Confirm your details' before early return in signInGovAccount The 'Confirm your details' page appears before 'Continue to the service' button check. Since that check triggers an early return when the button isn't found, the handling at the end was never reached. Moved the checks to before the early return point. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../framework/Journeys/licence/GovSignInJourney.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 be61b1318..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 { From e44cf4486b09658804f2ddda247d76c122242bfa Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Fri, 29 May 2026 10:41:44 +0100 Subject: [PATCH 5/8] fix: sign in --- .../stepdefs/vol/CreateApplications.java | 25 ++++++++++++++++++- .../stepdefs/vol/VerifySwitchedOff.java | 21 ++++++++++++---- .../Payments/ss-pay-for-application.feature | 6 ++--- .../Print-and-Sign/tm-verify-off.feature | 4 +-- 4 files changed, 45 insertions(+), 11 deletions(-) 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 eb9010b04..2b0c3b05b 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"))) { @@ -56,6 +56,25 @@ public void iChooseToPrintAndSign() { 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)) { @@ -78,6 +97,10 @@ public void theApplicationShouldBeSubmitted() { @When("i pay for my application") public void iPayForMyApplication() { + if (isTitlePresent("Confirm your details", 2)) { + clickById("submitButton"); + } + refreshPage(); UniversalActions.clickPay(); world.feeAndPaymentJourney.customerPaymentModule(); } 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 2360e2084..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,14 +23,25 @@ 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") @@ -70,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 From 170328d74a3e1a27806f6bda9d0d54cdc906e2ba Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Fri, 29 May 2026 10:42:28 +0100 Subject: [PATCH 6/8] fix: sign in --- .../dvsa/testing/framework/stepdefs/vol/CreateApplications.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2b0c3b05b..7045663e7 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 @@ -100,7 +100,7 @@ public void iPayForMyApplication() { if (isTitlePresent("Confirm your details", 2)) { clickById("submitButton"); } - refreshPage(); + UniversalActions.clickPay(); world.feeAndPaymentJourney.customerPaymentModule(); } From 7ba0ed49b9e9bfb6bd9487575439415e3e0032fd Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Fri, 29 May 2026 10:43:49 +0100 Subject: [PATCH 7/8] fix: sign in --- .../dvsa/testing/framework/stepdefs/vol/CreateApplications.java | 1 - 1 file changed, 1 deletion(-) 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 7045663e7..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 @@ -100,7 +100,6 @@ public void iPayForMyApplication() { if (isTitlePresent("Confirm your details", 2)) { clickById("submitButton"); } - UniversalActions.clickPay(); world.feeAndPaymentJourney.customerPaymentModule(); } From 700b50bc1b87a7be3986c70eb646b2c10952778d Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Fri, 29 May 2026 12:38:16 +0100 Subject: [PATCH 8/8] Remove duplicate 'i sign the declaration' step from TmVerifyDifferentOperator Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../framework/stepdefs/vol/TmVerifyDifferentOperator.java | 5 ----- 1 file changed, 5 deletions(-) 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 d7bb53731..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);