Skip to content

Commit

Permalink
add url assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
ch3yne committed Mar 20, 2024
1 parent 192778a commit 15d2509
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public void testLinkToCatalogsPage() {
String name = "a_test_link";
createMetalakeAction(name);
metalakePage.clickMetalakeLink(name);
Assertions.assertTrue(metalakePage.verifyLinkToCatalogsPage());
Assertions.assertTrue(metalakePage.verifyLinkToCatalogsPage(name));
Assertions.assertEquals(driver.getCurrentUrl(), metalakePage.nameLink.getAttribute("href"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public class MetalakePage extends AbstractWebIT {
xpath = "//div[@data-refer='metalake-table-grid']//button[@aria-label='Go to previous page']")
public WebElement prevPageBtn;

@FindBy(xpath = "//*[@data-refer='metalake-name-link']")
public WebElement nameLink;

public MetalakePage() {
PageFactory.initElements(driver, this);
}
Expand Down Expand Up @@ -278,13 +281,19 @@ public boolean verifyQueryMetalake(String name) {
}
}

public boolean verifyLinkToCatalogsPage() {
public boolean verifyLinkToCatalogsPage(String name) {
try {
Thread.sleep(ACTION_SLEEP_MILLIS);
String xpath = "//*[@data-refer='metalake-name-link']";
WebElement nameLink = driver.findElement(By.xpath(xpath));
WebDriverWait wait = new WebDriverWait(driver, MAX_TIMEOUT);
wait.until(ExpectedConditions.elementToBeClickable(nameLink));
wait.until(ExpectedConditions.urlToBe(nameLink.getAttribute("href")));
Thread.sleep(ACTION_SLEEP_MILLIS);

if (!nameLink.getText().equals(name)) {
LOG.error("name link is not match");
return false;
}

return true;
} catch (Exception e) {
Expand Down

0 comments on commit 15d2509

Please sign in to comment.