Skip to content

Commit

Permalink
chore: test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sr4850 committed Sep 4, 2024
1 parent 738aa64 commit 0db0246
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ public void deleteDocument() {
public void checkLicenceStatus(String arg0) {
waitForElementToBeClickable("menu-admin-dashboard/admin-your-account/details", SelectorType.ID);
waitForTextToBePresent("Licence status");
String actualText = getText("//strong[contains(@class,'govuk-tag')]", SelectorType.XPATH);
assertTrue(actualText.equalsIgnoreCase("Surrendered"));
assertEquals(arg0, getElementValueByText("//strong[contains(@class,'govuk-tag')]", SelectorType.XPATH));
}

public void closeCase() {
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/org/dvsa/testing/framework/pageObjects/BasePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ protected static String getText(@NotNull String selector) {
return getText(selector, SelectorType.CSS);
}

protected static String getLink(@NotNull String selector, @NotNull SelectorType selectorType) {
return findElement(selector, selectorType).getAttribute("href");
}

protected static String getLink(@NotNull String selector) {
return getLink(selector, SelectorType.CSS);
}




public static String getTextFromNestedElement(WebElement webElement, String selector) {
return webElement.findElement(By.xpath(selector)).getText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void iGenerateALetter() {
@Then("The pop up should contain letter details")
public void thePopUpShouldContainLetterDetails() {
waitForTextToBePresent("Amend letter");
String docStoreLink = getText("letter-link",SelectorType.ID);
String docStoreLink = getLink("//*[@id='letter-link']",SelectorType.XPATH);
assertNotNull(docStoreLink);
String webDAVUrl = URL.build(ApplicationType.INTERNAL, world.configuration.env, "documents-dav").toString();
assertTrue(docStoreLink.contains(String.format("ms-word:ofe|u|%s",webDAVUrl)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public ManagePrinters(World world) {
}

@When("I am on the Printers page")
public void iAmOnThePrintersPage() throws HttpException {
public synchronized void iAmOnThePrintersPage() throws HttpException {
world.internalNavigation.logInAsAdmin();
world.internalNavigation.adminNavigation(AdminOption.PRINTING);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public TaskAllocationRules(World world) {
}

@Given("I am on the task allocation rules page")
public void iAmOnTheTaskAllocationRulesPage() throws HttpException {
public synchronized void iAmOnTheTaskAllocationRulesPage() throws HttpException {
world.internalNavigation.logInAsAdmin();
world.internalNavigation.adminNavigation(AdminOption.TASK_ALLOCATION_RULES);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Logic for Surrender menu item
Scenario: Surrender Licence
And my application to surrender is under consideration
When the caseworker approves the surrender
Then the licence status should be "surrendered"
Then the licence status should be "Surrendered"
And the surrender menu should be hidden in internal
And the licence should not displayed in selfserve

Expand Down Expand Up @@ -61,14 +61,14 @@ Feature: Logic for Surrender menu item
And the licence status is "<licence_status>"
And my application to surrender is under consideration
When the caseworker approves the surrender
And the licence status should be "surrendered"
And the licence status should be "Surrendered"
And the case worker undoes the surrender
Then the licence status should be "<licence>"

Examples:
| licence_status | licence |
| suspend | suspended |
| curtail | curtailed |
| suspend | Suspended |
| curtail | Curtailed |


Scenario Outline: Surrender suspended, curtailed licence
Expand Down

0 comments on commit 0db0246

Please sign in to comment.