add new cases; add Epic, Feature, Description; add delete entity methods, refactoring
This commit is contained in:
parent
0483306c83
commit
957c5b74d7
@ -30,7 +30,6 @@ import org.thingsboard.server.common.data.Customer;
|
|||||||
import org.thingsboard.server.common.data.Device;
|
import org.thingsboard.server.common.data.Device;
|
||||||
import org.thingsboard.server.common.data.DeviceProfile;
|
import org.thingsboard.server.common.data.DeviceProfile;
|
||||||
import org.thingsboard.server.common.data.EntityView;
|
import org.thingsboard.server.common.data.EntityView;
|
||||||
import org.thingsboard.server.common.data.Tenant;
|
|
||||||
import org.thingsboard.server.common.data.User;
|
import org.thingsboard.server.common.data.User;
|
||||||
import org.thingsboard.server.common.data.alarm.Alarm;
|
import org.thingsboard.server.common.data.alarm.Alarm;
|
||||||
import org.thingsboard.server.common.data.asset.Asset;
|
import org.thingsboard.server.common.data.asset.Asset;
|
||||||
|
|||||||
@ -39,6 +39,11 @@ import org.testng.annotations.BeforeMethod;
|
|||||||
import org.thingsboard.server.common.data.Customer;
|
import org.thingsboard.server.common.data.Customer;
|
||||||
import org.thingsboard.server.common.data.DeviceProfile;
|
import org.thingsboard.server.common.data.DeviceProfile;
|
||||||
import org.thingsboard.server.common.data.asset.AssetProfile;
|
import org.thingsboard.server.common.data.asset.AssetProfile;
|
||||||
|
import org.thingsboard.server.common.data.id.AlarmId;
|
||||||
|
import org.thingsboard.server.common.data.id.AssetId;
|
||||||
|
import org.thingsboard.server.common.data.id.CustomerId;
|
||||||
|
import org.thingsboard.server.common.data.id.DeviceId;
|
||||||
|
import org.thingsboard.server.common.data.id.EntityViewId;
|
||||||
import org.thingsboard.server.common.data.page.PageLink;
|
import org.thingsboard.server.common.data.page.PageLink;
|
||||||
import org.thingsboard.server.common.data.rule.RuleChain;
|
import org.thingsboard.server.common.data.rule.RuleChain;
|
||||||
import org.thingsboard.server.msa.AbstractContainerTest;
|
import org.thingsboard.server.msa.AbstractContainerTest;
|
||||||
@ -221,4 +226,40 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
|||||||
getWebStorage().getLocalStorage().clear();
|
getWebStorage().getLocalStorage().clear();
|
||||||
getWebStorage().getSessionStorage().clear();
|
getWebStorage().getSessionStorage().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteAlarmById(AlarmId alarmId) {
|
||||||
|
if (alarmId != null) {
|
||||||
|
testRestClient.deleteAlarm(alarmId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAlarmsByIds(AlarmId... alarmIds) {
|
||||||
|
for (AlarmId alarmId : alarmIds) {
|
||||||
|
deleteAlarmById(alarmId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteCustomerById(CustomerId customerId) {
|
||||||
|
if (customerId != null) {
|
||||||
|
testRestClient.deleteCustomer(customerId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteDeviceById(DeviceId deviceId) {
|
||||||
|
if (deviceId != null) {
|
||||||
|
testRestClient.deleteDevice(deviceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAssetById(AssetId assetId) {
|
||||||
|
if (assetId != null) {
|
||||||
|
testRestClient.deleteAsset(assetId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteEntityView(EntityViewId entityViewId) {
|
||||||
|
if (entityViewId != null) {
|
||||||
|
testRestClient.deleteEntityView(entityViewId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class AlarmDetailsEntityTabElements extends OtherPageElements {
|
|||||||
private static final String ASSIGN_USER_DISPLAY_NAME = "//span[@class='user-display-name'][contains(text(),'%s')]";
|
private static final String ASSIGN_USER_DISPLAY_NAME = "//span[@class='user-display-name'][contains(text(),'%s')]";
|
||||||
private static final String SEARCH_FIELD = "//input[@placeholder='Search users']";
|
private static final String SEARCH_FIELD = "//input[@placeholder='Search users']";
|
||||||
private static final String UNASSIGNED_BTN = "//div[@role='listbox']//mat-icon[text() = 'account_circle']/following-sibling::span";
|
private static final String UNASSIGNED_BTN = "//div[@role='listbox']//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 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";
|
private static final String ALARM_ASSIGNEE_DROPDOWN = "//tb-alarm-assignee-panel";
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.msa.ui.tests.assignee;
|
package org.thingsboard.server.msa.ui.tests.assignee;
|
||||||
|
|
||||||
|
import io.qameta.allure.Epic;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.AfterMethod;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
@ -34,6 +35,7 @@ import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
|||||||
|
|
||||||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random;
|
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random;
|
||||||
|
|
||||||
|
@Epic("Alarm assign")
|
||||||
abstract public class AbstractAssignTest extends AbstractDriverBaseTest {
|
abstract public class AbstractAssignTest extends AbstractDriverBaseTest {
|
||||||
|
|
||||||
protected AlarmId alarmId;
|
protected AlarmId alarmId;
|
||||||
@ -42,7 +44,6 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest {
|
|||||||
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 userName;
|
||||||
protected String customerTitle;
|
protected String customerTitle;
|
||||||
@ -50,7 +51,6 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest {
|
|||||||
protected String userWithNameEmail;
|
protected String userWithNameEmail;
|
||||||
protected String alarmType;
|
protected String alarmType;
|
||||||
protected String assignedAlarmType;
|
protected String assignedAlarmType;
|
||||||
|
|
||||||
protected SideBarMenuViewHelper sideBarMenuView;
|
protected SideBarMenuViewHelper sideBarMenuView;
|
||||||
protected AlarmDetailsEntityTabHelper alarmPage;
|
protected AlarmDetailsEntityTabHelper alarmPage;
|
||||||
protected DevicePageHelper devicePage;
|
protected DevicePageHelper devicePage;
|
||||||
@ -82,8 +82,8 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest {
|
|||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public void deleteCommonEntities() {
|
public void deleteCommonEntities() {
|
||||||
testRestClient.deleteCustomer(customerId);
|
deleteCustomerById(customerId);
|
||||||
testRestClient.deleteDevice(deviceId);
|
deleteDeviceById(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
@ -94,8 +94,7 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest {
|
|||||||
|
|
||||||
@AfterMethod
|
@AfterMethod
|
||||||
public void deleteCommonCreatedAlarms() {
|
public void deleteCommonCreatedAlarms() {
|
||||||
testRestClient.deleteAlarm(alarmId);
|
deleteAlarmsByIds(alarmId, assignedAlarmId);
|
||||||
testRestClient.deleteAlarm(assignedAlarmId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loginByUser(String userEmail) {
|
public void loginByUser(String userEmail) {
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.msa.ui.tests.assignee;
|
package org.thingsboard.server.msa.ui.tests.assignee;
|
||||||
|
|
||||||
|
import io.qameta.allure.Description;
|
||||||
|
import io.qameta.allure.Feature;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.AfterMethod;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
@ -32,6 +34,7 @@ import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
|||||||
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;
|
||||||
|
|
||||||
|
@Feature("Assign from details tab of entity (by tenant)")
|
||||||
public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
||||||
|
|
||||||
private AssetId assetId;
|
private AssetId assetId;
|
||||||
@ -41,7 +44,6 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
private AlarmId assetAlarmId;
|
private AlarmId assetAlarmId;
|
||||||
private AlarmId entityViewAlarmId;
|
private AlarmId entityViewAlarmId;
|
||||||
private EntityViewId entityViewId;
|
private EntityViewId entityViewId;
|
||||||
|
|
||||||
private String assetName;
|
private String assetName;
|
||||||
private String entityViewName;
|
private String entityViewName;
|
||||||
private String propagateAlarmType;
|
private String propagateAlarmType;
|
||||||
@ -49,7 +51,6 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
private String customerAlarmType;
|
private String customerAlarmType;
|
||||||
private String assetAlarmType;
|
private String assetAlarmType;
|
||||||
private String entityViewAlarmType;
|
private String entityViewAlarmType;
|
||||||
|
|
||||||
private AssetPageHelper assetPage;
|
private AssetPageHelper assetPage;
|
||||||
private EntityViewPageHelper entityViewPage;
|
private EntityViewPageHelper entityViewPage;
|
||||||
|
|
||||||
@ -81,17 +82,16 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public void deleteTestEntities() {
|
public void deleteTestEntities() {
|
||||||
testRestClient.deleteAlarm(customerAlarmId);
|
deleteAlarmById(customerAlarmId);
|
||||||
testRestClient.deleteAlarm(assetAlarmId);
|
deleteAlarmById(assetAlarmId);
|
||||||
testRestClient.deleteAlarm(entityViewAlarmId);
|
deleteAlarmById(entityViewAlarmId);
|
||||||
testRestClient.deleteAsset(assetId);
|
deleteAssetById(assetId);
|
||||||
testRestClient.deleteEntityView(entityViewId);
|
deleteEntityView(entityViewId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterMethod
|
@AfterMethod
|
||||||
public void deleteTestAlarms() {
|
public void deleteTestAlarms() {
|
||||||
testRestClient.deleteAlarm(propageteAlarmId);
|
deleteAlarmsByIds(propageteAlarmId, propageteAssigneAlarmId);
|
||||||
testRestClient.deleteAlarm(propageteAssigneAlarmId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataProvider
|
@DataProvider
|
||||||
@ -108,6 +108,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
{propagateAssignedAlarmType}};
|
{propagateAssignedAlarmType}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Can assign alarm to yourself/Can assign propagate alarm to yourself")
|
||||||
@Test(dataProvider = "alarms")
|
@Test(dataProvider = "alarms")
|
||||||
public void assignAlarmToYourself(String alarm) {
|
public void assignAlarmToYourself(String alarm) {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -117,6 +118,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Can assign alarm to another user/Can assign propagate alarm to another user")
|
||||||
@Test(dataProvider = "alarms")
|
@Test(dataProvider = "alarms")
|
||||||
public void assignAlarmToAnotherUser(String alarm) {
|
public void assignAlarmToAnotherUser(String alarm) {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -126,6 +128,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(userEmail));
|
assertIsDisplayed(alarmPage.assignedUser(userEmail));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Can unassign alarm/Can unassign propagate alarm")
|
||||||
@Test(dataProvider = "assignedAlarms")
|
@Test(dataProvider = "assignedAlarms")
|
||||||
public void unassignedAlarm(String assignedAlarm) {
|
public void unassignedAlarm(String assignedAlarm) {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -135,6 +138,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.unassigned(assignedAlarm));
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Can reassign alarm to another user/Can reassign propagate alarm to another user")
|
||||||
@Test(dataProvider = "assignedAlarms")
|
@Test(dataProvider = "assignedAlarms")
|
||||||
public void reassignAlarm(String assignedAlarm) {
|
public void reassignAlarm(String assignedAlarm) {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -144,6 +148,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Search by email")
|
||||||
@Test
|
@Test
|
||||||
public void searchByEmail() {
|
public void searchByEmail() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -155,6 +160,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
alarmPage.assignUsers().forEach(this::assertIsDisplayed);
|
alarmPage.assignUsers().forEach(this::assertIsDisplayed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Search by name")
|
||||||
@Test(groups = "broken")
|
@Test(groups = "broken")
|
||||||
public void searchByName() {
|
public void searchByName() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -166,6 +172,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
alarmPage.assignUsers().forEach(this::assertIsDisplayed);
|
alarmPage.assignUsers().forEach(this::assertIsDisplayed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Assign alarm to yourself from details of alarm")
|
||||||
@Test
|
@Test
|
||||||
public void assignAlarmToYourselfFromDetails() {
|
public void assignAlarmToYourselfFromDetails() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -177,6 +184,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Assign alarm to another user from details of alarm")
|
||||||
@Test
|
@Test
|
||||||
public void assignAlarmToAnotherUserFromDetails() {
|
public void assignAlarmToAnotherUserFromDetails() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -188,6 +196,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(userEmail));
|
assertIsDisplayed(alarmPage.assignedUser(userEmail));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Unassign alarm from details of alarm")
|
||||||
@Test
|
@Test
|
||||||
public void unassignedAlarmFromDetails() {
|
public void unassignedAlarmFromDetails() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -199,6 +208,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Reassign alarm to another user from details of alarm")
|
||||||
@Test
|
@Test
|
||||||
public void reassignAlarmFromDetails() {
|
public void reassignAlarmFromDetails() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -210,6 +220,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Assign alarm to yourself for Customer entity details")
|
||||||
@Test
|
@Test
|
||||||
public void assignCustomerAlarmToYourself() {
|
public void assignCustomerAlarmToYourself() {
|
||||||
sideBarMenuView.customerBtn().click();
|
sideBarMenuView.customerBtn().click();
|
||||||
@ -219,6 +230,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Assign alarm to yourself for Asset details")
|
||||||
@Test
|
@Test
|
||||||
public void assignAssetAlarmToYourself() {
|
public void assignAssetAlarmToYourself() {
|
||||||
sideBarMenuView.goToAssetsPage();
|
sideBarMenuView.goToAssetsPage();
|
||||||
@ -228,6 +240,7 @@ public class AssignDetailsTabAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Assign alarm to yourself for Entity view details")
|
||||||
@Test
|
@Test
|
||||||
public void assignEntityViewsAlarmToYourself() {
|
public void assignEntityViewsAlarmToYourself() {
|
||||||
sideBarMenuView.goToEntityViewsPage();
|
sideBarMenuView.goToEntityViewsPage();
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.msa.ui.tests.assignee;
|
package org.thingsboard.server.msa.ui.tests.assignee;
|
||||||
|
|
||||||
|
import io.qameta.allure.Description;
|
||||||
|
import io.qameta.allure.Feature;
|
||||||
import org.testng.annotations.AfterMethod;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@ -26,13 +28,14 @@ import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
|
|||||||
|
|
||||||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random;
|
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random;
|
||||||
|
|
||||||
|
@Feature("Assign from details tab of entity (by customer)")
|
||||||
public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
||||||
|
|
||||||
private AlarmId tenantAlarmId;
|
private AlarmId tenantAlarmId;
|
||||||
private DeviceId tenantDeviceId;
|
private DeviceId tenantDeviceId;
|
||||||
private String tenantDeviceName;
|
private String tenantDeviceName;
|
||||||
|
|
||||||
private String tenantAlarmType;
|
private String tenantAlarmType;
|
||||||
|
private AlarmId assignedTenantAlarmId;
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void generateTenantEntity() {
|
public void generateTenantEntity() {
|
||||||
@ -48,11 +51,12 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
|
|
||||||
@AfterMethod
|
@AfterMethod
|
||||||
public void deleteTenantEntity() {
|
public void deleteTenantEntity() {
|
||||||
testRestClient.deleteAlarm(tenantAlarmId);
|
deleteAlarmsByIds(tenantAlarmId, assignedTenantAlarmId);
|
||||||
testRestClient.deleteDevice(tenantDeviceId);
|
deleteDeviceById(tenantDeviceId);
|
||||||
clearStorage();
|
clearStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Can assign alarm to yourself")
|
||||||
@Test
|
@Test
|
||||||
public void assignAlarmToYourselfCustomer() {
|
public void assignAlarmToYourselfCustomer() {
|
||||||
loginByUser(userEmail);
|
loginByUser(userEmail);
|
||||||
@ -63,6 +67,7 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(userEmail));
|
assertIsDisplayed(alarmPage.assignedUser(userEmail));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Can reassign alarm from himself to another customer user")
|
||||||
@Test
|
@Test
|
||||||
public void reassignAlarmByCustomerFromAnotherCustomerUser() {
|
public void reassignAlarmByCustomerFromAnotherCustomerUser() {
|
||||||
loginByUser(userWithNameEmail);
|
loginByUser(userWithNameEmail);
|
||||||
@ -73,18 +78,9 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(userName));
|
assertIsDisplayed(alarmPage.assignedUser(userName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Can unassign alarm from himself")
|
||||||
@Test
|
@Test
|
||||||
public void unassignedAlarmFromCustomer() {
|
public void unassignedAlarmFromCustomer() {
|
||||||
loginByUser(userWithNameEmail);
|
|
||||||
sideBarMenuView.goToDevicesPage();
|
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
|
||||||
alarmPage.unassignedAlarm(assignedAlarmType);
|
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void unassignedAlarmFromAnotherUserFromCustomer() {
|
|
||||||
loginByUser(userEmail);
|
loginByUser(userEmail);
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
devicePage.openDeviceAlarms(deviceName);
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
@ -93,6 +89,36 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Unassign alarm from any other customer user")
|
||||||
|
@Test
|
||||||
|
public void unassignedAlarmFromAnotherUserFromCustomer() {
|
||||||
|
loginByUser(userWithNameEmail);
|
||||||
|
sideBarMenuView.goToDevicesPage();
|
||||||
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
|
alarmPage.unassignedAlarm(assignedAlarmType);
|
||||||
|
|
||||||
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Description("Unassign alarm from any tenant user")
|
||||||
|
@Test
|
||||||
|
public void unassignedAlarmFromTenant() {
|
||||||
|
String assignedTenantAlarmType = "Test tenant assigned alarm " + random();
|
||||||
|
assignedTenantAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, assignedTenantAlarmType)).getId();
|
||||||
|
|
||||||
|
sideBarMenuView.goToDevicesPage();
|
||||||
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
|
alarmPage.assignAlarmTo(assignedTenantAlarmType, Const.TENANT_EMAIL);
|
||||||
|
devicePage.closeDeviceDetailsViewBtn().click();
|
||||||
|
loginByUser(userWithNameEmail);
|
||||||
|
sideBarMenuView.goToDevicesPage();
|
||||||
|
devicePage.openDeviceAlarms(deviceName);
|
||||||
|
alarmPage.unassignedAlarm(assignedTenantAlarmType);
|
||||||
|
|
||||||
|
assertIsDisplayed(alarmPage.unassigned(assignedTenantAlarmType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Description("Check the display of names (emails)")
|
||||||
@Test
|
@Test
|
||||||
public void checkTheDisplayOfNamesEmailsFromCustomer() {
|
public void checkTheDisplayOfNamesEmailsFromCustomer() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -108,6 +134,7 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Description("Check the reassign tenant for old alarm on device")
|
||||||
@Test
|
@Test
|
||||||
public void reassignTenantForOldAlarm() {
|
public void reassignTenantForOldAlarm() {
|
||||||
sideBarMenuView.goToDevicesPage();
|
sideBarMenuView.goToDevicesPage();
|
||||||
@ -121,6 +148,24 @@ public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest {
|
|||||||
devicePage.openDeviceAlarms(tenantDeviceName);
|
devicePage.openDeviceAlarms(tenantDeviceName);
|
||||||
jsClick(alarmPage.assignBtn(tenantAlarmType));
|
jsClick(alarmPage.assignBtn(tenantAlarmType));
|
||||||
|
|
||||||
|
assertIsDisplayed(alarmPage.accessForbiddenDialogView());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Description("Check the reassign tenant for old alarm on device")
|
||||||
|
@Test
|
||||||
|
public void reassignTenantForOldAlarmFromDetails() {
|
||||||
|
sideBarMenuView.goToDevicesPage();
|
||||||
|
devicePage.openDeviceAlarms(tenantDeviceName);
|
||||||
|
alarmPage.assignAlarmTo(tenantAlarmType, Const.TENANT_EMAIL);
|
||||||
|
devicePage.closeDeviceDetailsViewBtn().click();
|
||||||
|
devicePage.assignToCustomerBtn(tenantDeviceName).click();
|
||||||
|
devicePage.assignToCustomer(customerTitle);
|
||||||
|
loginByUser(userEmail);
|
||||||
|
sideBarMenuView.goToDevicesPage();
|
||||||
|
devicePage.openDeviceAlarms(tenantDeviceName);
|
||||||
|
alarmPage.alarmDetailsBtn(tenantAlarmType).click();
|
||||||
|
|
||||||
|
|
||||||
assertIsDisplayed(alarmPage.accessForbiddenDialogView());
|
assertIsDisplayed(alarmPage.accessForbiddenDialogView());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,11 +36,8 @@ import org.thingsboard.server.common.data.device.profile.DisabledDeviceProfilePr
|
|||||||
import org.thingsboard.server.common.data.id.CustomerId;
|
import org.thingsboard.server.common.data.id.CustomerId;
|
||||||
import org.thingsboard.server.common.data.id.EntityId;
|
import org.thingsboard.server.common.data.id.EntityId;
|
||||||
import org.thingsboard.server.common.data.id.UserId;
|
import org.thingsboard.server.common.data.id.UserId;
|
||||||
import org.thingsboard.server.common.data.notification.targets.platform.CustomerUsersFilter;
|
|
||||||
import org.thingsboard.server.common.data.rule.RuleChain;
|
import org.thingsboard.server.common.data.rule.RuleChain;
|
||||||
import org.thingsboard.server.common.data.security.Authority;
|
import org.thingsboard.server.common.data.security.Authority;
|
||||||
import org.thingsboard.server.common.data.security.UserCredentials;
|
|
||||||
import org.thingsboard.server.common.data.settings.UserSettings;
|
|
||||||
|
|
||||||
public class EntityPrototypes {
|
public class EntityPrototypes {
|
||||||
|
|
||||||
@ -179,14 +176,14 @@ public class EntityPrototypes {
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Device defaultDevicePrototype(String name){
|
public static Device defaultDevicePrototype(String name) {
|
||||||
Device device = new Device();
|
Device device = new Device();
|
||||||
device.setName(name + RandomStringUtils.randomAlphanumeric(7));
|
device.setName(name + RandomStringUtils.randomAlphanumeric(7));
|
||||||
device.setType("DEFAULT");
|
device.setType("DEFAULT");
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Device defaultDevicePrototype(String name, CustomerId id){
|
public static Device defaultDevicePrototype(String name, CustomerId id) {
|
||||||
Device device = new Device();
|
Device device = new Device();
|
||||||
device.setName(name + RandomStringUtils.randomAlphanumeric(7));
|
device.setName(name + RandomStringUtils.randomAlphanumeric(7));
|
||||||
device.setCustomerId(id);
|
device.setCustomerId(id);
|
||||||
@ -194,7 +191,7 @@ public class EntityPrototypes {
|
|||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Asset defaultAssetPrototype(String name, CustomerId id){
|
public static Asset defaultAssetPrototype(String name, CustomerId id) {
|
||||||
Asset asset = new Asset();
|
Asset asset = new Asset();
|
||||||
asset.setName(name + RandomStringUtils.randomAlphanumeric(7));
|
asset.setName(name + RandomStringUtils.randomAlphanumeric(7));
|
||||||
asset.setCustomerId(id);
|
asset.setCustomerId(id);
|
||||||
@ -202,7 +199,7 @@ public class EntityPrototypes {
|
|||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityView defaultEntityViewPrototype(String name, String type, String entityType){
|
public static EntityView defaultEntityViewPrototype(String name, String type, String entityType) {
|
||||||
EntityView entityView = new EntityView();
|
EntityView entityView = new EntityView();
|
||||||
entityView.setName(name + RandomStringUtils.randomAlphanumeric(7));
|
entityView.setName(name + RandomStringUtils.randomAlphanumeric(7));
|
||||||
entityView.setType(type + RandomStringUtils.randomAlphanumeric(7));
|
entityView.setType(type + RandomStringUtils.randomAlphanumeric(7));
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Copyright © 2016-2023 The Thingsboard Authors
|
Copyright © 2016-2023 The Thingsboard Authors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -28,9 +28,8 @@
|
|||||||
<exclude name="broken"/>
|
<exclude name="broken"/>
|
||||||
</run>
|
</run>
|
||||||
</groups>
|
</groups>
|
||||||
<classes>
|
<packages>
|
||||||
<class name="org.thingsboard.server.msa.ui.tests.assignee.AssignDetailsTabAssignTest"/>
|
<package name="org.thingsboard.server.msa.ui.tests.assignee.*"/>
|
||||||
<class name="org.thingsboard.server.msa.ui.tests.assignee.AssignDetailsTabFromCustomerAssignTest"/>
|
</packages>
|
||||||
</classes>
|
|
||||||
</test>
|
</test>
|
||||||
</suite>
|
</suite>
|
||||||
Loading…
x
Reference in New Issue
Block a user