Skip to content

Commit

Permalink
feat: asset asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
sr4850 committed Sep 2, 2024
1 parent 0937b08 commit bf0614c
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void deleteDocument() {
public void checkLicenceStatus(String arg0) {
waitForElementToBeClickable("menu-admin-dashboard/admin-your-account/details", SelectorType.ID);
waitForTextToBePresent("Licence status");
assertEquals(arg0.toUpperCase(), getElementValueByText("//strong[contains(@class,'govuk-tag')]", SelectorType.XPATH));
assertTrue(getElementValueByText("//strong[contains(@class,'govuk-tag')]", SelectorType.XPATH).equalsIgnoreCase("surrendered"));
}

public void closeCase() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void submitSurrender() throws IOException, InterruptedException, IllegalB
world.govSignInJourney.changeProtocolForSignInToWorkOnLocal();
checkSignInConfirmation();
refreshPageWithJavascript();
assertEquals(getText("//*[contains(@class,'govuk-tag govuk-tag')]", SelectorType.XPATH), "SURRENDER UNDER CONSIDERATION");
assertTrue(getElementValueByText("//*[contains(@class,'govuk-tag govuk-tag')]", SelectorType.XPATH).equalsIgnoreCase("SURRENDER UNDER CONSIDERATION"));
axeScanner.scan(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void theTextsOnTheSubmissionPageAreDisplayedCorrectly() {
assertEquals("What happens next", expectedHeading);
assertEquals("We will now post your paper permit within the next 3 working days.", expectedAdvisoryText1);
assertEquals("Your valid permits will be grouped together under the same licence number that you applied with.", expectedAdvisoryText2);
assertEquals("Warning" + "\n" + "Make sure your correspondence address is correct on all your operator licences and your email address is up-to-date on your account.", expectedWarningMessage);
assertEquals("Warning Make sure your correspondence address is correct on all your operator licences and your email address is up-to-date on your account.", expectedWarningMessage);
}

@Then("the view receipt of ECMT International hyperlink opens in a new window")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public void theRegistrationShouldBeMarkedAsExpired() throws InterruptedException
isElementDisplayed = isElementPresent("//*[contains(@class,'govuk-tag govuk-tag--grey')]", SelectorType.XPATH);
refreshPage();
} while (!isElementDisplayed && System.currentTimeMillis() < kickOut);
assertEquals(getText("//*[contains(@class,'govuk-tag govuk-tag--grey')]", SelectorType.XPATH), "EXPIRED");
String actualText = getText("//*[contains(@class,'govuk-tag govuk-tag--grey')]");
assertTrue(actualText.equalsIgnoreCase("Expired"));
}

