refactoring tests on delete several devices
This commit is contained in:
parent
253e82b6c8
commit
9a057f2995
@ -85,10 +85,20 @@ public class DevicePageHelper extends DevicePageElements {
|
|||||||
warningPopUpYesBtn().click();
|
warningPopUpYesBtn().click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assignMarkedDevices(String... deviceNames) {
|
public void selectDevices(String... deviceNames) {
|
||||||
for (String deviceName : deviceNames) {
|
for (String deviceName : deviceNames) {
|
||||||
checkBox(deviceName).click();
|
checkBox(deviceName).click();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assignSelectedDevices(String... deviceNames) {
|
||||||
|
selectDevices(deviceNames);
|
||||||
assignMarkedDeviceBtn().click();
|
assignMarkedDeviceBtn().click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteSelectedDevices(String... deviceNames) {
|
||||||
|
selectDevices(deviceNames);
|
||||||
|
deleteSelectedBtn().click();
|
||||||
|
warningPopUpYesBtn().click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,7 +107,7 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
@Description("Assign marked device by btn on the top")
|
@Description("Assign marked device by btn on the top")
|
||||||
public void assignToCustomerMarkedDevice() {
|
public void assignToCustomerMarkedDevice() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.assignMarkedDevices(deviceName);
|
devicePage.assignSelectedDevices(deviceName);
|
||||||
assignDeviceTab.assignOnCustomer(customerName);
|
assignDeviceTab.assignOnCustomer(customerName);
|
||||||
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
||||||
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
||||||
@ -177,7 +177,7 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
@Description("Assign several devices by btn on the top")
|
@Description("Assign several devices by btn on the top")
|
||||||
public void assignSeveralDevices() {
|
public void assignSeveralDevices() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.assignMarkedDevices(deviceName, device1.getName());
|
devicePage.assignSelectedDevices(deviceName, device1.getName());
|
||||||
assignDeviceTab.assignOnCustomer(customerName);
|
assignDeviceTab.assignOnCustomer(customerName);
|
||||||
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
assertIsDisplayed(devicePage.deviceCustomerOnPage(deviceName));
|
||||||
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
assertThat(devicePage.deviceCustomerOnPage(deviceName).getText())
|
||||||
|
|||||||
@ -23,6 +23,8 @@ import org.testng.annotations.Test;
|
|||||||
import org.thingsboard.server.common.data.Device;
|
import org.thingsboard.server.common.data.Device;
|
||||||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
|
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")
|
"that appears at the top")
|
||||||
public void deleteSeveralDevicesByTopBtn() {
|
public void deleteSeveralDevicesByTopBtn() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.deleteSelected(2);
|
devicePage.deleteSelectedDevices(deviceName1, deviceName2);
|
||||||
devicePage.refreshBtn().click();
|
devicePage.refreshBtn().click();
|
||||||
|
|
||||||
devicePage.assertEntityIsNotPresent(deviceName1);
|
List.of(deviceName1, deviceName2)
|
||||||
devicePage.assertEntityIsNotPresent(deviceName2);
|
.forEach(d -> devicePage.assertEntityIsNotPresent(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = "smoke")
|
@Test(groups = "smoke")
|
||||||
@ -76,9 +78,9 @@ public class DeleteSeveralDevicesTest extends AbstractDeviceTest {
|
|||||||
"that appears at the top without refresh")
|
"that appears at the top without refresh")
|
||||||
public void deleteSeveralWithoutRefresh() {
|
public void deleteSeveralWithoutRefresh() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.deleteSelected(2);
|
devicePage.deleteSelectedDevices(deviceName1, deviceName2);
|
||||||
|
|
||||||
devicePage.assertEntityIsNotPresent(deviceName1);
|
List.of(deviceName1, deviceName2)
|
||||||
devicePage.assertEntityIsNotPresent(deviceName2);
|
.forEach(d -> devicePage.assertEntityIsNotPresent(d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user