Merge pull request #8606 from Seraphym-Tuhai/ui-tests-device-assign
[3.5.2] UI smoke tests on assign devices
This commit is contained in:
commit
151231d11d
@ -520,4 +520,11 @@ public class TestRestClient {
|
||||
.then()
|
||||
.statusCode(HTTP_OK);
|
||||
}
|
||||
|
||||
public void setDevicePublic(DeviceId deviceId) {
|
||||
given().spec(requestSpec)
|
||||
.post("/api/customer/public/device/{deviceId}", deviceId.getId())
|
||||
.then()
|
||||
.statusCode(HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
||||
private static final int WIDTH = 1680;
|
||||
private static final int HEIGHT = 1050;
|
||||
private static final String REMOTE_WEBDRIVER_HOST = "http://localhost:4444";
|
||||
protected final PageLink pageLink = new PageLink(10);
|
||||
protected final PageLink pageLink = new PageLink(30);
|
||||
private final ContainerTestSuite instance = ContainerTestSuite.getInstance();
|
||||
private JavascriptExecutor js;
|
||||
public static final long WAIT_TIMEOUT = TimeUnit.SECONDS.toMillis(10);
|
||||
@ -253,6 +253,13 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteCustomerByName(String customerName) {
|
||||
Customer customer = getCustomerByName(customerName);
|
||||
if (customer != null) {
|
||||
testRestClient.deleteCustomer(customer.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteDeviceById(DeviceId deviceId) {
|
||||
if (deviceId != null) {
|
||||
testRestClient.deleteDevice(deviceId);
|
||||
@ -283,4 +290,19 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
||||
testRestClient.deleteDevice(device.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteDeviceProfileByTitle(String deviceProfileTitle) {
|
||||
DeviceProfile deviceProfile = getDeviceProfileByName(deviceProfileTitle);
|
||||
if (deviceProfile != null) {
|
||||
testRestClient.deleteDeviseProfile(deviceProfile.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public void assertInvisibilityOfElement(WebElement element) {
|
||||
try {
|
||||
new WebDriverWait(driver, duration).until(ExpectedConditions.invisibilityOf(element));
|
||||
} catch (WebDriverException e) {
|
||||
fail("Element " + element.toString() + " stay visible");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ public class CustomerPageElements extends OtherPageElementsHelper {
|
||||
private static final String ASSIGNED_BTN = "//button[@type='submit']";
|
||||
private static final String HIDE_HOME_DASHBOARD_TOOLBAR = "//mat-checkbox[@formcontrolname='homeDashboardHideToolbar']//label";
|
||||
private static final String FILTER_BTN = "//tb-filters-edit";
|
||||
private static final String TIME_BTN = "//tb-timewindow";
|
||||
private static final String TIME_BTN = "//tb-timewindow[not(@hidelabel)]";
|
||||
private static final String CUSTOMER_ICON_HEADER = "//tb-breadcrumb//span[contains(text(),'Customer %s')]";
|
||||
private static final String CUSTOMER_USER_ICON_HEADER = "Users";
|
||||
private static final String CUSTOMER_ASSETS_ICON_HEADER = "Assets";
|
||||
|
||||
@ -33,26 +33,26 @@ public class DevicePageElements extends OtherPageElementsHelper {
|
||||
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 ADD_DEVICE_BTN = "//mat-icon[text() = 'insert_drive_file']/parent::button";
|
||||
private static final String CREATE_DEVICE_NAME_FIELD = "//tb-device-wizard//input[@formcontrolname='name']";
|
||||
private static final String HEADER_NAME_VIEW = "//header//div[@class='tb-details-title']/span";
|
||||
private static final String DESCRIPTION_FIELD_CREATE_VIEW = "//tb-device-wizard//textarea[@formcontrolname='description']";
|
||||
private static final String ADD_DEVICE_VIEW = "//tb-device-wizard";
|
||||
private static final String DELETE_BTN_DETAILS_TAB = "//span[contains(text(),'Delete device')]/parent::button";
|
||||
private static final String CHECKBOX_GATEWAY_EDIT = "//mat-checkbox[@formcontrolname='gateway']//label";
|
||||
private static final String CHECKBOX_GATEWAY_CREATE = "//tb-device-wizard//mat-checkbox[@formcontrolname='gateway']//label";
|
||||
private static final String CHECKBOX_OVERWRITE_ACTIVITY_TIME_EDIT = "//mat-checkbox[@formcontrolname='overwriteActivityTime']//label";
|
||||
private static final String CHECKBOX_OVERWRITE_ACTIVITY_TIME_CREATE = "//tb-device-wizard//mat-checkbox[@formcontrolname='overwriteActivityTime']//label";
|
||||
private static final String CHECKBOX_GATEWAY_DETAILS = "//mat-checkbox[@formcontrolname='gateway']//input";
|
||||
private static final String CHECKBOX_GATEWAY_PAGE = DEVICE + "/ancestor::mat-row//mat-cell[contains(@class,'cdk-column-gateway')]//mat-icon[text() = 'check_box']";
|
||||
private static final String CHECKBOX_OVERWRITE_ACTIVITY_TIME_DETAILS = "//mat-checkbox[@formcontrolname='overwriteActivityTime']//input";
|
||||
private static final String CLEAR_PROFILE_FIELD_BTN = "//button[@aria-label='Clear']";
|
||||
private static final String DEVICE_PROFILE_REDIRECTED_BTN = "//a[@aria-label='Open device profile']";
|
||||
private static final String DEVICE_LABEL_FIELD_CREATE = "//tb-device-wizard//input[@formcontrolname='label']";
|
||||
private static final String DEVICE_LABEL_PAGE = DEVICE + "/ancestor::mat-row//mat-cell[contains(@class,'cdk-column-label')]/span";
|
||||
private static final String DEVICE_CUSTOMER_PAGE = DEVICE + "/ancestor::mat-row//mat-cell[contains(@class,'cdk-column-customerTitle')]/span";
|
||||
private static final String CUSTOMER_OPTION_BNT = "//div[text() = 'Customer']/ancestor::mat-step-header";
|
||||
private static final String ASSIGN_ON_CUSTOMER_FIELD = "//input[@formcontrolname='entity']";
|
||||
private static final String DEVICE_LABEL_EDIT = "//input[@formcontrolname='label']";
|
||||
private static final String DEVICE_DEVICE_PROFILE_PAGE = DEVICE + "/ancestor::mat-row//mat-cell[contains(@class,'cdk-column-deviceProfileName')]/span";
|
||||
protected static final String ASSIGN_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),'assignment_ind')]/ancestor::button";
|
||||
protected static final String UNASSIGN_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),' assignment_return')]/ancestor::button";
|
||||
protected static final String ASSIGN_BTN_DETAILS_TAB = "//span[contains(text(),'Assign to customer')]/parent::button";
|
||||
protected static final String UNASSIGN_BTN_DETAILS_TAB = "//span[contains(text(),'Unassign from customer')]/parent::button";
|
||||
protected static final String ASSIGNED_FIELD_DETAILS_TAB = "//mat-label[text() = 'Assigned to customer']/parent::label/parent::div/input";
|
||||
protected static final String ASSIGN_MARKED_DEVICE_BTN = "//mat-icon[text() = 'assignment_ind']/parent::button";
|
||||
|
||||
public WebElement device(String deviceName) {
|
||||
return waitUntilElementToBeClickable(String.format(DEVICE, deviceName));
|
||||
@ -90,18 +90,10 @@ public class DevicePageElements extends OtherPageElementsHelper {
|
||||
return waitUntilElementToBeClickable(ADD_DEVICE_BTN);
|
||||
}
|
||||
|
||||
public WebElement nameField() {
|
||||
return waitUntilElementToBeClickable(CREATE_DEVICE_NAME_FIELD);
|
||||
}
|
||||
|
||||
public WebElement headerNameView() {
|
||||
return waitUntilVisibilityOfElementLocated(HEADER_NAME_VIEW);
|
||||
}
|
||||
|
||||
public WebElement descriptionFieldCreateField() {
|
||||
return waitUntilElementToBeClickable(DESCRIPTION_FIELD_CREATE_VIEW);
|
||||
}
|
||||
|
||||
public WebElement addDeviceView() {
|
||||
return waitUntilPresenceOfElementLocated(ADD_DEVICE_VIEW);
|
||||
}
|
||||
@ -114,18 +106,10 @@ public class DevicePageElements extends OtherPageElementsHelper {
|
||||
return waitUntilElementToBeClickable(CHECKBOX_GATEWAY_EDIT);
|
||||
}
|
||||
|
||||
public WebElement checkboxGatewayCreate() {
|
||||
return waitUntilElementToBeClickable(CHECKBOX_GATEWAY_CREATE);
|
||||
}
|
||||
|
||||
public WebElement checkboxOverwriteActivityTimeEdit() {
|
||||
return waitUntilElementToBeClickable(CHECKBOX_OVERWRITE_ACTIVITY_TIME_EDIT);
|
||||
}
|
||||
|
||||
public WebElement checkboxOverwriteActivityTimeCreate() {
|
||||
return waitUntilElementToBeClickable(CHECKBOX_OVERWRITE_ACTIVITY_TIME_CREATE);
|
||||
}
|
||||
|
||||
public WebElement checkboxGatewayDetailsTab() {
|
||||
return waitUntilPresenceOfElementLocated(CHECKBOX_GATEWAY_DETAILS);
|
||||
}
|
||||
@ -146,22 +130,10 @@ public class DevicePageElements extends OtherPageElementsHelper {
|
||||
return waitUntilElementToBeClickable(DEVICE_PROFILE_REDIRECTED_BTN);
|
||||
}
|
||||
|
||||
public WebElement deviceLabelFieldCreate() {
|
||||
return waitUntilElementToBeClickable(DEVICE_LABEL_FIELD_CREATE);
|
||||
}
|
||||
|
||||
public WebElement deviceLabelOnPage(String deviceName) {
|
||||
return waitUntilVisibilityOfElementLocated(String.format(DEVICE_LABEL_PAGE, deviceName));
|
||||
}
|
||||
|
||||
public WebElement customerOptionBtn() {
|
||||
return waitUntilElementToBeClickable(CUSTOMER_OPTION_BNT);
|
||||
}
|
||||
|
||||
public WebElement assignOnCustomerField() {
|
||||
return waitUntilElementToBeClickable(ASSIGN_ON_CUSTOMER_FIELD);
|
||||
}
|
||||
|
||||
public WebElement deviceCustomerOnPage(String deviceName) {
|
||||
return waitUntilVisibilityOfElementLocated(String.format(DEVICE_CUSTOMER_PAGE, deviceName));
|
||||
}
|
||||
@ -173,4 +145,36 @@ public class DevicePageElements extends OtherPageElementsHelper {
|
||||
public WebElement deviceLabelDetailsField() {
|
||||
return waitUntilVisibilityOfElementLocated(DEVICE_LABEL_EDIT);
|
||||
}
|
||||
|
||||
public WebElement deviceDeviceProfileOnPage(String deviceProfileTitle) {
|
||||
return waitUntilVisibilityOfElementLocated(String.format(DEVICE_DEVICE_PROFILE_PAGE, deviceProfileTitle));
|
||||
}
|
||||
|
||||
public WebElement assignBtn(String deviceName) {
|
||||
return waitUntilElementToBeClickable(String.format(ASSIGN_BTN, deviceName));
|
||||
}
|
||||
|
||||
public WebElement assignBtnVisible(String deviceName) {
|
||||
return waitUntilVisibilityOfElementLocated(String.format(ASSIGN_BTN, deviceName));
|
||||
}
|
||||
|
||||
public WebElement unassignBtn(String deviceName) {
|
||||
return waitUntilElementToBeClickable(String.format(UNASSIGN_BTN, deviceName));
|
||||
}
|
||||
|
||||
public WebElement assignBtnDetailsTab() {
|
||||
return waitUntilElementToBeClickable(ASSIGN_BTN_DETAILS_TAB);
|
||||
}
|
||||
|
||||
public WebElement unassignBtnDetailsTab() {
|
||||
return waitUntilElementToBeClickable(UNASSIGN_BTN_DETAILS_TAB);
|
||||
}
|
||||
|
||||
public WebElement assignFieldDetailsTab() {
|
||||
return waitUntilVisibilityOfElementLocated(ASSIGNED_FIELD_DETAILS_TAB);
|
||||
}
|
||||
|
||||
public WebElement assignMarkedDeviceBtn() {
|
||||
return waitUntilVisibilityOfElementLocated(ASSIGN_MARKED_DEVICE_BTN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,18 +43,6 @@ public class DevicePageHelper extends DevicePageElements {
|
||||
addDeviceBtn().click();
|
||||
}
|
||||
|
||||
public void enterName(String deviceName) {
|
||||
enterText(nameField(), deviceName);
|
||||
}
|
||||
|
||||
public void enterDescription(String description) {
|
||||
enterText(descriptionFieldCreateField(), description);
|
||||
}
|
||||
|
||||
public void enterLabel(String label) {
|
||||
enterText(deviceLabelFieldCreate(), label);
|
||||
}
|
||||
|
||||
public void deleteDeviceByRightSideBtn(String deviceName) {
|
||||
deleteBtn(deviceName).click();
|
||||
warningPopUpYesBtn().click();
|
||||
@ -87,10 +75,30 @@ public class DevicePageHelper extends DevicePageElements {
|
||||
entityFromDropdown(deviceProfileName).click();
|
||||
}
|
||||
|
||||
public void assignOnCustomer(String customerTitle) {
|
||||
customerOptionBtn().click();
|
||||
assignOnCustomerField().click();
|
||||
entityFromList(customerTitle).click();
|
||||
sleep(2); //waiting for the action to count
|
||||
public void unassignedDeviceByRightSideBtn(String deviceName) {
|
||||
unassignBtn(deviceName).click();
|
||||
warningPopUpYesBtn().click();
|
||||
}
|
||||
|
||||
public void unassignedDeviceFromDetailsTab() {
|
||||
unassignBtnDetailsTab().click();
|
||||
warningPopUpYesBtn().click();
|
||||
}
|
||||
|
||||
public void selectDevices(String... deviceNames) {
|
||||
for (String deviceName : deviceNames) {
|
||||
checkBox(deviceName).click();
|
||||
}
|
||||
}
|
||||
|
||||
public void assignSelectedDevices(String... deviceNames) {
|
||||
selectDevices(deviceNames);
|
||||
assignMarkedDeviceBtn().click();
|
||||
}
|
||||
|
||||
public void deleteSelectedDevices(String... deviceNames) {
|
||||
selectDevices(deviceNames);
|
||||
deleteSelectedBtn().click();
|
||||
warningPopUpYesBtn().click();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 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.tabs;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.thingsboard.server.msa.ui.base.AbstractBasePage;
|
||||
|
||||
public class AssignDeviceTabElements extends AbstractBasePage {
|
||||
public AssignDeviceTabElements(WebDriver driver) {
|
||||
super(driver);
|
||||
}
|
||||
|
||||
private static final String ASSIGN_ON_CUSTOMER_FIELD = "//input[@formcontrolname='entity']";
|
||||
private static final String CUSTOMER_FROM_DROPDOWN = "//div[@role='listbox']/mat-option//span[contains(text(),'%s')]";
|
||||
private static final String ASSIGN_BTN = "//button[@type='submit']";
|
||||
|
||||
public WebElement assignOnCustomerField() {
|
||||
return waitUntilElementToBeClickable(ASSIGN_ON_CUSTOMER_FIELD);
|
||||
}
|
||||
|
||||
public WebElement customerFromDropDown(String entityName) {
|
||||
return waitUntilVisibilityOfElementLocated(String.format(CUSTOMER_FROM_DROPDOWN, entityName));
|
||||
}
|
||||
|
||||
public WebElement assignBtn() {
|
||||
return waitUntilElementToBeClickable(ASSIGN_BTN);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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.tabs;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
public class AssignDeviceTabHelper extends AssignDeviceTabElements {
|
||||
public AssignDeviceTabHelper(WebDriver driver) {
|
||||
super(driver);
|
||||
}
|
||||
|
||||
public void assignOnCustomer(String customerTitle) {
|
||||
assignOnCustomerField().click();
|
||||
customerFromDropDown(customerTitle).click();
|
||||
assignBtn().click();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* 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.tabs;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.thingsboard.server.msa.ui.base.AbstractBasePage;
|
||||
|
||||
public class CreateDeviceTabElements extends AbstractBasePage {
|
||||
public CreateDeviceTabElements(WebDriver driver) {
|
||||
super(driver);
|
||||
}
|
||||
|
||||
private static final String CREATE_DEVICE_NAME_FIELD = "//tb-device-wizard//input[@formcontrolname='name']";
|
||||
private static final String CREATE_NEW_DEVICE_PROFILE_RADIO_BTN = "//span[text() = 'Create new device profile']/ancestor::mat-radio-button";
|
||||
private static final String SELECT_EXISTING_DEVICE_PROFILE_RADIO_BTN = "//span[text() = 'Select existing device profile']/ancestor::mat-radio-button";
|
||||
private static final String DEVICE_PROFILE_TITLE_FIELD = "//input[@formcontrolname='newDeviceProfileTitle']";
|
||||
private static final String ADD_BTN = "//span[text() = 'Add']";
|
||||
private static final String CLEAR_PROFILE_FIELD_BTN = "//button[@aria-label='Clear']";
|
||||
private static final String ENTITY_FROM_DROPDOWN = "//div[@role = 'listbox']//span[text() = '%s']";
|
||||
private static final String ASSIGN_ON_CUSTOMER_FIELD = "//input[@formcontrolname='entity']";
|
||||
private static final String CUSTOMER_OPTION_BNT = "//div[text() = 'Customer']/ancestor::mat-step-header";
|
||||
private static final String CUSTOMER_FROM_DROPDOWN = "//div[@role='listbox']/mat-option//span[contains(text(),'%s')]";
|
||||
private static final String DEVICE_LABEL_FIELD = "//tb-device-wizard//input[@formcontrolname='label']";
|
||||
private static final String CHECKBOX_GATEWAY = "//tb-device-wizard//mat-checkbox[@formcontrolname='gateway']//label";
|
||||
private static final String CHECKBOX_OVERWRITE_ACTIVITY_TIME = "//tb-device-wizard//mat-checkbox[@formcontrolname='overwriteActivityTime']//label";
|
||||
private static final String DESCRIPTION_FIELD = "//tb-device-wizard//textarea[@formcontrolname='description']";
|
||||
|
||||
public WebElement nameField() {
|
||||
return waitUntilElementToBeClickable(CREATE_DEVICE_NAME_FIELD);
|
||||
}
|
||||
|
||||
public WebElement createNewDeviceProfileRadioBtn() {
|
||||
return waitUntilElementToBeClickable(CREATE_NEW_DEVICE_PROFILE_RADIO_BTN);
|
||||
}
|
||||
|
||||
public WebElement selectExistingDeviceProfileRadioBtn() {
|
||||
return waitUntilElementToBeClickable(SELECT_EXISTING_DEVICE_PROFILE_RADIO_BTN);
|
||||
}
|
||||
|
||||
public WebElement deviceProfileTitleField() {
|
||||
return waitUntilElementToBeClickable(DEVICE_PROFILE_TITLE_FIELD);
|
||||
}
|
||||
|
||||
public WebElement addBtn() {
|
||||
return waitUntilElementToBeClickable(ADD_BTN);
|
||||
}
|
||||
|
||||
public WebElement clearProfileFieldBtn() {
|
||||
return waitUntilElementToBeClickable(CLEAR_PROFILE_FIELD_BTN);
|
||||
}
|
||||
|
||||
public WebElement entityFromDropdown(String customerTitle) {
|
||||
return waitUntilElementToBeClickable(String.format(ENTITY_FROM_DROPDOWN, customerTitle));
|
||||
}
|
||||
|
||||
public WebElement assignOnCustomerField() {
|
||||
return waitUntilElementToBeClickable(ASSIGN_ON_CUSTOMER_FIELD);
|
||||
}
|
||||
|
||||
public WebElement customerOptionBtn() {
|
||||
return waitUntilElementToBeClickable(CUSTOMER_OPTION_BNT);
|
||||
}
|
||||
|
||||
public WebElement customerFromDropDown(String entityName) {
|
||||
return waitUntilVisibilityOfElementLocated(String.format(CUSTOMER_FROM_DROPDOWN, entityName));
|
||||
}
|
||||
|
||||
public WebElement deviceLabelField() {
|
||||
return waitUntilElementToBeClickable(DEVICE_LABEL_FIELD);
|
||||
}
|
||||
|
||||
public WebElement checkboxGateway() {
|
||||
return waitUntilElementToBeClickable(CHECKBOX_GATEWAY);
|
||||
}
|
||||
|
||||
public WebElement checkboxOverwriteActivityTime() {
|
||||
return waitUntilElementToBeClickable(CHECKBOX_OVERWRITE_ACTIVITY_TIME);
|
||||
}
|
||||
|
||||
public WebElement descriptionField() {
|
||||
return waitUntilElementToBeClickable(DESCRIPTION_FIELD);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 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.tabs;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
public class CreateDeviceTabHelper extends CreateDeviceTabElements {
|
||||
public CreateDeviceTabHelper(WebDriver driver) {
|
||||
super(driver);
|
||||
}
|
||||
|
||||
public void enterName(String deviceName) {
|
||||
enterText(nameField(), deviceName);
|
||||
}
|
||||
|
||||
public void createNewDeviceProfile(String deviceProfileTitle) {
|
||||
if (!createNewDeviceProfileRadioBtn().getAttribute("class").contains("checked")) {
|
||||
createNewDeviceProfileRadioBtn().click();
|
||||
}
|
||||
deviceProfileTitleField().sendKeys(deviceProfileTitle);
|
||||
}
|
||||
|
||||
public void changeDeviceProfile(String deviceProfileName) {
|
||||
if (!selectExistingDeviceProfileRadioBtn().getAttribute("class").contains("checked")) {
|
||||
selectExistingDeviceProfileRadioBtn().click();
|
||||
}
|
||||
clearProfileFieldBtn().click();
|
||||
entityFromDropdown(deviceProfileName).click();
|
||||
}
|
||||
|
||||
public void assignOnCustomer(String customerTitle) {
|
||||
customerOptionBtn().click();
|
||||
assignOnCustomerField().click();
|
||||
customerFromDropDown(customerTitle).click();
|
||||
sleep(2); //waiting for the action to count
|
||||
}
|
||||
|
||||
public void enterLabel(String label) {
|
||||
enterText(deviceLabelField(), label);
|
||||
}
|
||||
|
||||
public void enterDescription(String description) {
|
||||
enterText(descriptionField(), description);
|
||||
}
|
||||
}
|
||||
@ -22,24 +22,32 @@ import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest;
|
||||
import org.thingsboard.server.msa.ui.pages.DevicePageHelper;
|
||||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
|
||||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper;
|
||||
import org.thingsboard.server.msa.ui.tabs.CreateDeviceTabHelper;
|
||||
|
||||
@Epic("Device smoke tests")
|
||||
abstract public class AbstractDeviceTest extends AbstractDriverBaseTest {
|
||||
|
||||
protected SideBarMenuViewHelper sideBarMenuView;
|
||||
protected DevicePageHelper devicePage;
|
||||
protected CreateDeviceTabHelper createDeviceTab;
|
||||
protected String deviceName;
|
||||
protected String deviceProfileTitle;
|
||||
|
||||
@BeforeClass
|
||||
public void login() {
|
||||
new LoginPageHelper(driver).authorizationTenant();
|
||||
sideBarMenuView = new SideBarMenuViewHelper(driver);
|
||||
devicePage = new DevicePageHelper(driver);
|
||||
createDeviceTab = new CreateDeviceTabHelper(driver);
|
||||
}
|
||||
|
||||
@AfterMethod
|
||||
public void delete() {
|
||||
deleteDeviceByName(deviceName);
|
||||
deviceName = null;
|
||||
if (deviceProfileTitle != null) {
|
||||
deleteDeviceProfileByTitle(deviceProfileTitle);
|
||||
deviceProfileTitle = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,193 @@
|
||||
/**
|
||||
* 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.tests.devicessmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
import org.thingsboard.server.common.data.Customer;
|
||||
import org.thingsboard.server.common.data.Device;
|
||||
import org.thingsboard.server.common.data.id.CustomerId;
|
||||
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
|
||||
import org.thingsboard.server.msa.ui.tabs.AssignDeviceTabHelper;
|
||||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random;
|
||||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
|
||||
|
||||
@Feature("Assign to customer")
|
||||
public class AssignToCustomerTest extends AbstractDeviceTest {
|
||||
|
||||
private AssignDeviceTabHelper assignDeviceTab;
|
||||
private CustomerPageHelper customerPage;
|
||||
private CustomerId customerId;
|
||||
private Device device;
|
||||
private Device device1;
|
||||
private String customerName;
|
||||
|
||||
@BeforeClass
|
||||
public void create() {
|
||||
assignDeviceTab = new AssignDeviceTabHelper(driver);
|
||||
customerPage = new CustomerPageHelper(driver);
|
||||
Customer customer = testRestClient.postCustomer(EntityPrototypes.defaultCustomerPrototype(ENTITY_NAME + random()));
|
||||
customerId = customer.getId();
|
||||
customerName = customer.getName();
|
||||
device1 = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("Device " + random()));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void deleteCustomer() {
|
||||
deleteCustomerById(customerId);
|
||||
deleteCustomerByName("Public");
|
||||
deleteDeviceByName(device1.getName());
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
public void createDevice() {
|
||||
device = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype(ENTITY_NAME));
|
||||
deviceName = device.getName();
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Assign to customer by right side of device btn")
|
||||
public void assignToCustomerByRightSideBtn() {
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.assignBtn(deviceName).click();
|
||||
assignDeviceTab.assignOnCustomer(customerName);
|
||||
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
||||
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
||||
.as("Customer added correctly").isEqualTo(customerName);
|
||||
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.manageCustomersDevicesBtn(customerName).click();
|
||||
assertIsDisplayed(devicePage.device(deviceName));
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Assign to customer by 'Assign to customer' btn on details tab")
|
||||
public void assignToCustomerFromDetailsTab() {
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.device(deviceName).click();
|
||||
devicePage.assignBtnDetailsTab().click();
|
||||
assignDeviceTab.assignOnCustomer(customerName);
|
||||
String customerInAssignedField = devicePage.assignFieldDetailsTab().getAttribute("value");
|
||||
devicePage.closeDeviceDetailsViewBtn().click();
|
||||
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
||||
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
||||
.as("Customer added correctly").isEqualTo(customerName);
|
||||
assertThat(customerInAssignedField)
|
||||
.as("Customer in details tab added correctly").isEqualTo(customerName);
|
||||
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.manageCustomersDevicesBtn(customerName).click();
|
||||
assertIsDisplayed(devicePage.device(deviceName));
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Assign marked device by btn on the top")
|
||||
public void assignToCustomerMarkedDevice() {
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.assignSelectedDevices(deviceName);
|
||||
assignDeviceTab.assignOnCustomer(customerName);
|
||||
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
||||
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
||||
.as("Customer added correctly").isEqualTo(customerName);
|
||||
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.manageCustomersDevicesBtn(customerName).click();
|
||||
assertIsDisplayed(devicePage.device(deviceName));
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Unassign from customer by right side of device btn")
|
||||
public void unassignedFromCustomerByRightSideBtn() {
|
||||
device.setCustomerId(customerId);
|
||||
testRestClient.postDevice("", device);
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
WebElement element = devicePage.deviceCustomerOnPage(deviceName);
|
||||
devicePage.unassignedDeviceByRightSideBtn(deviceName);
|
||||
assertInvisibilityOfElement(element);
|
||||
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.manageCustomersDevicesBtn(customerName).click();
|
||||
devicePage.assertEntityIsNotPresent(deviceName);
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Unassign from customer by 'Unassign from customer' btn on details tab")
|
||||
public void unassignedFromCustomerFromDetailsTab() {
|
||||
device.setCustomerId(customerId);
|
||||
testRestClient.postDevice("", device);
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
WebElement customerInColumn = devicePage.deviceCustomerOnPage(deviceName);
|
||||
devicePage.device(deviceName).click();
|
||||
WebElement assignFieldDetailsTab = devicePage.assignFieldDetailsTab();
|
||||
devicePage.unassignedDeviceFromDetailsTab();
|
||||
assertInvisibilityOfElement(customerInColumn);
|
||||
assertInvisibilityOfElement(assignFieldDetailsTab);
|
||||
|
||||
devicePage.closeDeviceDetailsViewBtn().click();
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.manageCustomersDevicesBtn(customerName).click();
|
||||
devicePage.assertEntityIsNotPresent(deviceName);
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Can't assign device on several customer")
|
||||
public void assignToSeveralCustomer() {
|
||||
device.setCustomerId(customerId);
|
||||
testRestClient.postDevice("", device);
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
|
||||
assertIsDisable(devicePage.assignBtnVisible(deviceName));
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Can't assign public device")
|
||||
public void assignPublicDevice() {
|
||||
testRestClient.setDevicePublic(device.getId());
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
assertIsDisable(devicePage.assignBtnVisible(deviceName));
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Assign several devices by btn on the top")
|
||||
public void assignSeveralDevices() {
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.assignSelectedDevices(deviceName, device1.getName());
|
||||
assignDeviceTab.assignOnCustomer(customerName);
|
||||
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
||||
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
||||
.as("Customer added correctly").isEqualTo(customerName);
|
||||
assertThat(devicePage.deviceCustomerOnPage(device1.getName()).getText())
|
||||
.as("Customer added correctly").isEqualTo(customerName);
|
||||
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.manageCustomersDevicesBtn(customerName).click();
|
||||
List.of(deviceName, device1.getName()).
|
||||
forEach(d -> assertIsDisplayed(devicePage.device(d)));
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@ import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.annotations.Test;
|
||||
import org.thingsboard.server.common.data.Device;
|
||||
import org.thingsboard.server.msa.ui.pages.ProfilesPageElements;
|
||||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -39,8 +40,8 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.addBtn().click();
|
||||
devicePage.refreshBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.entity(deviceName));
|
||||
@ -53,9 +54,9 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.enterDescription(deviceName);
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.enterDescription(deviceName);
|
||||
createDeviceTab.addBtn().click();
|
||||
devicePage.refreshBtn().click();
|
||||
devicePage.entity(deviceName).click();
|
||||
devicePage.setHeaderName();
|
||||
@ -70,8 +71,8 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
public void createDeviceWithoutName() {
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.nameField().click();
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.nameField().click();
|
||||
createDeviceTab.addBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.addDeviceView());
|
||||
assertThat(devicePage.errorMessage().getText()).as("Text of warning message").isEqualTo(NAME_IS_REQUIRED_MESSAGE);
|
||||
@ -82,8 +83,8 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
public void createDeviceWithOnlySpace() {
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(" ");
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(" ");
|
||||
createDeviceTab.addBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.warningMessage());
|
||||
assertThat(devicePage.warningMessage().getText()).as("Text of warning message").isEqualTo(EMPTY_DEVICE_MESSAGE);
|
||||
@ -98,8 +99,8 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.addBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.warningMessage());
|
||||
assertThat(devicePage.warningMessage().getText()).as("Text of warning message").isEqualTo(SAME_NAME_WARNING_DEVICE_MESSAGE);
|
||||
@ -113,8 +114,8 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.addBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.entity(deviceName));
|
||||
}
|
||||
@ -126,9 +127,9 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.clearProfileFieldBtn().click();
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.clearProfileFieldBtn().click();
|
||||
createDeviceTab.addBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.errorMessage());
|
||||
assertThat(devicePage.errorMessage().getText()).as("Text of warning message").isEqualTo(DEVICE_PROFILE_IS_REQUIRED_MESSAGE);
|
||||
@ -142,9 +143,9 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.checkboxGatewayCreate().click();
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.checkboxGateway().click();
|
||||
createDeviceTab.addBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.device(deviceName));
|
||||
assertIsDisplayed(devicePage.checkboxGatewayPage(deviceName));
|
||||
@ -157,10 +158,10 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.checkboxGatewayCreate().click();
|
||||
devicePage.checkboxOverwriteActivityTimeCreate().click();
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.checkboxGateway().click();
|
||||
createDeviceTab.checkboxOverwriteActivityTime().click();
|
||||
createDeviceTab.addBtn().click();
|
||||
devicePage.device(deviceName).click();
|
||||
|
||||
assertThat(devicePage.checkboxOverwriteActivityTimeDetails().getAttribute("class").contains("selected"))
|
||||
@ -175,9 +176,9 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.enterLabel(deviceLabel);
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.enterLabel(deviceLabel);
|
||||
createDeviceTab.addBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.deviceLabelOnPage(deviceName));
|
||||
assertThat(devicePage.deviceLabelOnPage(deviceName).getText()).as("Label added correctly").isEqualTo(deviceLabel);
|
||||
@ -191,9 +192,9 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
devicePage.enterName(deviceName);
|
||||
devicePage.assignOnCustomer(customer);
|
||||
devicePage.addBtnC().click();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.assignOnCustomer(customer);
|
||||
createDeviceTab.addBtn().click();
|
||||
|
||||
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
||||
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
||||
@ -211,4 +212,42 @@ public class CreateDeviceTest extends AbstractDeviceTest {
|
||||
|
||||
assertThat(urlContains(urlPath)).as("Redirected URL contains " + urlPath).isTrue();
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Create new device profile from create device")
|
||||
public void createNewDeviceProfile() {
|
||||
ProfilesPageElements profilesPage = new ProfilesPageElements(driver);
|
||||
deviceName = ENTITY_NAME + random();
|
||||
deviceProfileTitle = ENTITY_NAME + random();
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.createNewDeviceProfile(deviceProfileTitle);
|
||||
createDeviceTab.addBtn().click();
|
||||
devicePage.refreshBtn().click();
|
||||
String deviceProfileColumn = devicePage.deviceDeviceProfileOnPage(deviceName).getText();
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
|
||||
assertThat(deviceProfileColumn).as("Profile changed correctly").isEqualTo(deviceProfileTitle);
|
||||
assertIsDisplayed(profilesPage.entity(deviceProfileTitle));
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@Description("Add device with changed device profile (from default to another)")
|
||||
public void createDeviceWithChangedProfile() {
|
||||
deviceName = ENTITY_NAME + random();
|
||||
deviceProfileTitle = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(deviceProfileTitle));
|
||||
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.openCreateDeviceView();
|
||||
createDeviceTab.enterName(deviceName);
|
||||
createDeviceTab.changeDeviceProfile(deviceProfileTitle);
|
||||
createDeviceTab.addBtn().click();
|
||||
devicePage.refreshBtn().click();
|
||||
|
||||
assertThat(devicePage.deviceDeviceProfileOnPage(deviceName).getText())
|
||||
.as("Profile changed correctly").isEqualTo(deviceProfileTitle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,8 @@ import org.testng.annotations.Test;
|
||||
import org.thingsboard.server.common.data.Device;
|
||||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
|
||||
|
||||
@ -51,11 +53,11 @@ public class DeleteSeveralDevicesTest extends AbstractDeviceTest {
|
||||
"that appears at the top")
|
||||
public void deleteSeveralDevicesByTopBtn() {
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.deleteSelected(2);
|
||||
devicePage.deleteSelectedDevices(deviceName1, deviceName2);
|
||||
devicePage.refreshBtn().click();
|
||||
|
||||
devicePage.assertEntityIsNotPresent(deviceName1);
|
||||
devicePage.assertEntityIsNotPresent(deviceName2);
|
||||
List.of(deviceName1, deviceName2)
|
||||
.forEach(d -> devicePage.assertEntityIsNotPresent(d));
|
||||
}
|
||||
|
||||
@Test(groups = "smoke")
|
||||
@ -76,9 +78,9 @@ public class DeleteSeveralDevicesTest extends AbstractDeviceTest {
|
||||
"that appears at the top without refresh")
|
||||
public void deleteSeveralWithoutRefresh() {
|
||||
sideBarMenuView.goToDevicesPage();
|
||||
devicePage.deleteSelected(2);
|
||||
devicePage.deleteSelectedDevices(deviceName1, deviceName2);
|
||||
|
||||
devicePage.assertEntityIsNotPresent(deviceName1);
|
||||
devicePage.assertEntityIsNotPresent(deviceName2);
|
||||
List.of(deviceName1, deviceName2)
|
||||
.forEach(d -> devicePage.assertEntityIsNotPresent(d));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user