|
|
|
@ -1,15 +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.tests.assignee; |
|
|
|
|
|
|
|
import org.openqa.selenium.WebElement; |
|
|
|
import org.testng.annotations.AfterClass; |
|
|
|
import org.testng.annotations.AfterMethod; |
|
|
|
import org.testng.annotations.BeforeClass; |
|
|
|
import org.testng.annotations.BeforeMethod; |
|
|
|
import org.testng.annotations.DataProvider; |
|
|
|
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.TenantId; |
|
|
|
import org.thingsboard.server.common.data.id.EntityViewId; |
|
|
|
import org.thingsboard.server.common.data.id.UserId; |
|
|
|
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|
|
|
import org.thingsboard.server.msa.ui.pages.AlarmDetailsViewHelper; |
|
|
|
@ -20,8 +35,6 @@ import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|
|
|
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|
|
|
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|
|
|
|
|
|
|
abstract public class AbstractAssignTest extends AbstractDriverBaseTest { |
|
|
|
@ -30,13 +43,19 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest { |
|
|
|
protected AlarmId assignedAlarmId; |
|
|
|
protected AlarmId propageteAlarmId; |
|
|
|
protected AlarmId propageteAssigneAlarmId; |
|
|
|
protected AlarmId tenantAssigneAlarmId; |
|
|
|
protected AlarmId tenantAlarmId; |
|
|
|
protected AlarmId onCustomerAlarmId; |
|
|
|
protected AlarmId assetAlarmId; |
|
|
|
protected AlarmId entityViewAlarmId; |
|
|
|
protected DeviceId deviceId; |
|
|
|
protected DeviceId tenantDeviceId; |
|
|
|
protected UserId userId; |
|
|
|
protected UserId userWithNameId; |
|
|
|
// protected TenantId tenantId = testRestClient.getTenants(pageLink).getData().get(0).getId();
|
|
|
|
protected CustomerId customerId; |
|
|
|
protected String deviceName; |
|
|
|
protected String assetName; |
|
|
|
protected String entityViewName; |
|
|
|
protected String tenantDeviceName; |
|
|
|
protected SideBarMenuViewHelper sideBarMenuView; |
|
|
|
protected AlarmHelper alarmPage; |
|
|
|
protected DevicePageHelper devicePage; |
|
|
|
@ -51,6 +70,12 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest { |
|
|
|
protected String assignedAlarm = "Test alarm 2"; |
|
|
|
protected String propagateAlarm = "Test propagated alarm 1"; |
|
|
|
protected String propagateAssignedAlarm = "Test propagated alarm 2"; |
|
|
|
protected String tenantAlarm = "Test tenant alarm"; |
|
|
|
protected String customerAlarm = "Test customer alarm"; |
|
|
|
protected String assetAlarm = "Test asset alarm"; |
|
|
|
protected String entityViewAlarm = "Test entity view alarm"; |
|
|
|
protected AssetId assetId; |
|
|
|
protected EntityViewId entityViewId; |
|
|
|
|
|
|
|
@BeforeClass |
|
|
|
public void generateTestEntities() { |
|
|
|
@ -65,7 +90,16 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest { |
|
|
|
userId = testRestClient.postUser(EntityPrototypes.defaultUser(userEmail, getCustomerByName(customerTitle).getId())).getId(); |
|
|
|
userWithNameId = testRestClient.postUser(EntityPrototypes.defaultUser(userWithNameEmail, getCustomerByName(customerTitle).getId(), name)).getId(); |
|
|
|
deviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("", customerId)).getName(); |
|
|
|
tenantDeviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("")).getName(); |
|
|
|
deviceId = testRestClient.getDeviceByName(deviceName).getId(); |
|
|
|
tenantDeviceId = testRestClient.getDeviceByName(tenantDeviceName).getId(); |
|
|
|
onCustomerAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(customerId, customerAlarm)).getId(); |
|
|
|
assetId = testRestClient.postAsset(EntityPrototypes.defaultAssetPrototype("", customerId)).getId(); |
|
|
|
assetName = testRestClient.getAssetById(assetId).getName(); |
|
|
|
assetAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(assetId, assetAlarm)).getId(); |
|
|
|
entityViewId = testRestClient.postEntityView(EntityPrototypes.defaultEntityViewPrototype("", "", "DEVICE")).getId(); |
|
|
|
entityViewName = testRestClient.getEntityViewById(entityViewId).getName(); |
|
|
|
entityViewAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(entityViewId, entityViewAlarm)).getId(); |
|
|
|
} |
|
|
|
|
|
|
|
@BeforeMethod |
|
|
|
@ -78,13 +112,18 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest { |
|
|
|
propageteAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAlarm, true)).getId(); |
|
|
|
propageteAssigneAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAssignedAlarm, userId, true)).getId(); |
|
|
|
|
|
|
|
tenantAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(tenantDeviceId, tenantAlarm)).getId(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@AfterClass |
|
|
|
public void deleteTestEntities() { |
|
|
|
testRestClient.deleteDevice(deviceId); |
|
|
|
testRestClient.deleteDevice(tenantDeviceId); |
|
|
|
testRestClient.deleteCustomer(customerId); |
|
|
|
testRestClient.deleteAlarm(onCustomerAlarmId); |
|
|
|
testRestClient.deleteAlarm(assetAlarmId); |
|
|
|
testRestClient.deleteAlarm(entityViewAlarmId); |
|
|
|
} |
|
|
|
|
|
|
|
@AfterMethod |
|
|
|
@ -93,6 +132,7 @@ abstract public class AbstractAssignTest extends AbstractDriverBaseTest { |
|
|
|
testRestClient.deleteAlarm(assignedAlarmId); |
|
|
|
testRestClient.deleteAlarm(propageteAlarmId); |
|
|
|
testRestClient.deleteAlarm(propageteAssigneAlarmId); |
|
|
|
testRestClient.deleteAlarm(tenantAlarmId); |
|
|
|
} |
|
|
|
|
|
|
|
public void loginByUser(String userEmail) { |
|
|
|
|