refactoring
This commit is contained in:
parent
c51d75a2cc
commit
2eecf7f066
@ -48,6 +48,7 @@ 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.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
@ -64,9 +65,12 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
private static final int WIDTH = 1680;
|
private static final int WIDTH = 1680;
|
||||||
private static final int HEIGHT = 1050;
|
private static final int HEIGHT = 1050;
|
||||||
private static final String REMOTE_WEBDRIVER_HOST = "http://localhost:4444";
|
private static final String REMOTE_WEBDRIVER_HOST = "http://localhost:4444";
|
||||||
protected static final PageLink pageLink = new PageLink(10);
|
protected final PageLink pageLink = new PageLink(10);
|
||||||
private static final ContainerTestSuite instance = ContainerTestSuite.getInstance();
|
private final ContainerTestSuite instance = ContainerTestSuite.getInstance();
|
||||||
private JavascriptExecutor js;
|
private JavascriptExecutor js;
|
||||||
|
public static final long WAIT_TIMEOUT = TimeUnit.SECONDS.toMillis(10);
|
||||||
|
private final Duration duration = Duration.ofMillis(WAIT_TIMEOUT);
|
||||||
|
private WebStorage webStorage;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void startUp() throws MalformedURLException {
|
public void startUp() throws MalformedURLException {
|
||||||
@ -104,8 +108,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getJwtTokenFromLocalStorage() {
|
public String getJwtTokenFromLocalStorage() {
|
||||||
js = (JavascriptExecutor) driver;
|
return (String) getJs().executeScript("return window.localStorage.getItem('jwt_token');");
|
||||||
return (String) js.executeScript("return window.localStorage.getItem('jwt_token');");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openBaseUiUrl() {
|
public void openBaseUiUrl() {
|
||||||
@ -121,7 +124,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean urlContains(String urlPath) {
|
protected boolean urlContains(String urlPath) {
|
||||||
WebDriverWait wait = new WebDriverWait(driver, Duration.ofMillis(5000));
|
WebDriverWait wait = new WebDriverWait(driver, duration);
|
||||||
try {
|
try {
|
||||||
wait.until(ExpectedConditions.urlContains(urlPath));
|
wait.until(ExpectedConditions.urlContains(urlPath));
|
||||||
} catch (WebDriverException e) {
|
} catch (WebDriverException e) {
|
||||||
@ -131,11 +134,10 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void jsClick(WebElement element) {
|
public void jsClick(WebElement element) {
|
||||||
js = (JavascriptExecutor) driver;
|
getJs().executeScript("arguments[0].click();", element);
|
||||||
js.executeScript("arguments[0].click();", element);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RuleChain getRuleChainByName(String name) {
|
public RuleChain getRuleChainByName(String name) {
|
||||||
try {
|
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);
|
||||||
@ -145,7 +147,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Customer getCustomerByName(String name) {
|
public Customer getCustomerByName(String name) {
|
||||||
try {
|
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);
|
||||||
@ -155,7 +157,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DeviceProfile getDeviceProfileByName(String name) {
|
public DeviceProfile getDeviceProfileByName(String name) {
|
||||||
try {
|
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);
|
||||||
@ -165,7 +167,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AssetProfile getAssetProfileByName(String name) {
|
public AssetProfile getAssetProfileByName(String name) {
|
||||||
try {
|
try {
|
||||||
return testRestClient.getAssetProfiles(pageLink).getData().stream()
|
return testRestClient.getAssetProfiles(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);
|
||||||
@ -182,14 +184,6 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebStorage getWebStorage() {
|
|
||||||
if (driver instanceof WebStorage) {
|
|
||||||
return (WebStorage) driver;
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("This test expects the driver to implement WebStorage");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearStorage() {
|
public void clearStorage() {
|
||||||
getWebStorage().getLocalStorage().clear();
|
getWebStorage().getLocalStorage().clear();
|
||||||
getWebStorage().getSessionStorage().clear();
|
getWebStorage().getSessionStorage().clear();
|
||||||
@ -198,4 +192,12 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
public void assertIsDisplayed(WebElement element) {
|
public void assertIsDisplayed(WebElement element) {
|
||||||
assertThat(element.isDisplayed()).as(element + " is displayed").isTrue();
|
assertThat(element.isDisplayed()).as(element + " is displayed").isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JavascriptExecutor getJs() {
|
||||||
|
return js = (JavascriptExecutor) driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebStorage getWebStorage() {
|
||||||
|
return webStorage = (WebStorage) driver;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,8 +20,8 @@ import org.openqa.selenium.WebElement;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AlarmElements extends OtherPageElements{
|
public class AlarmDetailsEntityTabElements extends OtherPageElements {
|
||||||
public AlarmElements(WebDriver driver) {
|
public AlarmDetailsEntityTabElements(WebDriver driver) {
|
||||||
super(driver);
|
super(driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +34,7 @@ public class AlarmElements extends OtherPageElements{
|
|||||||
private static final String UNASSIGNED = "//span[text() = '%s']/ancestor::mat-row//span[@class='assignee-cell']/mat-icon[text() = 'account_circle']/following-sibling::span";
|
private static final String UNASSIGNED = "//span[text() = '%s']/ancestor::mat-row//span[@class='assignee-cell']/mat-icon[text() = 'account_circle']/following-sibling::span";
|
||||||
private static final String ALARM_DETAILS_BTN = "//span[text() = '%s']/ancestor::mat-row//mat-icon[contains(text(),'more_horiz')]/parent::button";
|
private static final String ALARM_DETAILS_BTN = "//span[text() = '%s']/ancestor::mat-row//mat-icon[contains(text(),'more_horiz')]/parent::button";
|
||||||
private static final String ACCESS_FORBIDDEN_DIALOG_VIEW = "//h2[text() = 'Access Forbidden']/parent::tb-confirm-dialog";
|
private static final String ACCESS_FORBIDDEN_DIALOG_VIEW = "//h2[text() = 'Access Forbidden']/parent::tb-confirm-dialog";
|
||||||
|
private static final String ALARM_ASSIGNEE_DROPDOWN = "//tb-alarm-assignee-panel";
|
||||||
|
|
||||||
public WebElement assignBtn(String type) {
|
public WebElement assignBtn(String type) {
|
||||||
return waitUntilElementToBeClickable(String.format(ASSIGN_BTN, type));
|
return waitUntilElementToBeClickable(String.format(ASSIGN_BTN, type));
|
||||||
@ -70,4 +71,8 @@ public class AlarmElements extends OtherPageElements{
|
|||||||
public WebElement accessForbiddenDialogView() {
|
public WebElement accessForbiddenDialogView() {
|
||||||
return waitUntilVisibilityOfElementLocated(ACCESS_FORBIDDEN_DIALOG_VIEW);
|
return waitUntilVisibilityOfElementLocated(ACCESS_FORBIDDEN_DIALOG_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WebElement alarmAssigneeDropdown() {
|
||||||
|
return waitUntilVisibilityOfElementLocated(ALARM_ASSIGNEE_DROPDOWN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -17,13 +17,12 @@ package org.thingsboard.server.msa.ui.pages;
|
|||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.thingsboard.server.msa.ui.utils.Const;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class AlarmHelper extends AlarmElements {
|
public class AlarmDetailsEntityTabHelper extends AlarmDetailsEntityTabElements {
|
||||||
public AlarmHelper(WebDriver driver) {
|
public AlarmDetailsEntityTabHelper(WebDriver driver) {
|
||||||
super(driver);
|
super(driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,12 +32,12 @@ public class AlarmHelper extends AlarmElements {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unassignedAlarm(String alarmType) {
|
public void unassignedAlarm(String alarmType) {
|
||||||
assignBtn(alarmType).click();
|
jsClick(assignBtn(alarmType));
|
||||||
unassignedBtn().click();
|
unassignedBtn().click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void searchAlarm(String alarmType, String emailOrName) {
|
public void searchAlarm(String alarmType, String emailOrName) {
|
||||||
assignBtn(alarmType).click();
|
jsClick(assignBtn(alarmType));
|
||||||
searchUserField().sendKeys(emailOrName);
|
searchUserField().sendKeys(emailOrName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,6 @@ public class AlarmDetailsViewElements extends AbstractBasePage {
|
|||||||
super(driver);
|
super(driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
//private static final String ASSIGN_FIELD = "//tb-alarm-assignee//mat-icon[contains(text(),'keyboard_arrow_down')]/parent::button";
|
|
||||||
private static final String ASSIGN_FIELD = "//mat-label[text()='Assignee']/parent::label/parent::div//input";
|
private static final String ASSIGN_FIELD = "//mat-label[text()='Assignee']/parent::label/parent::div//input";
|
||||||
private static final String USER_FROM_DROP_DOWN = "//div[@class='user-display-name']/span[text() = '%s']";
|
private static final String USER_FROM_DROP_DOWN = "//div[@class='user-display-name']/span[text() = '%s']";
|
||||||
private static final String CLOSE_ALARM_DETAILS_VIEW_BTN = "//mat-dialog-container//mat-icon[contains(text(),'close')]/parent::button";
|
private static final String CLOSE_ALARM_DETAILS_VIEW_BTN = "//mat-dialog-container//mat-icon[contains(text(),'close')]/parent::button";
|
||||||
|
|||||||
@ -17,7 +17,7 @@ package org.thingsboard.server.msa.ui.pages;
|
|||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
|
|
||||||
public class AlarmDetailsViewHelper extends AlarmDetailsViewElements{
|
public class AlarmDetailsViewHelper extends AlarmDetailsViewElements {
|
||||||
public AlarmDetailsViewHelper(WebDriver driver) {
|
public AlarmDetailsViewHelper(WebDriver driver) {
|
||||||
super(driver);
|
super(driver);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,27 +18,20 @@ package org.thingsboard.server.msa.ui.pages;
|
|||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
|
|
||||||
public class AssetPageElements extends OtherPageElements{
|
public class AssetPageElements extends OtherPageElements {
|
||||||
public AssetPageElements(WebDriver driver) {
|
public AssetPageElements(WebDriver driver) {
|
||||||
super(driver);
|
super(driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String CUSTOMER_DETAILS_VIEW = "//tb-details-panel";
|
private static final String ASSET_DETAILS_VIEW = "//tb-details-panel";
|
||||||
private static final String CUSTOMER_DETAILS_ALARMS = CUSTOMER_DETAILS_VIEW + "//span[text()='Alarms']";
|
private static final String ASSET_DETAILS_ALARMS = ASSET_DETAILS_VIEW + "//span[text()='Alarms']";
|
||||||
|
|
||||||
public WebElement customerDetailsView() {
|
public WebElement assetDetailsView() {
|
||||||
return waitUntilPresenceOfElementLocated(CUSTOMER_DETAILS_VIEW);
|
return waitUntilPresenceOfElementLocated(ASSET_DETAILS_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebElement customerDetailsAlarmsBtn() {
|
public WebElement assetDetailsAlarmsBtn() {
|
||||||
return waitUntilElementToBeClickable(CUSTOMER_DETAILS_ALARMS);
|
return waitUntilElementToBeClickable(ASSET_DETAILS_ALARMS);
|
||||||
}
|
|
||||||
|
|
||||||
public void openAssetAlarms(String assetName) {
|
|
||||||
if (!customerDetailsView().isDisplayed()) {
|
|
||||||
entity(assetName).click();
|
|
||||||
}
|
|
||||||
customerDetailsAlarmsBtn().click();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Copyright © 2016-2023 The Thingsboard Authors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.thingsboard.server.msa.ui.pages;
|
||||||
|
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
|
||||||
|
public class AssetPageHelper extends AssetPageElements {
|
||||||
|
public AssetPageHelper(WebDriver driver) {
|
||||||
|
super(driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openAssetAlarms(String assetName) {
|
||||||
|
if (!assetDetailsView().isDisplayed()) {
|
||||||
|
entity(assetName).click();
|
||||||
|
}
|
||||||
|
assetDetailsAlarmsBtn().click();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -18,7 +18,7 @@ package org.thingsboard.server.msa.ui.pages;
|
|||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
|
|
||||||
public class DevicePageElements extends OtherPageElements{
|
public class DevicePageElements extends OtherPageElements {
|
||||||
public DevicePageElements(WebDriver driver) {
|
public DevicePageElements(WebDriver driver) {
|
||||||
super(driver);
|
super(driver);
|
||||||
}
|
}
|
||||||
@ -32,6 +32,7 @@ public class DevicePageElements extends OtherPageElements{
|
|||||||
private static final String CUSTOMER_FROM_ASSIGN_DROPDOWN = "//div[@role = 'listbox']//span[text() = '%s']";
|
private static final String CUSTOMER_FROM_ASSIGN_DROPDOWN = "//div[@role = 'listbox']//span[text() = '%s']";
|
||||||
private static final String CLOSE_DEVICE_DETAILS_VIEW = "//header//mat-icon[contains(text(),'close')]/parent::button";
|
private static final String CLOSE_DEVICE_DETAILS_VIEW = "//header//mat-icon[contains(text(),'close')]/parent::button";
|
||||||
private static final String SUBMIT_ASSIGN_TO_CUSTOMER_BTN = "//button[@type='submit']";
|
private static final String SUBMIT_ASSIGN_TO_CUSTOMER_BTN = "//button[@type='submit']";
|
||||||
|
|
||||||
public WebElement device(String deviceName) {
|
public WebElement device(String deviceName) {
|
||||||
return waitUntilElementToBeClickable(String.format(DEVICE, deviceName));
|
return waitUntilElementToBeClickable(String.format(DEVICE, deviceName));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* Copyright © 2016-2023 The Thingsboard Authors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.thingsboard.server.msa.ui.pages;
|
||||||
|
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
import org.openqa.selenium.WebElement;
|
||||||
|
|
||||||
|
public class EntityViewPageElements extends OtherPageElementsHelper {
|
||||||
|
public EntityViewPageElements(WebDriver driver) {
|
||||||
|
super(driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String ENTITY_VIEW_DETAILS_VIEW = "//tb-details-panel";
|
||||||
|
private static final String ENTITY_VIEW_DETAILS_ALARMS = ENTITY_VIEW_DETAILS_VIEW + "//span[text()='Alarms']";
|
||||||
|
|
||||||
|
public WebElement entityViewDetailsView() {
|
||||||
|
return waitUntilPresenceOfElementLocated(ENTITY_VIEW_DETAILS_VIEW);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebElement entityViewDetailsAlarmsBtn() {
|
||||||
|
return waitUntilElementToBeClickable(ENTITY_VIEW_DETAILS_ALARMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -16,30 +16,17 @@
|
|||||||
package org.thingsboard.server.msa.ui.pages;
|
package org.thingsboard.server.msa.ui.pages;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
|
||||||
|
|
||||||
public class EntityViewPage extends OtherPageElementsHelper{
|
public class EntityViewPageHelper extends EntityViewPageElements {
|
||||||
public EntityViewPage(WebDriver driver) {
|
public EntityViewPageHelper(WebDriver driver) {
|
||||||
super(driver);
|
super(driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String CUSTOMER_DETAILS_VIEW = "//tb-details-panel";
|
|
||||||
private static final String CUSTOMER_DETAILS_ALARMS = CUSTOMER_DETAILS_VIEW + "//span[text()='Alarms']";
|
|
||||||
|
|
||||||
public WebElement customerDetailsView() {
|
|
||||||
return waitUntilPresenceOfElementLocated(CUSTOMER_DETAILS_VIEW);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WebElement customerDetailsAlarmsBtn() {
|
|
||||||
return waitUntilElementToBeClickable(CUSTOMER_DETAILS_ALARMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void openEntityViewAlarms(String customerName) {
|
public void openEntityViewAlarms(String customerName) {
|
||||||
if (!customerDetailsView().isDisplayed()) {
|
if (!entityViewDetailsView().isDisplayed()) {
|
||||||
entity(customerName).click();
|
entity(customerName).click();
|
||||||
}
|
}
|
||||||
customerDetailsAlarmsBtn().click();
|
entityViewDetailsAlarmsBtn().click();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -16,8 +16,6 @@
|
|||||||
package org.thingsboard.server.msa.ui.pages;
|
package org.thingsboard.server.msa.ui.pages;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.support.ui.ExpectedCondition;
|
|
||||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
||||||
import org.thingsboard.server.msa.ui.utils.Const;
|
import org.thingsboard.server.msa.ui.utils.Const;
|
||||||
|
|
||||||
public class LoginPageHelper extends LoginPageElements {
|
public class LoginPageHelper extends LoginPageElements {
|
||||||
@ -25,18 +23,10 @@ public class LoginPageHelper extends LoginPageElements {
|
|||||||
super(driver);
|
super(driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void login(String username, String password) {
|
public void authorizationTenant() {
|
||||||
emailField().sendKeys(username);
|
emailField().sendKeys(Const.TENANT_EMAIL);
|
||||||
passwordField().sendKeys(password);
|
passwordField().sendKeys(Const.TENANT_PASSWORD);
|
||||||
submitBtn().click();
|
submitBtn().click();
|
||||||
waitUntilUrlContainsText("/home");
|
waitUntilUrlContainsText("/home");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void authorizationTenant() {
|
|
||||||
login(Const.TENANT_EMAIL, Const.TENANT_PASSWORD);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void authorizationCustomer() {
|
|
||||||
login("customer@thingsboard.org", "customer");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,8 @@ import org.thingsboard.server.common.data.id.CustomerId;
|
|||||||
import org.thingsboard.server.common.data.id.DeviceId;
|
import org.thingsboard.server.common.data.id.DeviceId;
|
||||||
import org.thingsboard.server.common.data.id.UserId;
|
import org.thingsboard.server.common.data.id.UserId;
|
||||||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest;
|
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest;
|
||||||
|
import org.thingsboard.server.msa.ui.pages.AlarmDetailsEntityTabHelper;
|
||||||
import org.thingsboard.server.msa.ui.pages.AlarmDetailsViewHelper;
|
import org.thingsboard.server.msa.ui.pages.AlarmDetailsViewHelper;
|
||||||
import org.thingsboard.server.msa.ui.pages.AlarmHelper;
|
|
||||||
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
|
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
|
||||||
import org.thingsboard.server.msa.ui.pages.DevicePageHelper;
|
import org.thingsboard.server.msa.ui.pages.DevicePageHelper;
|
||||||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
|
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
|
||||||
@ -39,56 +39,68 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest {
|
|||||||
protected AlarmId alarmId;
|
protected AlarmId alarmId;
|
||||||
protected AlarmId assignedAlarmId;
|
protected AlarmId assignedAlarmId;
|
||||||
protected DeviceId deviceId;
|
protected DeviceId deviceId;
|
||||||
|
|
||||||
protected UserId userId;
|
protected UserId userId;
|
||||||
protected UserId userWithNameId;
|
protected UserId userWithNameId;
|
||||||
protected CustomerId customerId;
|
protected CustomerId customerId;
|
||||||
|
|
||||||
protected String deviceName;
|
protected String deviceName;
|
||||||
|
protected String userName;
|
||||||
|
protected String customerTitle;
|
||||||
|
protected String userEmail;
|
||||||
|
protected String userWithNameEmail;
|
||||||
|
protected String alarmType;
|
||||||
|
protected String assignedAlarmType;
|
||||||
|
|
||||||
protected SideBarMenuViewHelper sideBarMenuView;
|
protected SideBarMenuViewHelper sideBarMenuView;
|
||||||
protected AlarmHelper alarmPage;
|
protected AlarmDetailsEntityTabHelper alarmPage;
|
||||||
protected DevicePageHelper devicePage;
|
protected DevicePageHelper devicePage;
|
||||||
protected CustomerPageHelper customerPage;
|
protected CustomerPageHelper customerPage;
|
||||||
protected AlarmDetailsViewHelper alarmDetailsView;
|
protected AlarmDetailsViewHelper alarmDetailsView;
|
||||||
|
|
||||||
protected String userName = "User " + random();
|
|
||||||
protected String customerTitle = "Customer " + random();
|
|
||||||
protected String userEmail = random() + "@thingsboard.org";
|
|
||||||
protected String userWithNameEmail = random() + "@thingsboard.org";
|
|
||||||
protected String alarm = "Test alarm " + random();
|
|
||||||
protected String assignedAlarm = "Test assigned alarm " + random();
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void generateTestEntity() {
|
public void generateCommonTestEntity() {
|
||||||
new LoginPageHelper(driver).authorizationTenant();
|
new LoginPageHelper(driver).authorizationTenant();
|
||||||
sideBarMenuView = new SideBarMenuViewHelper(driver);
|
sideBarMenuView = new SideBarMenuViewHelper(driver);
|
||||||
alarmPage = new AlarmHelper(driver);
|
alarmPage = new AlarmDetailsEntityTabHelper(driver);
|
||||||
devicePage = new DevicePageHelper(driver);
|
devicePage = new DevicePageHelper(driver);
|
||||||
customerPage = new CustomerPageHelper(driver);
|
customerPage = new CustomerPageHelper(driver);
|
||||||
alarmDetailsView = new AlarmDetailsViewHelper(driver);
|
alarmDetailsView = new AlarmDetailsViewHelper(driver);
|
||||||
|
|
||||||
|
userName = "User " + random();
|
||||||
|
customerTitle = "Customer " + random();
|
||||||
|
userEmail = random() + "@thingsboard.org";
|
||||||
|
userWithNameEmail = random() + "@thingsboard.org";
|
||||||
|
alarmType = "Test alarm " + random();
|
||||||
|
assignedAlarmType = "Test assigned alarm " + random();
|
||||||
|
|
||||||
customerId = testRestClient.postCustomer(EntityPrototypes.defaultCustomerPrototype(customerTitle)).getId();
|
customerId = testRestClient.postCustomer(EntityPrototypes.defaultCustomerPrototype(customerTitle)).getId();
|
||||||
userId = testRestClient.postUser(EntityPrototypes.defaultUser(userEmail, getCustomerByName(customerTitle).getId())).getId();
|
userId = testRestClient.postUser(EntityPrototypes.defaultUser(userEmail, getCustomerByName(customerTitle).getId())).getId();
|
||||||
userWithNameId = testRestClient.postUser(EntityPrototypes.defaultUser(userWithNameEmail, getCustomerByName(customerTitle).getId(), userName)).getId();
|
userWithNameId = testRestClient.postUser(EntityPrototypes.defaultUser(userWithNameEmail, getCustomerByName(customerTitle).getId(), userName)).getId();
|
||||||
deviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("", customerId)).getName();
|
deviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("Device ", customerId)).getName();
|
||||||
deviceId = testRestClient.getDeviceByName(deviceName).getId();
|
deviceId = testRestClient.getDeviceByName(deviceName).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public void deleteEntities() {
|
public void deleteCommonEntities() {
|
||||||
testRestClient.deleteCustomer(customerId);
|
testRestClient.deleteCustomer(customerId);
|
||||||
testRestClient.deleteDevice(deviceId);
|
testRestClient.deleteDevice(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void createTestAlarms() {
|
public void createCommonTestAlarms() {
|
||||||
alarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, alarm)).getId();
|
alarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, alarmType)).getId();
|
||||||
assignedAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, assignedAlarm, userId)).getId();
|
assignedAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, assignedAlarmType, userId)).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterMethod
|
@AfterMethod
|
||||||
public void deleteCreatedAlarms() {
|
public void deleteCommonCreatedAlarms() {
|
||||||
testRestClient.deleteAlarm(alarmId);
|
testRestClient.deleteAlarm(alarmId);
|
||||||
testRestClient.deleteAlarm(assignedAlarmId);
|
testRestClient.deleteAlarm(assignedAlarmId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loginByUser(String userEmail) {
|
||||||
|
sideBarMenuView.customerBtn().click();
|
||||||
|
customerPage.manageCustomersUserBtn(customerTitle).click();
|
||||||
|
customerPage.getUserLoginBtnByEmail(userEmail).click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,8 @@ import org.testng.annotations.Test;
|
|||||||
import org.thingsboard.server.common.data.id.AlarmId;
|
import org.thingsboard.server.common.data.id.AlarmId;
|
||||||
import org.thingsboard.server.common.data.id.AssetId;
|
import org.thingsboard.server.common.data.id.AssetId;
|
||||||
import org.thingsboard.server.common.data.id.EntityViewId;
|
import org.thingsboard.server.common.data.id.EntityViewId;
|
||||||
import org.thingsboard.server.msa.ui.pages.AssetPageElements;
|
import org.thingsboard.server.msa.ui.pages.AssetPageHelper;
|
||||||
import org.thingsboard.server.msa.ui.pages.EntityViewPage;
|
import org.thingsboard.server.msa.ui.pages.EntityViewPageHelper;
|
||||||
import org.thingsboard.server.msa.ui.utils.Const;
|
import org.thingsboard.server.msa.ui.utils.Const;
|
||||||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
||||||
|
|
||||||
@ -34,36 +34,49 @@ import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random;
|
|||||||
|
|
||||||
public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
||||||
|
|
||||||
|
private AssetId assetId;
|
||||||
private AlarmId propageteAlarmId;
|
private AlarmId propageteAlarmId;
|
||||||
private AlarmId propageteAssigneAlarmId;
|
private AlarmId propageteAssigneAlarmId;
|
||||||
private AlarmId customerAlarmId;
|
private AlarmId customerAlarmId;
|
||||||
private AlarmId assetAlarmId;
|
private AlarmId assetAlarmId;
|
||||||
private AlarmId entityViewAlarmId;
|
private AlarmId entityViewAlarmId;
|
||||||
|
private EntityViewId entityViewId;
|
||||||
|
|
||||||
private String assetName;
|
private String assetName;
|
||||||
private String entityViewName;
|
private String entityViewName;
|
||||||
private final String propagateAlarm = "Test propagated alarm 1 " + random();
|
private String propagateAlarmType;
|
||||||
private final String propagateAssignedAlarm = "Test propagated alarm 2 " + random();
|
private String propagateAssignedAlarmType;
|
||||||
private final String customerAlarm = "Test customer alarm" + random();
|
private String customerAlarmType;
|
||||||
private final String assetAlarm = "Test asset alarm" + random();
|
private String assetAlarmType;
|
||||||
private final String entityViewAlarm = "Test entity view alarm" + random();
|
private String entityViewAlarmType;
|
||||||
private AssetId assetId;
|
|
||||||
private EntityViewId entityViewId;
|
private AssetPageHelper assetPage;
|
||||||
|
private EntityViewPageHelper entityViewPage;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void generateTestEntities() {
|
public void generateTestEntities() {
|
||||||
customerAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(customerId, customerAlarm)).getId();
|
assetPage = new AssetPageHelper(driver);
|
||||||
assetId = testRestClient.postAsset(EntityPrototypes.defaultAssetPrototype("", customerId)).getId();
|
entityViewPage = new EntityViewPageHelper(driver);
|
||||||
|
|
||||||
|
customerAlarmType = "Test customer alarm" + random();
|
||||||
|
assetAlarmType = "Test asset alarm" + random();
|
||||||
|
entityViewAlarmType = "Test entity view alarm" + random();
|
||||||
|
propagateAlarmType = "Test propagated alarm " + random();
|
||||||
|
propagateAssignedAlarmType = "Test propagated alarm " + random();
|
||||||
|
|
||||||
|
customerAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(customerId, customerAlarmType)).getId();
|
||||||
|
assetId = testRestClient.postAsset(EntityPrototypes.defaultAssetPrototype("Asset", customerId)).getId();
|
||||||
assetName = testRestClient.getAssetById(assetId).getName();
|
assetName = testRestClient.getAssetById(assetId).getName();
|
||||||
assetAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(assetId, assetAlarm)).getId();
|
assetAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(assetId, assetAlarmType)).getId();
|
||||||
entityViewId = testRestClient.postEntityView(EntityPrototypes.defaultEntityViewPrototype("", "", "DEVICE")).getId();
|
entityViewId = testRestClient.postEntityView(EntityPrototypes.defaultEntityViewPrototype("Entity view", "", "DEVICE")).getId();
|
||||||
entityViewName = testRestClient.getEntityViewById(entityViewId).getName();
|
entityViewName = testRestClient.getEntityViewById(entityViewId).getName();
|
||||||
entityViewAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(entityViewId, entityViewAlarm)).getId();
|
entityViewAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(entityViewId, entityViewAlarmType)).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void generateTestAlarms() {
|
public void generateTestAlarms() {
|
||||||
propageteAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAlarm, true)).getId();
|
propageteAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAlarmType, true)).getId();
|
||||||
propageteAssigneAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAssignedAlarm, userId, true)).getId();
|
propageteAssigneAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAssignedAlarmType, userId, true)).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
@ -84,15 +97,15 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
@DataProvider
|
@DataProvider
|
||||||
public Object[][] alarms() {
|
public Object[][] alarms() {
|
||||||
return new Object[][]{
|
return new Object[][]{
|
||||||
{alarm},
|
{alarmType},
|
||||||
{propagateAlarm}};
|
{propagateAlarmType}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataProvider
|
@DataProvider
|
||||||
public Object[][] assignedAlarms() {
|
public Object[][] assignedAlarms() {
|
||||||
return new Object[][]{
|
return new Object[][]{
|
||||||
{assignedAlarm},
|
{assignedAlarmType},
|
||||||
{propagateAssignedAlarm}};
|
{propagateAssignedAlarmType}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "alarms")
|
@Test(dataProvider = "alarms")
|
||||||
@ -135,7 +148,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
public void searchByEmail() {
|
public void searchByEmail() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.searchAlarm(alarm, Const.TENANT_EMAIL);
|
alarmPage.searchAlarm(alarmType, Const.TENANT_EMAIL);
|
||||||
alarmPage.setUsers();
|
alarmPage.setUsers();
|
||||||
|
|
||||||
assertThat(alarmPage.getUsers()).hasSize(1).as("Search result contains search input").contains(Const.TENANT_EMAIL);
|
assertThat(alarmPage.getUsers()).hasSize(1).as("Search result contains search input").contains(Const.TENANT_EMAIL);
|
||||||
@ -146,7 +159,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
public void searchByName() {
|
public void searchByName() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.searchAlarm(alarm, userName);
|
alarmPage.searchAlarm(alarmType, userName);
|
||||||
alarmPage.setUsers();
|
alarmPage.setUsers();
|
||||||
|
|
||||||
assertThat(alarmPage.getUsers()).hasSize(1).as("Search result contains search input").contains(userName);
|
assertThat(alarmPage.getUsers()).hasSize(1).as("Search result contains search input").contains(userName);
|
||||||
@ -157,7 +170,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
public void assignAlarmToYourselfFromDetails() {
|
public void assignAlarmToYourselfFromDetails() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.alarmDetailsBtn(alarm).click();
|
alarmPage.alarmDetailsBtn(alarmType).click();
|
||||||
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL);
|
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL);
|
||||||
alarmDetailsView.closeAlarmDetailsViewBtn().click();
|
alarmDetailsView.closeAlarmDetailsViewBtn().click();
|
||||||
|
|
||||||
@ -168,7 +181,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
public void assignAlarmToAnotherUserFromDetails() {
|
public void assignAlarmToAnotherUserFromDetails() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.alarmDetailsBtn(alarm).click();
|
alarmPage.alarmDetailsBtn(alarmType).click();
|
||||||
alarmDetailsView.assignAlarmTo(userEmail);
|
alarmDetailsView.assignAlarmTo(userEmail);
|
||||||
alarmDetailsView.closeAlarmDetailsViewBtn().click();
|
alarmDetailsView.closeAlarmDetailsViewBtn().click();
|
||||||
|
|
||||||
@ -179,18 +192,18 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
public void unassignedAlarmFromDetails() {
|
public void unassignedAlarmFromDetails() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.alarmDetailsBtn(assignedAlarm).click();
|
alarmPage.alarmDetailsBtn(assignedAlarmType).click();
|
||||||
alarmDetailsView.unassignedAlarm();
|
alarmDetailsView.unassignedAlarm();
|
||||||
alarmDetailsView.closeAlarmDetailsViewBtn().click();
|
alarmDetailsView.closeAlarmDetailsViewBtn().click();
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.unassigned(assignedAlarm));
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void reassignAlarmFromDetails() {
|
public void reassignAlarmFromDetails() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.alarmDetailsBtn(assignedAlarm).click();
|
alarmPage.alarmDetailsBtn(assignedAlarmType).click();
|
||||||
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL);
|
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL);
|
||||||
alarmDetailsView.closeAlarmDetailsViewBtn().click();
|
alarmDetailsView.closeAlarmDetailsViewBtn().click();
|
||||||
|
|
||||||
@ -201,27 +214,25 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
public void assignCustomerAlarmToYourself() {
|
public void assignCustomerAlarmToYourself() {
|
||||||
sideBarMenuView.customerBtn().click();
|
sideBarMenuView.customerBtn().click();
|
||||||
customerPage.openCustomerAlarms(customerTitle);
|
customerPage.openCustomerAlarms(customerTitle);
|
||||||
alarmPage.assignAlarmTo(customerAlarm, Const.TENANT_EMAIL);
|
alarmPage.assignAlarmTo(customerAlarmType, Const.TENANT_EMAIL);
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void assignAssetAlarmToYourself() {
|
public void assignAssetAlarmToYourself() {
|
||||||
AssetPageElements assetPageElements = new AssetPageElements(driver);
|
|
||||||
sideBarMenuView.goToAssetsPage();
|
sideBarMenuView.goToAssetsPage();
|
||||||
assetPageElements.openAssetAlarms(assetName);
|
assetPage.openAssetAlarms(assetName);
|
||||||
alarmPage.assignAlarmTo(assetAlarm, Const.TENANT_EMAIL);
|
alarmPage.assignAlarmTo(assetAlarmType, Const.TENANT_EMAIL);
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void assignEntityViewsAlarmToYourself() {
|
public void assignEntityViewsAlarmToYourself() {
|
||||||
EntityViewPage entityViewPage = new EntityViewPage(driver);
|
|
||||||
sideBarMenuView.goToEntityViewsPage();
|
sideBarMenuView.goToEntityViewsPage();
|
||||||
entityViewPage.openEntityViewAlarms(entityViewName);
|
entityViewPage.openEntityViewAlarms(entityViewName);
|
||||||
alarmPage.assignAlarmTo(entityViewAlarm, Const.TENANT_EMAIL);
|
alarmPage.assignAlarmTo(entityViewAlarmType, Const.TENANT_EMAIL);
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,29 +28,26 @@ import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random;
|
|||||||
|
|
||||||
public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
||||||
|
|
||||||
AlarmId tenantAlarmId;
|
private AlarmId tenantAlarmId;
|
||||||
DeviceId tenantDeviceId;
|
private DeviceId tenantDeviceId;
|
||||||
String tenantDeviceName;
|
private String tenantDeviceName;
|
||||||
String tenantAlarm = "Test tenant alarm " + random();
|
|
||||||
|
|
||||||
public void loginByUser(String userEmail) {
|
private String tenantAlarmType;
|
||||||
sideBarMenuView.customerBtn().click();
|
|
||||||
customerPage.manageCustomersUserBtn(customerTitle).click();
|
|
||||||
customerPage.getUserLoginBtnByEmail(userEmail).click();
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void generateTenantEntity() {
|
public void generateTenantEntity() {
|
||||||
if (getJwtTokenFromLocalStorage() == null) {
|
if (getJwtTokenFromLocalStorage() == null) {
|
||||||
new LoginPageHelper(driver).authorizationTenant();
|
new LoginPageHelper(driver).authorizationTenant();
|
||||||
}
|
}
|
||||||
|
tenantAlarmType = "Test tenant alarm " + random();
|
||||||
|
|
||||||
tenantDeviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("")).getName();
|
tenantDeviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("")).getName();
|
||||||
tenantDeviceId = testRestClient.getDeviceByName(tenantDeviceName).getId();
|
tenantDeviceId = testRestClient.getDeviceByName(tenantDeviceName).getId();
|
||||||
tenantAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(tenantDeviceId, tenantAlarm)).getId();
|
tenantAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(tenantDeviceId, tenantAlarmType)).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterMethod
|
@AfterMethod
|
||||||
public void clear() {
|
public void deleteTenantEntity() {
|
||||||
testRestClient.deleteAlarm(tenantAlarmId);
|
testRestClient.deleteAlarm(tenantAlarmId);
|
||||||
testRestClient.deleteDevice(tenantDeviceId);
|
testRestClient.deleteDevice(tenantDeviceId);
|
||||||
clearStorage();
|
clearStorage();
|
||||||
@ -61,7 +58,7 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
loginByUser(userEmail);
|
loginByUser(userEmail);
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.assignAlarmTo(alarm, userEmail);
|
alarmPage.assignAlarmTo(alarmType, userEmail);
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.assignedUser(userEmail));
|
assertIsDisplayed(alarmPage.assignedUser(userEmail));
|
||||||
}
|
}
|
||||||
@ -71,7 +68,7 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
loginByUser(userWithNameEmail);
|
loginByUser(userWithNameEmail);
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.assignAlarmTo(assignedAlarm, userName);
|
alarmPage.assignAlarmTo(assignedAlarmType, userName);
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.assignedUser(userName));
|
assertIsDisplayed(alarmPage.assignedUser(userName));
|
||||||
}
|
}
|
||||||
@ -81,9 +78,9 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
loginByUser(userWithNameEmail);
|
loginByUser(userWithNameEmail);
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.unassignedAlarm(assignedAlarm);
|
alarmPage.unassignedAlarm(assignedAlarmType);
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.unassigned(assignedAlarm));
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -91,16 +88,16 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
loginByUser(userEmail);
|
loginByUser(userEmail);
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
alarmPage.unassignedAlarm(assignedAlarm);
|
alarmPage.unassignedAlarm(assignedAlarmType);
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.unassigned(assignedAlarm));
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkTheDisplayOfNamesEmailsFromCustomer() {
|
public void checkTheDisplayOfNamesEmailsFromCustomer() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(tenantDeviceName);
|
devicePage.openDeviceAlarms(tenantDeviceName);
|
||||||
alarmPage.assignAlarmTo(tenantAlarm, Const.TENANT_EMAIL);
|
alarmPage.assignAlarmTo(tenantAlarmType, Const.TENANT_EMAIL);
|
||||||
devicePage.closeDeviceDetailsViewBtn().click();
|
devicePage.closeDeviceDetailsViewBtn().click();
|
||||||
devicePage.assignToCustomerBtn(tenantDeviceName).click();
|
devicePage.assignToCustomerBtn(tenantDeviceName).click();
|
||||||
devicePage.assignToCustomer(customerTitle);
|
devicePage.assignToCustomer(customerTitle);
|
||||||
@ -115,14 +112,14 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
public void reassignTenantForOldAlarm() {
|
public void reassignTenantForOldAlarm() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(tenantDeviceName);
|
devicePage.openDeviceAlarms(tenantDeviceName);
|
||||||
alarmPage.assignAlarmTo(tenantAlarm, Const.TENANT_EMAIL);
|
alarmPage.assignAlarmTo(tenantAlarmType, Const.TENANT_EMAIL);
|
||||||
devicePage.closeDeviceDetailsViewBtn().click();
|
devicePage.closeDeviceDetailsViewBtn().click();
|
||||||
devicePage.assignToCustomerBtn(tenantDeviceName).click();
|
devicePage.assignToCustomerBtn(tenantDeviceName).click();
|
||||||
devicePage.assignToCustomer(customerTitle);
|
devicePage.assignToCustomer(customerTitle);
|
||||||
loginByUser(userEmail);
|
loginByUser(userEmail);
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(tenantDeviceName);
|
devicePage.openDeviceAlarms(tenantDeviceName);
|
||||||
alarmPage.assignBtn(tenantAlarm).click();
|
jsClick(alarmPage.assignBtn(tenantAlarmType));
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.accessForbiddenDialogView());
|
assertIsDisplayed(alarmPage.accessForbiddenDialogView());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,5 +149,4 @@ public class DataProviderCredential {
|
|||||||
{description, newDescription, description + newDescription},
|
{description, newDescription, description + newDescription},
|
||||||
{description, Keys.CONTROL + "A" + Keys.BACK_SPACE, ""}};
|
{description, Keys.CONTROL + "A" + Keys.BACK_SPACE, ""}};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,11 +18,11 @@
|
|||||||
-->
|
-->
|
||||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||||
|
|
||||||
<suite name="Customer Smoke Tests">
|
<suite name="Assignee ui tests">
|
||||||
<listeners>
|
<listeners>
|
||||||
<listener class-name="org.thingsboard.server.msa.ui.listeners.RetryTestListener"/>
|
<listener class-name="org.thingsboard.server.msa.ui.listeners.RetryTestListener"/>
|
||||||
</listeners>
|
</listeners>
|
||||||
<test name="Customer ui smoke tests">
|
<test name="Assignee ui tests">
|
||||||
<groups>
|
<groups>
|
||||||
<run>
|
<run>
|
||||||
<exclude name="broken"/>
|
<exclude name="broken"/>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user