add Feature and Description, add test on assign several devices
This commit is contained in:
parent
c53ed73ac2
commit
253e82b6c8
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.msa.ui.tests.devicessmoke;
|
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.openqa.selenium.WebElement;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
@ -27,16 +29,20 @@ import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
|
|||||||
import org.thingsboard.server.msa.ui.tabs.AssignDeviceTabHelper;
|
import org.thingsboard.server.msa.ui.tabs.AssignDeviceTabHelper;
|
||||||
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.base.AbstractBasePage.random;
|
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random;
|
||||||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
|
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
|
||||||
|
|
||||||
|
@Feature("Assign to customer")
|
||||||
public class AssignToCustomerTest extends AbstractDeviceTest {
|
public class AssignToCustomerTest extends AbstractDeviceTest {
|
||||||
|
|
||||||
private AssignDeviceTabHelper assignDeviceTab;
|
private AssignDeviceTabHelper assignDeviceTab;
|
||||||
private CustomerPageHelper customerPage;
|
private CustomerPageHelper customerPage;
|
||||||
private CustomerId customerId;
|
private CustomerId customerId;
|
||||||
private Device device;
|
private Device device;
|
||||||
|
private Device device1;
|
||||||
private String customerName;
|
private String customerName;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
@ -46,12 +52,14 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
Customer customer = testRestClient.postCustomer(EntityPrototypes.defaultCustomerPrototype(ENTITY_NAME + random()));
|
Customer customer = testRestClient.postCustomer(EntityPrototypes.defaultCustomerPrototype(ENTITY_NAME + random()));
|
||||||
customerId = customer.getId();
|
customerId = customer.getId();
|
||||||
customerName = customer.getName();
|
customerName = customer.getName();
|
||||||
|
device1 = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("Device " + random()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public void deleteCustomer() {
|
public void deleteCustomer() {
|
||||||
deleteCustomerById(customerId);
|
deleteCustomerById(customerId);
|
||||||
deleteCustomerByName("Public");
|
deleteCustomerByName("Public");
|
||||||
|
deleteDeviceByName(device1.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
@ -60,7 +68,8 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
deviceName = device.getName();
|
deviceName = device.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = "smoke")
|
||||||
|
@Description("Assign to customer by right side of device btn")
|
||||||
public void assignToCustomerByRightSideBtn() {
|
public void assignToCustomerByRightSideBtn() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.assignBtn(deviceName).click();
|
devicePage.assignBtn(deviceName).click();
|
||||||
@ -74,7 +83,8 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
assertIsDisplayed(devicePage.device(deviceName));
|
assertIsDisplayed(devicePage.device(deviceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = "smoke")
|
||||||
|
@Description("Assign to customer by 'Assign to customer' btn on details tab")
|
||||||
public void assignToCustomerFromDetailsTab() {
|
public void assignToCustomerFromDetailsTab() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.device(deviceName).click();
|
devicePage.device(deviceName).click();
|
||||||
@ -93,7 +103,8 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
assertIsDisplayed(devicePage.device(deviceName));
|
assertIsDisplayed(devicePage.device(deviceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = "smoke")
|
||||||
|
@Description("Assign marked device by btn on the top")
|
||||||
public void assignToCustomerMarkedDevice() {
|
public void assignToCustomerMarkedDevice() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.assignMarkedDevices(deviceName);
|
devicePage.assignMarkedDevices(deviceName);
|
||||||
@ -107,7 +118,8 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
assertIsDisplayed(devicePage.device(deviceName));
|
assertIsDisplayed(devicePage.device(deviceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = "smoke")
|
||||||
|
@Description("Unassign from customer by right side of device btn")
|
||||||
public void unassignedFromCustomerByRightSideBtn() {
|
public void unassignedFromCustomerByRightSideBtn() {
|
||||||
device.setCustomerId(customerId);
|
device.setCustomerId(customerId);
|
||||||
testRestClient.postDevice("", device);
|
testRestClient.postDevice("", device);
|
||||||
@ -122,7 +134,8 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
devicePage.assertEntityIsNotPresent(deviceName);
|
devicePage.assertEntityIsNotPresent(deviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = "smoke")
|
||||||
|
@Description("Unassign from customer by 'Unassign from customer' btn on details tab")
|
||||||
public void unassignedFromCustomerFromDetailsTab() {
|
public void unassignedFromCustomerFromDetailsTab() {
|
||||||
device.setCustomerId(customerId);
|
device.setCustomerId(customerId);
|
||||||
testRestClient.postDevice("", device);
|
testRestClient.postDevice("", device);
|
||||||
@ -141,7 +154,8 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
devicePage.assertEntityIsNotPresent(deviceName);
|
devicePage.assertEntityIsNotPresent(deviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = "smoke")
|
||||||
|
@Description("Can't assign device on several customer")
|
||||||
public void assignToSeveralCustomer() {
|
public void assignToSeveralCustomer() {
|
||||||
device.setCustomerId(customerId);
|
device.setCustomerId(customerId);
|
||||||
testRestClient.postDevice("", device);
|
testRestClient.postDevice("", device);
|
||||||
@ -150,11 +164,30 @@ public class AssignToCustomerTest extends AbstractDeviceTest {
|
|||||||
assertIsDisable(devicePage.assignBtnVisible(deviceName));
|
assertIsDisable(devicePage.assignBtnVisible(deviceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = "smoke")
|
||||||
|
@Description("Can't assign public device")
|
||||||
public void assignPublicDevice() {
|
public void assignPublicDevice() {
|
||||||
testRestClient.setDevicePublic(device.getId());
|
testRestClient.setDevicePublic(device.getId());
|
||||||
|
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
assertIsDisable(devicePage.assignBtnVisible(deviceName));
|
assertIsDisable(devicePage.assignBtnVisible(deviceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(groups = "smoke")
|
||||||
|
@Description("Assign several devices by btn on the top")
|
||||||
|
public void assignSeveralDevices() {
|
||||||
|
sideBarMenuView.goToDevicesPage();
|
||||||
|
devicePage.assignMarkedDevices(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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user