fix locators, fix flaky tests with ElementClickInterceptedException
This commit is contained in:
parent
3f28eca3b8
commit
e99024d7eb
@ -18,7 +18,6 @@ package org.thingsboard.server.msa.ui.base;
|
|||||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||||
import io.qameta.allure.Allure;
|
import io.qameta.allure.Allure;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.Dimension;
|
import org.openqa.selenium.Dimension;
|
||||||
import org.openqa.selenium.JavascriptExecutor;
|
import org.openqa.selenium.JavascriptExecutor;
|
||||||
import org.openqa.selenium.OutputType;
|
import org.openqa.selenium.OutputType;
|
||||||
@ -48,7 +47,6 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.thingsboard.server.msa.TestProperties.getBaseUiUrl;
|
import static org.thingsboard.server.msa.TestProperties.getBaseUiUrl;
|
||||||
@ -87,7 +85,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void open() {
|
public void open() {
|
||||||
openHomePage();
|
openLocalhost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterMethod
|
@AfterMethod
|
||||||
@ -101,12 +99,13 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
driver.quit();
|
driver.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openLocalhost() {
|
public String getJwtTokenFromLocalStorage() {
|
||||||
driver.get(getBaseUiUrl());
|
js = (JavascriptExecutor) driver;
|
||||||
|
return (String) js.executeScript("return window.localStorage.getItem('jwt_token');");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openHomePage() {
|
public void openLocalhost() {
|
||||||
driver.get(getBaseUiUrl() + "/home");
|
driver.get(getBaseUiUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
|
|||||||
@ -114,9 +114,7 @@ public class CustomerPageHelper extends CustomerPageElements {
|
|||||||
|
|
||||||
public void chooseDashboard() {
|
public void chooseDashboard() {
|
||||||
editMenuDashboardField().click();
|
editMenuDashboardField().click();
|
||||||
sleep(0.5);
|
|
||||||
editMenuDashboard().click();
|
editMenuDashboard().click();
|
||||||
sleep(0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createCustomersUser() {
|
public void createCustomersUser() {
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class RuleChainsPageElements extends OtherPageElementsHelper {
|
|||||||
private static final String DELETE_RULE_CHAIN_FROM_VIEW_BTN = "//span[contains(text(),' Delete')]";
|
private static final String DELETE_RULE_CHAIN_FROM_VIEW_BTN = "//span[contains(text(),' Delete')]";
|
||||||
private static final String IMPORT_RULE_CHAIN_BTN = "//span[contains(text(),'Import rule chain')]";
|
private static final String IMPORT_RULE_CHAIN_BTN = "//span[contains(text(),'Import rule chain')]";
|
||||||
private static final String OPEN_RULE_CHAIN_FROM_VIEW = "//span[contains(text(),'Open rule chain')]";
|
private static final String OPEN_RULE_CHAIN_FROM_VIEW = "//span[contains(text(),'Open rule chain')]";
|
||||||
private static final String MAKE_ROOT_FROM_VIEW = "(//span[contains(text(),' Make rule chain root ')]/..)[1]";
|
private static final String MAKE_ROOT_FROM_VIEW = "//span[contains(text(),' Make rule chain root ')]/parent::button";
|
||||||
private static final String ROOT_ACTIVE_CHECKBOXES = "//mat-icon[text() = 'check_box']";
|
private static final String ROOT_ACTIVE_CHECKBOXES = "//mat-icon[text() = 'check_box']";
|
||||||
private static final String ALL_NAMES = "//mat-icon[contains(text(),'check')]/../../../mat-cell[contains(@class,'name')]/span";
|
private static final String ALL_NAMES = "//mat-icon[contains(text(),'check')]/../../../mat-cell[contains(@class,'name')]/span";
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
|||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void reLogin() {
|
public void reLogin() {
|
||||||
if (getUrl().contains("/login")) {
|
if (getJwtTokenFromLocalStorage() == null) {
|
||||||
loginPage.authorizationTenant();
|
loginPage.authorizationTenant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,7 @@ public class ManageCustomersDevicesTest extends AbstractDriverBaseTest {
|
|||||||
sideBarMenuView.customerBtn().click();
|
sideBarMenuView.customerBtn().click();
|
||||||
customerPage.setCustomerName();
|
customerPage.setCustomerName();
|
||||||
customerPage.entity(customerPage.getCustomerName()).click();
|
customerPage.entity(customerPage.getCustomerName()).click();
|
||||||
customerPage.manageCustomersDeviceBtnView().click();
|
jsClick(customerPage.manageCustomersDeviceBtnView());
|
||||||
|
|
||||||
Assert.assertTrue(urlContains(manage.toLowerCase()));
|
Assert.assertTrue(urlContains(manage.toLowerCase()));
|
||||||
Assert.assertNotNull(customerPage.customerDevicesIconHeader());
|
Assert.assertNotNull(customerPage.customerDevicesIconHeader());
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class ManageCustomersEdgesTest extends AbstractDriverBaseTest {
|
|||||||
sideBarMenuView.customerBtn().click();
|
sideBarMenuView.customerBtn().click();
|
||||||
customerPage.setCustomerName();
|
customerPage.setCustomerName();
|
||||||
customerPage.entity(customerPage.getCustomerName()).click();
|
customerPage.entity(customerPage.getCustomerName()).click();
|
||||||
customerPage.manageCustomersEdgeBtnView().click();
|
jsClick(customerPage.manageCustomersEdgeBtnView());
|
||||||
|
|
||||||
Assert.assertTrue(urlContains("edgeInstances"));
|
Assert.assertTrue(urlContains("edgeInstances"));
|
||||||
Assert.assertNotNull(customerPage.customerEdgeIconHeader());
|
Assert.assertNotNull(customerPage.customerEdgeIconHeader());
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class ManageCustomersUsersTest extends AbstractDriverBaseTest {
|
|||||||
sideBarMenuView.customerBtn().click();
|
sideBarMenuView.customerBtn().click();
|
||||||
customerPage.setCustomerName();
|
customerPage.setCustomerName();
|
||||||
customerPage.entity(customerPage.getCustomerName()).click();
|
customerPage.entity(customerPage.getCustomerName()).click();
|
||||||
customerPage.manageCustomersUserBtnView().click();
|
jsClick(customerPage.manageCustomersUserBtnView());
|
||||||
|
|
||||||
Assert.assertTrue(urlContains("user"));
|
Assert.assertTrue(urlContains("user"));
|
||||||
Assert.assertNotNull(customerPage.customerUserIconHeader());
|
Assert.assertNotNull(customerPage.customerUserIconHeader());
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class MakeRuleChainRootTest extends AbstractDriverBaseTest {
|
|||||||
ruleChainsPage.setRuleChainNameWithoutRoot(0);
|
ruleChainsPage.setRuleChainNameWithoutRoot(0);
|
||||||
String ruleChain = ruleChainsPage.getRuleChainName();
|
String ruleChain = ruleChainsPage.getRuleChainName();
|
||||||
ruleChainsPage.detailsBtn(ruleChain).click();
|
ruleChainsPage.detailsBtn(ruleChain).click();
|
||||||
ruleChainsPage.makeRootFromViewBtn().click();
|
jsClick(ruleChainsPage.makeRootFromViewBtn());
|
||||||
ruleChainsPage.warningPopUpYesBtn().click();
|
ruleChainsPage.warningPopUpYesBtn().click();
|
||||||
ruleChainsPage.closeEntityViewBtn().click();
|
ruleChainsPage.closeEntityViewBtn().click();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user