// @When("i trigger the ebsr process queue")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ public void theValidFinancialStandingRateValuesShouldBePresent() throws HttpExce
@Then("i should be prompted to enter financial evidence information")
public void iShouldBePromptedToEnterFinancialEvidenceInformation() {
world.selfServeNavigation.navigateToPage("variation", SelfServeSection.VIEW);
assertTrue(isElementPresent("//span[contains(text(),'Financial evidence')]/../strong[contains(text(),'REQUIRES ATTENTION')]", SelectorType.XPATH));
String actualText = getText("//span[contains(text(),'Financial evidence')]/../strong", SelectorType.XPATH);
assertTrue(actualText.equalsIgnoreCase("Requires Attention"));
assertTrue(isLinkPresent("Financial evidence", 10));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.dvsa.testing.framework.stepdefs.vol;

import org.dvsa.testing.framework.Injectors.World;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.dvsa.testing.framework.Injectors.World;
import org.dvsa.testing.framework.pageObjects.BasePage;
import org.dvsa.testing.framework.pageObjects.enums.SelectorType;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class GoodVarIncreaseVehicle extends BasePage {
private final World world;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void theFeeShouldBePaid(String arg0) {
clickByLinkText("Fees");
selectValueFromDropDown("//*[@id='status']", SelectorType.XPATH,"All");
waitForTextToBePresent("Grant Fee for application");
assertEquals(getText("//table//tbody[tr//*[contains(text(),'Variation Fee for application')]]//strong[contains(@class,'govuk-tag govuk-tag--green')]",SelectorType.XPATH),"PAID");
assertTrue(getElementValueByText("//table//tbody[tr//*[contains(text(),'Variation Fee for application')]]//strong[contains(@class,'govuk-tag govuk-tag--green')]", SelectorType.XPATH).equalsIgnoreCase("PAID"));
}

@And("a selfserve user creates a variation and adds an operating centre")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ public void iUpgradeMyLicenceTypeToStandardNational() {
@Then("correct statuses are shown by the correct seven sections")
public void correctStatusesAreShownByTheCorrectSevenSections() {
String typeOfLicenceStatus = getText("//a[@id='overview-item__type_of_licence']//strong[1]", SelectorType.XPATH);
assertTrue(typeOfLicenceStatus.contains("UPDATED"));
assertTrue(typeOfLicenceStatus.equalsIgnoreCase("UPDATED"));
String addressesStatus = getText("//a[@id='overview-item__addresses']//strong[1]", SelectorType.XPATH);
assertTrue(addressesStatus.contains("REQUIRES ATTENTION"));
assertTrue(addressesStatus.equalsIgnoreCase("REQUIRES ATTENTION"));
String financialEvidenceStatus = getText("//a[@id='overview-item__financial_evidence']//strong[1]", SelectorType.XPATH);
assertTrue(financialEvidenceStatus.contains("REQUIRES ATTENTION"));
assertTrue(financialEvidenceStatus.equalsIgnoreCase("REQUIRES ATTENTION"));
String transportManagersStatus = getText("//a[@id='overview-item__transport_managers']//strong[1]", SelectorType.XPATH);
assertTrue(transportManagersStatus.contains("REQUIRES ATTENTION"));
assertTrue(transportManagersStatus.equalsIgnoreCase("REQUIRES ATTENTION"));
String financialHistoryStatus = getText("//a[@id='overview-item__financial_history']//strong[1]", SelectorType.XPATH);
assertTrue(financialHistoryStatus.contains("REQUIRES ATTENTION"));
assertTrue(financialHistoryStatus.equalsIgnoreCase("REQUIRES ATTENTION"));
String convictionsPenaltiesStatus = getText("//a[@id='overview-item__convictions_penalties']//strong[1]", SelectorType.XPATH);
assertTrue(convictionsPenaltiesStatus.contains("REQUIRES ATTENTION"));
assertTrue(convictionsPenaltiesStatus.equalsIgnoreCase("REQUIRES ATTENTION"));
String reviewDeclarationsStatus = getText("//div[@class='overview__item']//strong[1]", SelectorType.XPATH);
assertTrue(reviewDeclarationsStatus.contains("CAN'T START YET"));
assertTrue(reviewDeclarationsStatus.equalsIgnoreCase("CAN'T START YET"));
}

@And("i complete the required five sections")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public void thePostVerifySuccessPageIsDisplayed() {
waitAndClick("//*[contains(text(),'home')]", SelectorType.XPATH);
}

@And("the surrender status is {string}")
public void theSurrenderStatusIs(String status) {
@And("the surrender status is Surrender under consideration")
public void theSurrenderStatusIs() {
waitForTextToBePresent(world.applicationDetails.getLicenceNumber());
refreshPage();
assertEquals(getText("//*[contains(@class,'govuk-tag govuk-tag--green')]", SelectorType.XPATH), status.toUpperCase());
assertTrue(isElementPresent("//*[contains(@class,'govuk-tag govuk-tag--green')]", SelectorType.XPATH));
}

@And("the correct contact details should be displayed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public void continueWithApplicationLinkIsDisplayed() {
public void userIsTakenToInformationChangePageOnClickingContinueApplication() {
clickByLinkText("Continue with");
assertTrue(Browser.navigate().getCurrentUrl().contains("information-changed"));
String expectedChangedText = "Warning\n" +
"Since starting your application to surrender your licence, you have made changes to your licence information.";
String expectedChangedText = "Warning Since starting your application to surrender your licence, you have made changes to your licence information.";
String actualChangeText = getText("//*[@class='govuk-warning-text__text']", SelectorType.XPATH);
assertEquals(expectedChangedText, actualChangeText);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public void iChooseToSurrenderMyLicenceWith(String surrenderMethod) throws IOExc
}
waitForTitleToBePresent("Licences");
refreshPage();
assertEquals(getText("//*[@class='govuk-tag govuk-tag--green']", SelectorType.XPATH), "SURRENDER UNDER CONSIDERATION");
String actualText = getText("//*[@class='govuk-tag govuk-tag--green']", SelectorType.XPATH);
assertTrue(actualText.equalsIgnoreCase("Surrender Under Consideration"));
}

@Given("a caseworker views the surrender details")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void transportManagerDetailsApprovedBannerAppears() {
@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).equals(Text.toUpperCase()));
assertTrue(getText(String.format("//*[@class='govuk-tag govuk-tag--%s']", classString), SelectorType.XPATH).equalsIgnoreCase(Text));
}

@And("submit to operator button is displayed")
Expand Down

0 comments on commit bf0614c

Please sign in to comment.