small refactoring
This commit is contained in:
parent
3d8059be9e
commit
c7ac12115c
@ -113,18 +113,33 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RuleChain getRuleChainByName(String name) {
|
public static RuleChain getRuleChainByName(String name) {
|
||||||
|
try {
|
||||||
return testRestClient.getRuleChains(pageLink).getData().stream()
|
return testRestClient.getRuleChains(pageLink).getData().stream()
|
||||||
.filter(s -> s.getName().equals(name)).collect(Collectors.toList()).get(0);
|
.filter(s -> s.getName().equals(name)).collect(Collectors.toList()).get(0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("No such rule chain with name: " + name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Customer getCustomerByName(String name) {
|
public static Customer getCustomerByName(String name) {
|
||||||
|
try {
|
||||||
return testRestClient.getCustomers(pageLink).getData().stream()
|
return testRestClient.getCustomers(pageLink).getData().stream()
|
||||||
.filter(x -> x.getName().equals(name)).collect(Collectors.toList()).get(0);
|
.filter(x -> x.getName().equals(name)).collect(Collectors.toList()).get(0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("No such customer with name: " + name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DeviceProfile getDeviceProfileByName(String name) {
|
public static DeviceProfile getDeviceProfileByName(String name) {
|
||||||
|
try {
|
||||||
return testRestClient.getDeviceProfiles(pageLink).getData().stream()
|
return testRestClient.getDeviceProfiles(pageLink).getData().stream()
|
||||||
.filter(x -> x.getName().equals(name)).collect(Collectors.toList()).get(0);
|
.filter(x -> x.getName().equals(name)).collect(Collectors.toList()).get(0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("No such device profile with name: " + name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.msa.ui.pages;
|
package org.thingsboard.server.msa.ui.pages;
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
|
|
||||||
@ -35,7 +34,6 @@ public class RuleChainsPageElements extends OtherPageElementsHelper {
|
|||||||
private static final String RULE_CHAINS_NAMES_WITHOUT_ROOT = "//mat-icon[contains(text(),'check_box_outline_blank')]/../../../mat-cell[contains(@class,'name')]/span";
|
private static final String RULE_CHAINS_NAMES_WITHOUT_ROOT = "//mat-icon[contains(text(),'check_box_outline_blank')]/../../../mat-cell[contains(@class,'name')]/span";
|
||||||
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 = ENTITY + "/../..//mat-icon[contains(text(),' settings_ethernet')]";
|
|
||||||
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 ')]/..)[1]";
|
||||||
private static final String ROOT_ACTIVE_CHECKBOXES = "//mat-icon[text() = 'check_box']";
|
private static final String ROOT_ACTIVE_CHECKBOXES = "//mat-icon[text() = 'check_box']";
|
||||||
@ -85,10 +83,6 @@ public class RuleChainsPageElements extends OtherPageElementsHelper {
|
|||||||
return waitUntilElementToBeClickable(OPEN_RULE_CHAIN_FROM_VIEW);
|
return waitUntilElementToBeClickable(OPEN_RULE_CHAIN_FROM_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebElement openRuleChainBtn(String name) {
|
|
||||||
return waitUntilElementToBeClickable(String.format(OPEN_RULE_CHAIN, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<WebElement> entities(String name) {
|
public List<WebElement> entities(String name) {
|
||||||
return waitUntilVisibilityOfElementsLocated(String.format(ENTITY, name));
|
return waitUntilVisibilityOfElementsLocated(String.format(ENTITY, name));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,10 +101,6 @@ public class RuleChainsPageHelper extends RuleChainsPageElements {
|
|||||||
return elementsIsNotPresent(getEntity(ruleChainName));
|
return elementsIsNotPresent(getEntity(ruleChainName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doubleClickOnRuleChain(String ruleChainName) {
|
|
||||||
doubleClick(entity(ruleChainName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sortByNameDown() {
|
public void sortByNameDown() {
|
||||||
doubleClick(sortByNameBtn());
|
doubleClick(sortByNameBtn());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,6 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
|||||||
private DashboardPageHelper dashboardPage;
|
private DashboardPageHelper dashboardPage;
|
||||||
private String customerName;
|
private String customerName;
|
||||||
|
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void login() {
|
public void login() {
|
||||||
openLocalhost();
|
openLocalhost();
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||||
|
|
||||||
import io.qameta.allure.Description;
|
import io.qameta.allure.Description;
|
||||||
import org.openqa.selenium.JavascriptExecutor;
|
|
||||||
import org.openqa.selenium.Keys;
|
import org.openqa.selenium.Keys;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.AfterMethod;
|
import org.testng.annotations.AfterMethod;
|
||||||
|
|||||||
@ -24,7 +24,9 @@ import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
|
|||||||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper;
|
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper;
|
||||||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper;
|
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper;
|
||||||
|
|
||||||
import static org.thingsboard.server.msa.ui.utils.Const.*;
|
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
|
||||||
|
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_EMAIL;
|
||||||
|
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_PASSWORD;
|
||||||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile;
|
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile;
|
||||||
|
|
||||||
public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
|
public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import org.thingsboard.server.msa.ui.utils.DataProviderCredential;
|
|||||||
|
|
||||||
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_EMAIL;
|
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_EMAIL;
|
||||||
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_PASSWORD;
|
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_PASSWORD;
|
||||||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultCustomerPrototype;
|
|
||||||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile;
|
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile;
|
||||||
|
|
||||||
public class SortByNameTest extends AbstractDriverBaseTest {
|
public class SortByNameTest extends AbstractDriverBaseTest {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user