Merge branch 'develop/3.5' into sparkplug-transport-proto
This commit is contained in:
commit
2c7fc09ba1
@ -36,10 +36,10 @@ public class DefaultJwtSettingsValidator implements JwtSettingsValidator {
|
||||
if (StringUtils.isEmpty(jwtSettings.getTokenIssuer())) {
|
||||
throw new DataValidationException("JWT token issuer should be specified!");
|
||||
}
|
||||
if (Optional.ofNullable(jwtSettings.getRefreshTokenExpTime()).orElse(0) <= TimeUnit.MINUTES.toSeconds(15)) {
|
||||
if (Optional.ofNullable(jwtSettings.getRefreshTokenExpTime()).orElse(0) < TimeUnit.MINUTES.toSeconds(15)) {
|
||||
throw new DataValidationException("JWT refresh token expiration time should be at least 15 minutes!");
|
||||
}
|
||||
if (Optional.ofNullable(jwtSettings.getTokenExpirationTime()).orElse(0) <= TimeUnit.MINUTES.toSeconds(1)) {
|
||||
if (Optional.ofNullable(jwtSettings.getTokenExpirationTime()).orElse(0) < TimeUnit.MINUTES.toSeconds(1)) {
|
||||
throw new DataValidationException("JWT token expiration time should be at least 1 minute!");
|
||||
}
|
||||
if (jwtSettings.getTokenExpirationTime() >= jwtSettings.getRefreshTokenExpTime()) {
|
||||
|
||||
@ -862,7 +862,10 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest {
|
||||
protected void awaitForDeviceActorToReceiveSubscription(DeviceId deviceId, FeatureType featureType, int subscriptionCount) {
|
||||
DeviceActorMessageProcessor processor = getDeviceActorProcessor(deviceId);
|
||||
Map<UUID, SessionInfo> subscriptions = (Map<UUID, SessionInfo>) ReflectionTestUtils.getField(processor, getMapName(featureType));
|
||||
Awaitility.await("Device actor received subscription command from the transport").atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> subscriptions.size() == subscriptionCount);
|
||||
Awaitility.await("Device actor received subscription command from the transport").atMost(5, TimeUnit.SECONDS).until(() -> {
|
||||
log.warn("device {}, subscriptions.size() == {}", deviceId, subscriptions.size());
|
||||
return subscriptions.size() == subscriptionCount;
|
||||
});
|
||||
}
|
||||
|
||||
protected static String getMapName(FeatureType featureType) {
|
||||
|
||||
@ -671,6 +671,7 @@ abstract public class BaseDeviceEdgeTest extends AbstractEdgeTest {
|
||||
client.setCallback(onUpdateCallback);
|
||||
|
||||
client.subscribeAndWait("v1/devices/me/attributes", MqttQoS.AT_MOST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(device.getId(), FeatureType.ATTRIBUTES, 1);
|
||||
|
||||
edgeImitator.expectResponsesAmount(1);
|
||||
|
||||
|
||||
@ -354,6 +354,8 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
|
||||
SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk());
|
||||
client.publishAndWait(attrPubTopic, CLIENT_ATTRIBUTES_PAYLOAD.getBytes());
|
||||
client.subscribeAndWait(attrSubTopic, MqttQoS.AT_MOST_ONCE);
|
||||
//RequestAttributes does not make any subscriptions in device actor
|
||||
|
||||
String update = getWsClient().waitForUpdate();
|
||||
assertThat(update).as("ws update received").isNotBlank();
|
||||
MqttTestCallback callback = new MqttTestCallback(attrSubTopic.replace("+", "1"));
|
||||
@ -383,6 +385,8 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
|
||||
doPostAsync("/api/plugins/telemetry/DEVICE/" + savedDevice.getId().getId() + "/attributes/SHARED_SCOPE", SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk());
|
||||
client.publishAndWait(attrPubTopic, getAttributesProtoPayloadBytes());
|
||||
client.subscribeAndWait(attrSubTopic, MqttQoS.AT_MOST_ONCE);
|
||||
//RequestAttributes does not make any subscriptions in device actor
|
||||
|
||||
String update = getWsClient().waitForUpdate();
|
||||
assertThat(update).as("ws update received").isNotBlank();
|
||||
MqttTestCallback callback = new MqttTestCallback(attrSubTopic.replace("+", "1"));
|
||||
@ -442,6 +446,7 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
|
||||
assertThat(update).as("ws update received").isNotBlank();
|
||||
|
||||
client.subscribeAndWait(GATEWAY_ATTRIBUTES_RESPONSE_TOPIC, MqttQoS.AT_LEAST_ONCE);
|
||||
//RequestAttributes does not make any subscriptions in device actor
|
||||
|
||||
MqttTestCallback clientAttributesCallback = new MqttTestCallback(GATEWAY_ATTRIBUTES_RESPONSE_TOPIC);
|
||||
client.setCallback(clientAttributesCallback);
|
||||
@ -495,6 +500,7 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
|
||||
assertThat(update).as("ws update received").isNotBlank();
|
||||
|
||||
client.subscribeAndWait(GATEWAY_ATTRIBUTES_RESPONSE_TOPIC, MqttQoS.AT_LEAST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(device.getId(), FeatureType.ATTRIBUTES, 1);
|
||||
|
||||
MqttTestCallback clientAttributesCallback = new MqttTestCallback(GATEWAY_ATTRIBUTES_RESPONSE_TOPIC);
|
||||
client.setCallback(clientAttributesCallback);
|
||||
|
||||
@ -223,7 +223,6 @@ public abstract class AbstractMqttServerSideRpcIntegrationTest extends AbstractM
|
||||
|
||||
MqttTestCallback callback = new MqttTestCallback(GATEWAY_RPC_TOPIC);
|
||||
client.setCallback(callback);
|
||||
client.subscribeAndWait(GATEWAY_RPC_TOPIC, MqttQoS.AT_MOST_ONCE);
|
||||
subscribeAndCheckSubscription(client, GATEWAY_RPC_TOPIC, savedDevice.getId(), FeatureType.RPC);
|
||||
|
||||
String setGpioRequest = "{\"method\": \"toggle_gpio\", \"params\": {\"pin\":1}}";
|
||||
|
||||
@ -21,6 +21,7 @@ import org.junit.Before;
|
||||
import org.thingsboard.common.util.JacksonUtil;
|
||||
import org.thingsboard.server.common.data.device.profile.MqttTopics;
|
||||
import org.thingsboard.server.common.data.id.DeviceId;
|
||||
import org.thingsboard.server.common.msg.session.FeatureType;
|
||||
import org.thingsboard.server.transport.mqtt.MqttTestConfigProperties;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.AbstractMqttV5Test;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestCallback;
|
||||
@ -104,6 +105,7 @@ public abstract class AbstractAttributesMqttV5Test extends AbstractMqttV5Test {
|
||||
MqttV5TestCallback onUpdateCallback = new MqttV5TestCallback();
|
||||
client.setCallback(onUpdateCallback);
|
||||
client.subscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC, MqttQoS.AT_MOST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 1);
|
||||
|
||||
doPostAsync("/api/plugins/telemetry/DEVICE/" + savedDevice.getId().getId() + "/attributes/SHARED_SCOPE", SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk());
|
||||
onUpdateCallback.getSubscribeLatch().await(3, TimeUnit.SECONDS);
|
||||
|
||||
@ -25,6 +25,7 @@ import org.eclipse.paho.mqttv5.common.packet.MqttReturnCode;
|
||||
import org.eclipse.paho.mqttv5.common.packet.MqttWireMessage;
|
||||
import org.junit.Assert;
|
||||
import org.thingsboard.server.common.data.device.profile.MqttTopics;
|
||||
import org.thingsboard.server.common.msg.session.FeatureType;
|
||||
import org.thingsboard.server.transport.mqtt.AbstractMqttIntegrationTest;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestCallback;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestClient;
|
||||
@ -101,6 +102,7 @@ public abstract class AbstractMqttV5ClientConnectionTest extends AbstractMqttInt
|
||||
MqttV5TestCallback onUpdateCallback = new MqttV5TestCallback();
|
||||
client.setCallback(onUpdateCallback);
|
||||
client.subscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC, MqttQoS.AT_MOST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 1);
|
||||
|
||||
String payload = "{\"sharedStr\":\"" + StringUtils.repeat("*", valueLen) + "\"}";
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ import org.eclipse.paho.mqttv5.common.packet.MqttSubAck;
|
||||
import org.eclipse.paho.mqttv5.common.packet.MqttWireMessage;
|
||||
import org.junit.Assert;
|
||||
import org.thingsboard.server.common.data.device.profile.MqttTopics;
|
||||
import org.thingsboard.server.common.msg.session.FeatureType;
|
||||
import org.thingsboard.server.transport.mqtt.AbstractMqttIntegrationTest;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestClient;
|
||||
|
||||
@ -34,6 +35,7 @@ public abstract class AbstractMqttV5ClientSubscriptionTest extends AbstractMqttI
|
||||
client.connectAndWait(accessToken);
|
||||
|
||||
IMqttToken subscriptionResult = client.subscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC, MqttQoS.AT_MOST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 1);
|
||||
|
||||
MqttWireMessage response = subscriptionResult.getResponse();
|
||||
|
||||
@ -52,6 +54,7 @@ public abstract class AbstractMqttV5ClientSubscriptionTest extends AbstractMqttI
|
||||
client.connectAndWait(accessToken);
|
||||
|
||||
IMqttToken iMqttToken = client.subscribeAndWait("wrong/topic/+", MqttQoS.AT_MOST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 0);
|
||||
Assert.assertEquals(MESSAGE_TYPE_SUBACK,iMqttToken.getResponse().getType());
|
||||
MqttSubAck subAck = (MqttSubAck) iMqttToken.getResponse();
|
||||
Assert.assertEquals(1, subAck.getReturnCodes().length);
|
||||
|
||||
@ -22,6 +22,7 @@ import org.eclipse.paho.mqttv5.common.packet.MqttUnsubAck;
|
||||
import org.eclipse.paho.mqttv5.common.packet.MqttWireMessage;
|
||||
import org.junit.Assert;
|
||||
import org.thingsboard.server.common.data.device.profile.MqttTopics;
|
||||
import org.thingsboard.server.common.msg.session.FeatureType;
|
||||
import org.thingsboard.server.transport.mqtt.AbstractMqttIntegrationTest;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestClient;
|
||||
|
||||
@ -34,6 +35,7 @@ public abstract class AbstractMqttV5ClientUnsubscribeTest extends AbstractMqttIn
|
||||
client.connectAndWait(accessToken);
|
||||
|
||||
client.subscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC, MqttQoS.AT_MOST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 1);
|
||||
IMqttToken unsubscribeResult = client.unsubscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC);
|
||||
MqttWireMessage response = unsubscribeResult.getResponse();
|
||||
Assert.assertEquals(MESSAGE_TYPE_UNSUBACK, response.getType());
|
||||
|
||||
@ -22,6 +22,7 @@ import org.eclipse.paho.mqttv5.common.MqttException;
|
||||
import org.eclipse.paho.mqttv5.common.MqttMessage;
|
||||
import org.thingsboard.common.util.JacksonUtil;
|
||||
import org.thingsboard.server.common.data.StringUtils;
|
||||
import org.thingsboard.server.common.msg.session.FeatureType;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.AbstractMqttV5Test;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestCallback;
|
||||
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestClient;
|
||||
@ -45,6 +46,7 @@ public abstract class AbstractMqttV5RpcTest extends AbstractMqttV5Test {
|
||||
MqttV5TestCallback callback = new MqttV5TestCallback(DEVICE_RPC_REQUESTS_SUB_TOPIC.replace("+", "0"));
|
||||
client.setCallback(callback);
|
||||
client.subscribeAndWait(DEVICE_RPC_REQUESTS_SUB_TOPIC, MqttQoS.AT_MOST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.RPC, 1);
|
||||
|
||||
String setGpioRequest = "{\"method\":\"setGpio\",\"params\":{\"pin\": \"23\",\"value\": 1}}";
|
||||
String result = doPostAsync("/api/rpc/oneway/" + savedDevice.getId(), setGpioRequest, String.class, status().isOk());
|
||||
@ -59,6 +61,7 @@ public abstract class AbstractMqttV5RpcTest extends AbstractMqttV5Test {
|
||||
MqttV5TestClient client = new MqttV5TestClient();
|
||||
client.connectAndWait(accessToken);
|
||||
client.subscribeAndWait(DEVICE_RPC_REQUESTS_SUB_TOPIC, MqttQoS.AT_LEAST_ONCE);
|
||||
awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.RPC, 1);
|
||||
MqttV5TestRpcCallback callback = new MqttV5TestRpcCallback(client, DEVICE_RPC_REQUESTS_SUB_TOPIC.replace("+", "0"));
|
||||
client.setCallback(callback);
|
||||
String setGpioRequest = "{\"method\":\"setGpio\",\"params\":{\"pin\": \"26\",\"value\": 1}}";
|
||||
|
||||
@ -148,6 +148,10 @@ public class DefaultAlarmQueryRepository implements AlarmQueryRepository {
|
||||
}
|
||||
EntityDataSortOrder sortOrder = pageLink.getSortOrder();
|
||||
|
||||
if (sortOrder != null && EntityKeyType.ALARM_FIELD.equals(sortOrder.getKey().getType()) && ASSIGNEE_KEY.equalsIgnoreCase(sortOrder.getKey().getKey())) {
|
||||
sortOrder = new EntityDataSortOrder(new EntityKey(EntityKeyType.ALARM_FIELD, ASSIGNEE_EMAIL_KEY), sortOrder.getDirection());
|
||||
}
|
||||
|
||||
List<EntityKey> alarmFields = new ArrayList<>();
|
||||
for (EntityKey key : query.getAlarmFields()) {
|
||||
if (EntityKeyType.ALARM_FIELD.equals(key.getType()) && ASSIGNEE_KEY.equalsIgnoreCase(key.getKey())) {
|
||||
@ -265,6 +269,8 @@ public class DefaultAlarmQueryRepository implements AlarmQueryRepository {
|
||||
}
|
||||
|
||||
if (pageLink.getAssigneeId() != null) {
|
||||
addAndIfNeeded(wherePart, addAnd);
|
||||
addAnd = true;
|
||||
ctx.addUuidParameter("assigneeId", pageLink.getAssigneeId().getId());
|
||||
wherePart.append(" a.assignee_id = :assigneeId");
|
||||
}
|
||||
|
||||
@ -267,6 +267,7 @@ public abstract class BaseAlarmServiceTest extends AbstractServiceTest {
|
||||
pageLink.setPage(0);
|
||||
pageLink.setPageSize(10);
|
||||
pageLink.setAssigneeId(tenantUser.getId());
|
||||
pageLink.setSortOrder(new EntityDataSortOrder(new EntityKey(EntityKeyType.ALARM_FIELD, "assignee")));
|
||||
|
||||
PageData<AlarmData> assignedAlarms = alarmService.findAlarmDataByQueryForEntities(tenantId, toQuery(pageLink), Collections.singletonList(created.getOriginator()));
|
||||
Assert.assertNotNull(assignedAlarms.getData());
|
||||
|
||||
@ -49,6 +49,7 @@ import java.net.URL;
|
||||
import java.time.Duration;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.thingsboard.server.msa.TestProperties.getBaseUiUrl;
|
||||
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_EMAIL;
|
||||
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_PASSWORD;
|
||||
@ -122,7 +123,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
|
||||
try {
|
||||
wait.until(ExpectedConditions.urlContains(urlPath));
|
||||
} catch (WebDriverException e) {
|
||||
log.error("This URL path is missing");
|
||||
return fail("URL not contains " + urlPath);
|
||||
}
|
||||
return driver.getCurrentUrl().contains(urlPath);
|
||||
}
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
@ -54,8 +56,10 @@ public class AssetProfileEditMenuTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Edit asset profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Change name by edit menu")
|
||||
public void changeName() {
|
||||
String name = ENTITY_NAME + random();
|
||||
String newName = "Changed" + getRandomNumber();
|
||||
@ -77,8 +81,10 @@ public class AssetProfileEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(nameAfter, newName);
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Edit asset profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Delete name and save")
|
||||
public void deleteName() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
@ -92,8 +98,10 @@ public class AssetProfileEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(profilesPage.doneBtnEditViewVisible().isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Edit asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Save only with space")
|
||||
public void saveWithOnlySpaceInName() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
@ -110,8 +118,10 @@ public class AssetProfileEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.warningMessage().getText(), EMPTY_ASSET_PROFILE_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Edit asset profile")
|
||||
@Test(priority = 30, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription")
|
||||
@Description
|
||||
@Description("Write the description and save the changes/Change the description and save the changes/Delete the description and save the changes")
|
||||
public void editDescription(String description, String newDescription, String finalDescription) {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name, description));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -55,8 +57,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Import asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import asset profile")
|
||||
public void importAssetProfile() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
profilesPage.openImportAssetProfileView();
|
||||
@ -69,8 +73,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entity(IMPORT_ASSET_PROFILE_NAME).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Import asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import txt file")
|
||||
public void importTxtFile() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.openImportDeviceProfileView();
|
||||
@ -80,8 +86,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Import asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Drop json file and delete it")
|
||||
public void addFileToImportAndRemove() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
profilesPage.openImportAssetProfileView();
|
||||
@ -93,8 +101,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entityIsNotPresent(IMPORT_ASSET_PROFILE_NAME));
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Import asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import asset profile with same name")
|
||||
public void importAssetProfileWithSameName() {
|
||||
String name = IMPORT_ASSET_PROFILE_NAME;
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
@ -111,8 +121,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_ASSET_PROFILE_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Import asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import asset profile without refresh")
|
||||
public void importAssetProfileWithoutRefresh() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
profilesPage.openImportAssetProfileView();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -52,8 +54,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Create asset profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add asset profile after specifying the name (text/numbers /special characters)")
|
||||
public void createAssetProfile() {
|
||||
String name = ENTITY_NAME + random();
|
||||
|
||||
@ -68,8 +72,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entity(name).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Create asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add asset profile after specifying the name with details")
|
||||
public void createAssetProfileWithDetails() {
|
||||
String name = ENTITY_NAME + random();
|
||||
String ruleChain = "Root Rule Chain";
|
||||
@ -103,8 +109,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(description, profilesPage.getDescription());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Create asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Create asset profile with the same name")
|
||||
public void createAssetProfileWithSameName() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
@ -122,8 +130,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.addAssetProfileView().isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Create asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add asset profile without the name")
|
||||
public void createAssetProfileWithoutName() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
profilesPage.openCreateAssetProfileView();
|
||||
@ -131,8 +141,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(profilesPage.addBtnV().isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Create asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Create asset profile only with spase in name")
|
||||
public void createAssetProfileWithOnlySpaceInName() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
profilesPage.openCreateAssetProfileView();
|
||||
@ -146,8 +158,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.addAssetProfileView().isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Create asset profile")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add asset profile after specifying the name (text/numbers /special characters) without refresh")
|
||||
public void createAssetProfileWithoutRefresh() {
|
||||
String name = ENTITY_NAME + random();
|
||||
|
||||
@ -161,8 +175,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entity(name).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Create asset profile")
|
||||
@Test(priority = 40, groups = "smoke")
|
||||
@Description
|
||||
@Description("Go to asset profile documentation page")
|
||||
public void documentation() {
|
||||
String urlPath = "docs/user-guide/asset-profiles/";
|
||||
|
||||
@ -170,6 +186,6 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
|
||||
profilesPage.profileNames().get(0).click();
|
||||
profilesPage.goToProfileHelpPage();
|
||||
|
||||
Assert.assertTrue(urlContains(urlPath));
|
||||
Assert.assertTrue(urlContains(urlPath), "URL not contains " + urlPath);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -40,8 +42,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
|
||||
profilesPage = new ProfilesPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete one asset profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the asset profile by clicking on the trash icon in the right side of asset profile")
|
||||
public void removeAssetProfile() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
@ -54,8 +58,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete one asset profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the asset profile by clicking on the 'Delete asset profile' btn in the entity view")
|
||||
public void removeAssetProfileFromView() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
@ -69,8 +75,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete one asset profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove asset profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void removeSelectedAssetProfile() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
@ -84,16 +92,20 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete one asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the default asset profile by clicking on the trash icon in the right side of asset profile")
|
||||
public void removeDefaultAssetProfile() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
|
||||
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete one asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the Default asset profile by clicking on the 'Delete asset profile' btn in the entity view")
|
||||
public void removeDefaultAssetProfileFromView() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
profilesPage.entity("default").click();
|
||||
@ -101,8 +113,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.deleteAssetProfileFromViewBtnIsNotDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete one asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the default asset profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void removeSelectedDefaultAssetProfile() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
|
||||
@ -110,8 +124,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(profilesPage.presentCheckBox("default").isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete one asset profile")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the asset profile by clicking on the trash icon in the right side of asset profile without refresh")
|
||||
public void removeAssetProfileWithoutRefresh() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -39,8 +41,10 @@ public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest {
|
||||
profilesPage = new ProfilesPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete several asset profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several asset profiles by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void canDeleteSeveralAssetProfilesByTopBtn() {
|
||||
String name1 = ENTITY_NAME + random() + "1";
|
||||
String name2 = ENTITY_NAME + random() + "2";
|
||||
@ -57,8 +61,11 @@ public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.profileIsNotPresent(name2));
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete several asset profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several asset profiles by mark all the asset profiles on the page by clicking in the topmost " +
|
||||
"checkbox and then clicking on the trash icon in the menu that appears")
|
||||
public void selectAllDAssetProfiles() {
|
||||
String name1 = ENTITY_NAME + random() + "1";
|
||||
String name2 = ENTITY_NAME + random() +"2";
|
||||
@ -75,8 +82,11 @@ public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.profileIsNotPresent(name2));
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete several asset profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the default asset profile by mark all the asset profiles on the page by clicking in the " +
|
||||
"topmost checkbox and then clicking on the trash icon in the menu that appears")
|
||||
public void removeDefaultAssetProfile() {
|
||||
sideBarMenuView.openAssetProfiles();
|
||||
profilesPage.selectAllCheckBox().click();
|
||||
@ -85,8 +95,11 @@ public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Delete several asset profile")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several asset profiles by mark in the checkbox and then click on the trash can icon in the menu " +
|
||||
"that appears at the top without refresh")
|
||||
public void deleteSeveralAssetProfilesByTopBtnWithoutRefresh() {
|
||||
String name1 = ENTITY_NAME + random() + "1";
|
||||
String name2 = ENTITY_NAME + random() + "2";
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -47,8 +49,10 @@ public class MakeAssetProfileDefaultTest extends AbstractDriverBaseTest {
|
||||
testRestClient.deleteAssetProfile(getAssetProfileByName(name).getId());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Make asset profile default")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Make asset profile default by clicking on the 'Make asset profile default' icon in the right corner")
|
||||
public void makeDeviceProfileDefaultByRightCornerBtn() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
@ -61,8 +65,10 @@ public class MakeAssetProfileDefaultTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.defaultCheckbox(name).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Make asset profile default")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Make asset profile default by clicking on the 'Make asset profile default' button in the entity view")
|
||||
public void makeDeviceProfileDefaultFromView() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -48,8 +50,11 @@ public class SearchAssetProfileTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Search asset profile")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "assetProfileSearch")
|
||||
@Description
|
||||
@Description("Search asset profile by first word in the name/Search asset profile by second word in the name/" +
|
||||
"Search asset profile by symbol in the name/Search asset profile by number in the name")
|
||||
public void searchFirstWord(String name, String namePath) {
|
||||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
|
||||
this.name = name;
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -48,8 +50,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Sort by name")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
|
||||
@Description
|
||||
@Description("Sort asset profile 'UP'")
|
||||
public void specialCharacterUp(String name) {
|
||||
testRestClient.postAssetProfile(defaultAssetProfile(name));
|
||||
this.name = name;
|
||||
@ -61,8 +65,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.getProfileName(), name);
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Sort by name")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
|
||||
@Description
|
||||
@Description("Sort asset profile 'UP'")
|
||||
public void allSortUp(String assetProfile, String assetProfileSymbol, String assetProfileNumber) {
|
||||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfileSymbol));
|
||||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfile));
|
||||
@ -86,8 +92,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(thirdAssetProfile, assetProfile);
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Sort by name")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
|
||||
@Description
|
||||
@Description("Sort asset profile 'DAWN'")
|
||||
public void specialCharacterDown(String name) {
|
||||
testRestClient.postAssetProfile(defaultAssetProfile(name));
|
||||
this.name = name;
|
||||
@ -99,8 +107,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.getProfileName(), name);
|
||||
}
|
||||
|
||||
@Epic("Asset profiles smoke")
|
||||
@Feature("Sort by name")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
|
||||
@Description
|
||||
@Description("Sort asset profile 'DOWN'")
|
||||
public void allSortDown(String assetProfile, String assetProfileSymbol, String assetProfileNumber) {
|
||||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfileSymbol));
|
||||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfile));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
@ -52,8 +54,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Create customer")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add customer specifying the name (text/numbers /special characters)")
|
||||
public void createCustomer() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
|
||||
@ -68,8 +72,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.customer(customerName).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Create customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add customer after specifying the name (text/numbers /special characters) with full information")
|
||||
public void createCustomerWithFullInformation() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
String text = "Text";
|
||||
@ -112,8 +118,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(customerPage.getCustomerCity(), text);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Create customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add customer without the name")
|
||||
public void createCustomerWithoutName() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.plusBtn().click();
|
||||
@ -121,8 +129,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(customerPage.addBtnV().isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Create customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Create customer only with spase in name")
|
||||
public void createCustomerWithOnlySpace() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.plusBtn().click();
|
||||
@ -136,8 +146,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.addEntityView().isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Create customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Create a customer with the same name")
|
||||
public void createCustomerSameName() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
@ -153,8 +165,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.addEntityView().isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Create customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add customer specifying the name (text/numbers /special characters) without refresh")
|
||||
public void createCustomerWithoutRefresh() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
|
||||
@ -168,8 +182,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.customer(customerName).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Create customer")
|
||||
@Test(priority = 40, groups = "smoke")
|
||||
@Description
|
||||
@Description("Go to customer documentation page")
|
||||
public void documentation() {
|
||||
String urlPath = "docs/user-guide/ui/customers/";
|
||||
|
||||
@ -178,6 +194,6 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
|
||||
customerPage.customer(customerPage.getCustomerName()).click();
|
||||
customerPage.goToHelpPage();
|
||||
|
||||
Assert.assertTrue(urlContains(urlPath));
|
||||
Assert.assertTrue(urlContains(urlPath), "URL contains " + urlPath);
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -68,8 +70,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Change title by edit menu")
|
||||
public void changeTitle() {
|
||||
String customerName = "Changed" + getRandomNumber();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(ENTITY_NAME + random()));
|
||||
@ -89,8 +93,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(titleAfter, customerName);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Delete title and save")
|
||||
public void deleteTitle() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.entityTitles().get(0).click();
|
||||
@ -100,8 +106,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(customerPage.doneBtnEditViewVisible().isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Save only with space in title")
|
||||
public void saveOnlyWithSpace() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
@ -117,8 +125,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(customerPage.getCustomerName(), customerPage.getHeaderName());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription")
|
||||
@Description
|
||||
@Description("Write the description and save the changes/Change the description and save the changes/Delete the description and save the changes")
|
||||
public void editDescription(String description, String newDescription, String finalDescription) {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(EntityPrototypes.defaultCustomerPrototype(name, description));
|
||||
@ -134,8 +144,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(customerPage.getDescription(), finalDescription);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Assigned dashboard from dashboards page")
|
||||
public void assignedDashboardFromDashboard() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
|
||||
@ -161,8 +173,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(customerPage.getDashboardFromView(), dashboardPage.getDashboardTitle());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Assigned dashboard")
|
||||
public void assignedDashboard() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
|
||||
@ -187,8 +201,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(customerPage.getDashboard(), customerPage.getDashboardFromView());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Assigned dashboard without hide")
|
||||
public void assignedDashboardWithoutHide() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
|
||||
@ -220,8 +236,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.timeBtn().isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add phone number")
|
||||
public void addPhoneNumber() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
|
||||
@ -237,8 +255,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.phoneNumberEntityView().getAttribute("value").contains(number));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "incorrectPhoneNumber")
|
||||
@Description
|
||||
@Description("Add incorrect phone number")
|
||||
public void addIncorrectPhoneNumber(String number) {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.entityTitles().get(0).click();
|
||||
@ -251,8 +271,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(customerPage.errorMessage().getText(), PHONE_NUMBER_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Edit customer")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add all information")
|
||||
public void addAllInformation() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -43,8 +45,10 @@ public class DeleteCustomerTest extends AbstractDriverBaseTest {
|
||||
ruleChainsPage = new RuleChainsPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Delete customer")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the customer by clicking on the trash icon in the right side of refresh")
|
||||
public void removeCustomerByRightSideBtn() {
|
||||
String customer = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customer));
|
||||
@ -56,8 +60,10 @@ public class DeleteCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.entityIsNotPresent(deletedCustomer));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Delete customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove customer by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void removeSelectedCustomer() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
|
||||
@ -69,8 +75,10 @@ public class DeleteCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedCustomer));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Delete customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the customer by clicking on the 'Delete customer' btn in the entity view")
|
||||
public void removeFromCustomerView() {
|
||||
String customerName = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
|
||||
@ -84,8 +92,10 @@ public class DeleteCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.entityIsNotPresent(customerName));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Delete customer")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the customer by clicking on the trash icon in the right side of customer without refresh")
|
||||
public void removeCustomerByRightSideBtnWithoutRefresh() {
|
||||
String customer = ENTITY_NAME + random();
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customer));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -40,8 +42,10 @@ public class DeleteSeveralCustomerTest extends AbstractDriverBaseTest {
|
||||
customerPage = new CustomerPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Delete several customer")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several customers by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void canDeleteSeveralCustomersByTopBtn() {
|
||||
String title1 = ENTITY_NAME + random() + "1";
|
||||
String title2 = ENTITY_NAME + random() + "2";
|
||||
@ -56,8 +60,11 @@ public class DeleteSeveralCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.customerIsNotPresent(title2));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Delete several customer")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several customers by mark all the Customers on the page by clicking in the topmost checkbox " +
|
||||
"and then clicking on the trash icon in the menu that appears")
|
||||
public void selectAllCustomers() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.selectAllCheckBox().click();
|
||||
@ -68,8 +75,11 @@ public class DeleteSeveralCustomerTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.warningPopUpTitle().getText().contains(String.valueOf(customerPage.markCheckbox().size())));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Delete several customer")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several customers by mark in the checkbox and then click on the trash can icon in the menu " +
|
||||
"that appears at the top without refresh")
|
||||
public void deleteSeveralCustomersByTopBtnWithoutRefresh() {
|
||||
String title1 = ENTITY_NAME + random() + "1";
|
||||
String title2 = ENTITY_NAME + random() + "2";
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -37,8 +39,10 @@ public class ManageCustomersAssetsTest extends AbstractDriverBaseTest {
|
||||
customerPage = new CustomerPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer assets")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by right corner btn")
|
||||
public void openWindowByRightCornerBtn() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
@ -50,8 +54,10 @@ public class ManageCustomersAssetsTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(manage));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer assets")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by btn in entity view")
|
||||
public void openWindowByView() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -36,8 +38,10 @@ public class ManageCustomersDashboardsTest extends AbstractDriverBaseTest {
|
||||
customerPage = new CustomerPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer dashboards")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by right corner btn")
|
||||
public void openWindowByRightCornerBtn() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
@ -49,8 +53,10 @@ public class ManageCustomersDashboardsTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(manage));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer dashboards")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by btn in entity view")
|
||||
public void openWindowByView() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -36,8 +38,10 @@ public class ManageCustomersDevicesTest extends AbstractDriverBaseTest {
|
||||
customerPage = new CustomerPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer devices")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by right corner btn")
|
||||
public void openWindowByRightCornerBtn() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
@ -49,8 +53,10 @@ public class ManageCustomersDevicesTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(manage));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer devices")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by btn in entity view")
|
||||
public void openWindowByView() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -37,8 +39,10 @@ public class ManageCustomersEdgesTest extends AbstractDriverBaseTest {
|
||||
customerPage = new CustomerPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer edges")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by right corner btn")
|
||||
public void openWindowByRightCornerBtn() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
@ -50,8 +54,10 @@ public class ManageCustomersEdgesTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(iconText));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer edges")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by btn in entity view")
|
||||
public void openWindowByView() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -37,8 +39,10 @@ public class ManageCustomersUsersTest extends AbstractDriverBaseTest {
|
||||
customerPage = new CustomerPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer users")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by right corner btn")
|
||||
public void openWindowByRightCornerBtn() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
@ -50,8 +54,10 @@ public class ManageCustomersUsersTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(iconText));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Manage customer users")
|
||||
@Test(groups = "smoke")
|
||||
@Description
|
||||
@Description("Open manage window by btn in entity view")
|
||||
public void openWindowByView() {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.setCustomerName();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -39,8 +41,10 @@ public class SearchCustomerTest extends AbstractDriverBaseTest {
|
||||
customerPage = new CustomerPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Search customer")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "customerNameForSearchByFirstAndSecondWord")
|
||||
@Description
|
||||
@Description("Search customer by first word in the name/*CHANGE TESTCASE*")
|
||||
public void searchFirstWord(String namePath) {
|
||||
sideBarMenuView.customerBtn().click();
|
||||
customerPage.searchEntity(namePath);
|
||||
@ -48,8 +52,10 @@ public class SearchCustomerTest extends AbstractDriverBaseTest {
|
||||
customerPage.allEntity().forEach(x -> Assert.assertTrue(x.getText().contains(namePath)));
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Search customer")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSearchBySymbolAndNumber")
|
||||
@Description
|
||||
@Description("Search customer by symbol in the name/Search customer by number in the name")
|
||||
public void searchNumber(String name, String namePath) {
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(name));
|
||||
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.customerSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -48,8 +50,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Sort customers by name")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
|
||||
@Description
|
||||
@Description("Sort customers 'UP'")
|
||||
public void specialCharacterUp(String title) {
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(title));
|
||||
this.customerName = title;
|
||||
@ -61,8 +65,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(customerPage.getCustomerName(), title);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Sort customers by name")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
|
||||
@Description
|
||||
@Description("Sort customers 'UP'")
|
||||
public void allSortUp(String customer, String customerSymbol, String customerNumber) {
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerSymbol));
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customer));
|
||||
@ -86,8 +92,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(thirdCustomer, customer);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Sort customers by name")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
|
||||
@Description
|
||||
@Description("Sort customers 'DOWN'")
|
||||
public void specialCharacterDown(String title) {
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(title));
|
||||
customerName = title;
|
||||
@ -99,8 +107,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(customerPage.getCustomerName(), title);
|
||||
}
|
||||
|
||||
@Epic("Customers smoke tests")
|
||||
@Feature("Sort customers by name")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
|
||||
@Description
|
||||
@Description("Sort customers 'DOWN'")
|
||||
public void allSortDown(String customer, String customerSymbol, String customerNumber) {
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customerSymbol));
|
||||
testRestClient.postCustomer(defaultCustomerPrototype(customer));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -55,8 +57,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import device profile")
|
||||
public void importDeviceProfile() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.openImportDeviceProfileView();
|
||||
@ -69,8 +73,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entity(IMPORT_DEVICE_PROFILE_NAME).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import txt file")
|
||||
public void importTxtFile() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.openImportDeviceProfileView();
|
||||
@ -80,8 +86,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Drop json file and delete it")
|
||||
public void addFileTiImportAndRemove() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.openImportDeviceProfileView();
|
||||
@ -93,8 +101,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entityIsNotPresent(IMPORT_DEVICE_PROFILE_NAME));
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import device profile with same name")
|
||||
public void importDeviceProfileWithSameName() {
|
||||
String name = IMPORT_DEVICE_PROFILE_NAME;
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
|
||||
@ -111,8 +121,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import device profile without refresh")
|
||||
public void importDeviceProfileWithoutRefresh() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.openImportDeviceProfileView();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
@ -54,8 +56,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add device profile after specifying the name (text/numbers /special characters)")
|
||||
public void createDeviceProfile() {
|
||||
String name = ENTITY_NAME + random();
|
||||
|
||||
@ -70,8 +74,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entity(name).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add device profile after specifying the name with details")
|
||||
public void createDeviceProfileWithDetails() {
|
||||
String name = ENTITY_NAME + random();
|
||||
String ruleChain = "Root Rule Chain";
|
||||
@ -105,8 +111,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(description, profilesPage.getDescription());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Create a device profile with the same name")
|
||||
public void createDeviseProfileWithSameName() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
|
||||
@ -124,8 +132,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.addDeviceProfileView().isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add device profile without the name")
|
||||
public void createDeviceProfileWithoutName() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.openCreateDeviceProfileView();
|
||||
@ -137,8 +147,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.errorMessage().getText(), NAME_IS_REQUIRED_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Create device profile only with spase in name")
|
||||
public void createDeviseProfileWithOnlySpaceInName() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.openCreateDeviceProfileView();
|
||||
@ -152,8 +164,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.addDeviceProfileView().isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add device profile after specifying the name (text/numbers /special characters) without refresh")
|
||||
public void createDeviceProfileWithoutRefresh() {
|
||||
String name = ENTITY_NAME + random();
|
||||
|
||||
@ -167,8 +181,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entity(name).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Create device profile")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Go to device profile documentation page")
|
||||
public void documentation() {
|
||||
String urlPath = "docs/user-guide/device-profiles/";
|
||||
|
||||
@ -176,7 +192,7 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
profilesPage.profileNames().get(0).click();
|
||||
profilesPage.goToProfileHelpPage();
|
||||
|
||||
Assert.assertTrue(urlContains(urlPath));
|
||||
Assert.assertTrue(urlContains(urlPath), "URL contains " + urlPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -40,8 +42,10 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
profilesPage = new ProfilesPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete one device profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the device profile by clicking on the trash icon in the right side of device profile")
|
||||
public void removeDeviceProfile() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
|
||||
@ -54,8 +58,10 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete one device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the device profile by clicking on the 'Delete device profile' btn in the entity view")
|
||||
public void removeDeviceProfileFromView() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
|
||||
@ -69,8 +75,10 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete one device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove device profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void removeSelectedDeviceProfile() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
|
||||
@ -84,16 +92,20 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete one device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the default device profile by clicking on the trash icon in the right side of device profile")
|
||||
public void removeDefaultDeviceProfile() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
|
||||
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete one device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the Default device profile by clicking on the 'Delete device profile' btn in the entity view")
|
||||
public void removeDefaultDeviceProfileFromView() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.entity("default").click();
|
||||
@ -101,17 +113,20 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.deleteDeviceProfileFromViewBtnIsNotDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete one device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the default device profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void removeSelectedDefaultDeviceProfile() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
|
||||
Assert.assertNotNull(profilesPage.presentCheckBox("default"));
|
||||
Assert.assertFalse(profilesPage.presentCheckBox("default").isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete one device profile")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the device profile by clicking on the trash icon in the right side of device profile without refresh")
|
||||
public void removeDeviceProfileWithoutRefresh() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -39,8 +41,10 @@ public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
|
||||
profilesPage = new ProfilesPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete several device profiles")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several device profiles by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void canDeleteSeveralDeviceProfilesByTopBtn() {
|
||||
String name1 = ENTITY_NAME + random() + "1";
|
||||
String name2 = ENTITY_NAME + random() + "2";
|
||||
@ -57,8 +61,10 @@ public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.profileIsNotPresent(name2));
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete several device profiles")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several device profiles by mark all the device profiles on the page by clicking in the topmost checkbox and then clicking on the trash icon in the menu that appears")
|
||||
public void selectAllDeviceProfiles() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.selectAllCheckBox().click();
|
||||
@ -69,8 +75,10 @@ public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.warningPopUpTitle().getText().contains(String.valueOf(profilesPage.markCheckbox().size())));
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete several device profiles")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the default device profile by mark all the device profiles on the page by clicking in the topmost checkbox and then clicking on the trash icon in the menu that appears")
|
||||
public void removeDefaultDeviceProfile() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.selectAllCheckBox().click();
|
||||
@ -79,8 +87,10 @@ public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Delete several device profiles")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several device profiles by mark in the checkbox and then click on the trash can icon in the menu that appears at the top without refresh")
|
||||
public void deleteSeveralDeviceProfilesByTopBtnWithoutRefresh() {
|
||||
String name1 = ENTITY_NAME + random() + "1";
|
||||
String name2 = ENTITY_NAME + random() + "2";
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
@ -54,8 +56,10 @@ public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Edit device profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Change name by edit menu")
|
||||
public void changeName() {
|
||||
String name = ENTITY_NAME + random();
|
||||
String newName = "Changed" + getRandomNumber();
|
||||
@ -77,8 +81,10 @@ public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(titleAfter, newName);
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Edit device profile")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Delete name and save")
|
||||
public void deleteName() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
|
||||
@ -92,8 +98,10 @@ public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(profilesPage.doneBtnEditViewVisible().isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Edit device profile")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Save only with space in name")
|
||||
public void saveWithOnlySpaceInName() {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
|
||||
@ -110,8 +118,10 @@ public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.warningMessage().getText(), EMPTY_DEVICE_PROFILE_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Edit device profile")
|
||||
@Test(priority = 30, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription")
|
||||
@Description
|
||||
@Description("Write the description and save the changes/Change the description and save the changes/Delete the description and save the changes")
|
||||
public void editDescription(String description, String newDescription, String finalDescription) {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name, description));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -41,8 +43,10 @@ public class MakeDeviceProfileDefaultTest extends AbstractDriverBaseTest {
|
||||
testRestClient.setDefaultDeviceProfile(getDeviceProfileByName("default").getId());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Make device profile default")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Make device profile default by clicking on the 'Make device profile default' icon in the right corner")
|
||||
public void makeDeviceProfileDefaultByRightCornerBtn() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.setProfileName();
|
||||
@ -53,8 +57,10 @@ public class MakeDeviceProfileDefaultTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(profilesPage.defaultCheckbox(profile).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Device profile smoke tests")
|
||||
@Feature("Make device profile default")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Make device profile default by clicking on the 'Make device profile default' button in the entity view")
|
||||
public void makeDeviceProfileDefaultFromView() {
|
||||
sideBarMenuView.openDeviceProfiles();
|
||||
profilesPage.setProfileName();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -49,8 +51,11 @@ public class SearchDeviceProfileTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Device profiles smoke")
|
||||
@Feature("Search device profile")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "deviceProfileSearch")
|
||||
@Description
|
||||
@Description("Search device profile by first word in the name/Search device profile by second word in the name/" +
|
||||
"Search device profile by symbol in the name/Search asset profile by number in the name")
|
||||
public void searchFirstWord(String name, String namePath) {
|
||||
testRestClient.postDeviceProfile(defaultDeviceProfile(name));
|
||||
this.name = name;
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -48,8 +50,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Device profiles smoke")
|
||||
@Feature("Sort device profile by name")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
|
||||
@Description
|
||||
@Description("Sort device profile 'UP'")
|
||||
public void specialCharacterUp(String name) {
|
||||
testRestClient.postDeviceProfile(defaultDeviceProfile(name));
|
||||
this.name = name;
|
||||
@ -61,8 +65,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.getProfileName(), name);
|
||||
}
|
||||
|
||||
@Epic("Device profiles smoke")
|
||||
@Feature("Sort device profile by name")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
|
||||
@Description
|
||||
@Description("Sort device profile 'UP'")
|
||||
public void allSortUp(String deviceProfile, String deviceProfileSymbol, String deviceProfileNumber) {
|
||||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfileSymbol));
|
||||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfile));
|
||||
@ -86,8 +92,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(thirdDeviceProfile, deviceProfile);
|
||||
}
|
||||
|
||||
@Epic("Device profiles smoke")
|
||||
@Feature("Sort device profile by name")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
|
||||
@Description
|
||||
@Description("Sort device profile 'DOWN'")
|
||||
public void specialCharacterDown(String name) {
|
||||
testRestClient.postDeviceProfile(defaultDeviceProfile(name));
|
||||
this.name = name;
|
||||
@ -99,8 +107,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(profilesPage.getProfileName(), name);
|
||||
}
|
||||
|
||||
@Epic("Device profiles smoke")
|
||||
@Feature("Sort device profile by name")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
|
||||
@Description
|
||||
@Description("Sort device profile 'DOWN'")
|
||||
public void allSortDown(String deviceProfile, String deviceProfileSymbol, String deviceProfileNumber) {
|
||||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfileSymbol));
|
||||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfile));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
@ -59,8 +61,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Import rule chain")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Drop json file")
|
||||
public void importRuleChain() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.openImportRuleChainView();
|
||||
@ -70,8 +74,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.importingFile(IMPORT_RULE_CHAIN_FILE_NAME).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Import rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Drop json file and delete it")
|
||||
public void importRuleChainAndDeleteFile() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.openImportRuleChainView();
|
||||
@ -83,8 +89,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(IMPORT_RULE_CHAIN_FILE_NAME));
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Import rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import txt file")
|
||||
public void importTxtFile() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.openImportRuleChainView();
|
||||
@ -94,8 +102,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Import rule chain")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import rule chain")
|
||||
public void importRuleChainAndSave() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.openImportRuleChainView();
|
||||
@ -103,7 +113,6 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
|
||||
ruleChainsPage.importBrowseFileBtn().click();
|
||||
WebElement doneBtn = openRuleChainPage.doneBtn();
|
||||
doneBtn.click();
|
||||
//openRuleChainPage.waitUntilBtnDisable(doneBtn);
|
||||
ruleChainName = IMPORT_RULE_CHAIN_NAME;
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
|
||||
@ -111,8 +120,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.entity(IMPORT_RULE_CHAIN_NAME).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Import rule chain")
|
||||
@Test(priority = 40, groups = "smoke")
|
||||
@Description
|
||||
@Description("Import rule chain with same name")
|
||||
public void importRuleChainAndSaveWithSameName() {
|
||||
String ruleChainName = IMPORT_RULE_CHAIN_NAME;
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
@ -124,7 +135,6 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
|
||||
ruleChainsPage.importBrowseFileBtn().click();
|
||||
WebElement doneBtn = openRuleChainPage.doneBtn();
|
||||
doneBtn.click();
|
||||
//openRuleChainPage.waitUntilBtnDisable(doneBtn);
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
|
||||
boolean entityNotNull = ruleChainsPage.entity(ruleChainName) != null;
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -53,8 +55,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Create rule chain")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add rule chain after specifying the name (text/numbers /special characters)")
|
||||
public void createRuleChain() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
|
||||
@ -70,8 +74,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.entity(ruleChainName).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Create rule chain")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add rule chain after specifying the name and description (text/numbers /special characters)")
|
||||
public void createRuleChainWithDescription() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
|
||||
@ -89,8 +95,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainsPage.descriptionEntityView().getAttribute("value"), ruleChainName);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Create rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add rule chain without the name")
|
||||
public void createRuleChainWithoutName() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.openCreateRuleChainView();
|
||||
@ -98,8 +106,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(ruleChainsPage.addBtnV().isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Create rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Create rule chain only with spase in name")
|
||||
public void createRuleChainWithOnlySpace() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.openCreateRuleChainView();
|
||||
@ -113,8 +123,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.addEntityView().isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Create rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Create a rule chain with the same name")
|
||||
public void createRuleChainWithSameName() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName));
|
||||
@ -138,8 +150,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
|
||||
entityIsDisplayed.forEach(Assert::assertTrue);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Create rule chain")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Add rule chain after specifying the name (text/numbers /special characters) without refresh")
|
||||
public void createRuleChainWithoutRefresh() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
|
||||
@ -153,8 +167,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.entity(ruleChainName).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Create rule chain")
|
||||
@Test(priority = 40, groups = "smoke")
|
||||
@Description
|
||||
@Description("Go to rule chain documentation page")
|
||||
public void documentation() {
|
||||
String urlPath = "docs/user-guide/ui/rule-chains/";
|
||||
|
||||
@ -163,6 +179,6 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
|
||||
ruleChainsPage.detailsBtn(ruleChainsPage.getRuleChainName()).click();
|
||||
ruleChainsPage.goToHelpPage();
|
||||
|
||||
Assert.assertTrue(urlContains(urlPath));
|
||||
Assert.assertTrue(urlContains(urlPath), "URL contains " + urlPath);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -41,8 +43,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
|
||||
ruleChainsPage = new RuleChainsPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the rule chain by clicking on the trash icon in the right side of rule chain")
|
||||
public void removeRuleChainByRightSideBtn() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
@ -54,8 +58,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedRuleChain));
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove rule chain by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void removeSelectedRuleChain() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
@ -67,8 +73,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedRuleChain));
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the rule chain by clicking on the 'Delete rule chain' btn in the entity view")
|
||||
public void removeFromRuleChainView() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
@ -81,34 +89,41 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedRuleChain));
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the root rule chain by clicking on the trash icon in the right side of rule chain")
|
||||
public void removeRootRuleChain() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
|
||||
Assert.assertFalse(ruleChainsPage.deleteBtn(ROOT_RULE_CHAIN_NAME).isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove root rule chain by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void removeSelectedRootRuleChain() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
|
||||
ruleChainsPage.assertCheckBoxIsNotDisplayed(ROOT_RULE_CHAIN_NAME);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the root rule chain by clicking on the 'Delete rule chain' btn in the entity view")
|
||||
public void removeFromRootRuleChainView() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.detailsBtn(ROOT_RULE_CHAIN_NAME).click();
|
||||
ruleChainsPage.deleteBtnFromView();
|
||||
|
||||
Assert.assertTrue(ruleChainsPage.deleteBtnInRootRuleChainIsNotDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the rule chain with device profile by clicking on the trash icon in the right side of rule chain")
|
||||
public void removeProfileRuleChainByRightSideBtn() {
|
||||
String deletedRuleChain = "Thermostat";
|
||||
|
||||
@ -124,8 +139,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainsPage.warningMessage().getText(), DELETE_RULE_CHAIN_WITH_PROFILE_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the rule chain with device profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
|
||||
public void removeSelectedProfileRuleChain() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
String deletedRuleChain = ruleChainsPage.deleteSelected("Thermostat");
|
||||
@ -138,8 +155,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainsPage.warningMessage().getText(), DELETE_RULE_CHAIN_WITH_PROFILE_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the rule chain with device profile by clicking on the 'Delete rule chain' btn in the entity view")
|
||||
public void removeFromProfileRuleChainView() {
|
||||
String deletedRuleChain = "Thermostat";
|
||||
|
||||
@ -154,8 +173,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainsPage.warningMessage().getText(), DELETE_RULE_CHAIN_WITH_PROFILE_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete rule chain")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the rule chain by clicking on the trash icon in the right side of rule chain without refresh")
|
||||
public void removeRuleChainByRightSideBtnWithoutRefresh() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -41,8 +43,11 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
|
||||
ruleChainsPage = new RuleChainsPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete several rule chains")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several rule chains by mark in the checkbox and then click on the trash can icon in the menu " +
|
||||
"that appears at the top")
|
||||
public void canDeleteSeveralRuleChainsByTopBtn() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
|
||||
@ -55,8 +60,11 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.ruleChainsIsNotPresent(ruleChainName));
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete several rule chains")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several rule chains by mark all the rule chains on the page by clicking in the topmost checkbox" +
|
||||
" and then clicking on the trash icon in the menu that appears")
|
||||
public void selectAllRuleChain() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
|
||||
@ -71,8 +79,11 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.ruleChainsIsNotPresent(ruleChainName));
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete several rule chains")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the root rule chain by mark in the checkbox and then click on the trash can icon in the menu " +
|
||||
"that appears at the top")
|
||||
public void removeRootRuleChain() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.selectAllCheckBox().click();
|
||||
@ -80,8 +91,11 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(ruleChainsPage.deleteBtn(ROOT_RULE_CHAIN_NAME).isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete several rule chains")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove the root rule chain by mark all the rule chains on the page by clicking in the topmost checkbox" +
|
||||
" and then clicking on the trash icon in the menu that appears")
|
||||
public void removeSelectedRootRuleChain() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.selectAllCheckBox().click();
|
||||
@ -89,8 +103,11 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
|
||||
ruleChainsPage.assertCheckBoxIsNotDisplayed(ROOT_RULE_CHAIN_NAME);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Delete several rule chains")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Remove several rule chains by mark in the checkbox and then click on the trash can icon in the menu " +
|
||||
"that appears at the top without refresh")
|
||||
public void deleteSeveralRuleChainsByTopBtnWithoutRefresh() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -42,8 +44,10 @@ public class MakeRuleChainRootTest extends AbstractDriverBaseTest {
|
||||
testRestClient.setRootRuleChain(getRuleChainByName("Root Rule Chain").getId());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Make rule chain root")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Make rule chain root by clicking on the 'Make rule chain root' icon in the right corner")
|
||||
public void makeRuleChainRootByRightCornerBtn() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.setRuleChainNameWithoutRoot(0);
|
||||
@ -54,8 +58,10 @@ public class MakeRuleChainRootTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.rootCheckBoxEnable(ruleChain).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Make rule chain root")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Make rule chain root by clicking on the 'Make rule chain root' button in the entity view")
|
||||
public void makeRuleChainRootFromView() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.setRuleChainNameWithoutRoot(0);
|
||||
@ -68,8 +74,10 @@ public class MakeRuleChainRootTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.rootCheckBoxEnable(ruleChain).isDisplayed());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Make rule chain root")
|
||||
@Test(priority = 30, groups = "smoke")
|
||||
@Description
|
||||
@Description("Make multiple root rule chains (only one rule chain can be root)")
|
||||
public void multiplyRoot() {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.setRuleChainNameWithoutRoot(0);
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -53,8 +55,10 @@ public class OpenRuleChainTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Open rule chain")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Open the rule chain by clicking on its name")
|
||||
public void openRuleChainByRightCornerBtn() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName));
|
||||
@ -70,8 +74,10 @@ public class OpenRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainName, openRuleChainPage.getHeadName());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Open rule chain")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Open the rule chain by clicking on the 'Open rule chain' button in the entity view")
|
||||
public void openRuleChainByViewBtn() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -54,8 +56,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Edit rule chain")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Change name by edit menu")
|
||||
public void changeName() {
|
||||
String newRuleChainName = "Changed" + getRandomNumber();
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
@ -77,8 +81,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(newRuleChainName, nameAfter);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Edit rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Delete name and save")
|
||||
public void deleteName() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
@ -92,8 +98,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertFalse(ruleChainsPage.doneBtnEditViewVisible().isEnabled());
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Edit rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Save only with space")
|
||||
public void saveOnlyWithSpace() {
|
||||
String ruleChainName = ENTITY_NAME +random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
@ -110,8 +118,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainsPage.warningMessage().getText(), EMPTY_RULE_CHAIN_MESSAGE);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Edit rule chain")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription")
|
||||
@Description
|
||||
@Description("Write the description and save the changes/Change the description and save the changes/Delete the description and save the changes")
|
||||
public void editDescription(String description, String newDescription, String finalDescription) {
|
||||
String name = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(name, description));
|
||||
@ -127,8 +137,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainsPage.getDescription(), finalDescription);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Edit rule chain")
|
||||
@Test(priority = 20, groups = "smoke")
|
||||
@Description
|
||||
@Description("Enable debug mode/Disable debug mode")
|
||||
public void debugMode() {
|
||||
String ruleChainName = ENTITY_NAME + random();
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -39,8 +41,10 @@ public class SearchRuleChainTest extends AbstractDriverBaseTest {
|
||||
ruleChainsPage = new RuleChainsPageHelper(driver);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Search rule chain")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "ruleChainNameForSearchByFirstAndSecondWord")
|
||||
@Description
|
||||
@Description("Search rule chain by first word in the name/Search rule chain by second word in the name")
|
||||
public void searchFirstWord(String namePath) {
|
||||
sideBarMenuView.ruleChainsBtn().click();
|
||||
ruleChainsPage.searchEntity(namePath);
|
||||
@ -49,8 +53,10 @@ public class SearchRuleChainTest extends AbstractDriverBaseTest {
|
||||
Assert.assertTrue(ruleChainsPage.getRuleChainName().contains(namePath));
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Search rule chain")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSearchBySymbolAndNumber")
|
||||
@Description
|
||||
@Description("Search rule chain by symbol in the name/Search rule chain by number in the name")
|
||||
public void searchNumber(String name, String namePath) {
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(name));
|
||||
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -49,8 +51,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Sort rule chain by name")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
|
||||
@Description
|
||||
@Description("Sort rule chain 'UP'")
|
||||
public void specialCharacterUp(String ruleChainName) {
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
this.ruleChainName = ruleChainName;
|
||||
@ -62,8 +66,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainsPage.getRuleChainName(), ruleChainName);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Sort rule chain by name")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
|
||||
@Description
|
||||
@Description("Sort rule chain 'UP'")
|
||||
public void allSortUp(String ruleChain, String ruleChainSymbol, String ruleChainNumber) {
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainSymbol));
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
|
||||
@ -87,8 +93,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(thirdRuleChain, ruleChain);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Sort rule chain by name")
|
||||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
|
||||
@Description
|
||||
@Description("Sort rule chain 'DOWN'")
|
||||
public void specialCharacterDown(String ruleChainName) {
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
|
||||
this.ruleChainName = ruleChainName;
|
||||
@ -100,8 +108,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
|
||||
Assert.assertEquals(ruleChainsPage.getRuleChainName(), ruleChainName);
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Sort rule chain by name")
|
||||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
|
||||
@Description
|
||||
@Description("Sort rule chain 'DOWN'")
|
||||
public void allSortDown(String ruleChain, String ruleChainSymbol, String ruleChainNumber) {
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainSymbol));
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Epic;
|
||||
import io.qameta.allure.Feature;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -49,8 +51,10 @@ public class SortByTimeTest extends AbstractDriverBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Sort rule chain by time")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Sort rule chain 'DOWN'")
|
||||
public void sortByTimeDown() {
|
||||
String ruleChain = ENTITY_NAME;
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
|
||||
@ -65,8 +69,10 @@ public class SortByTimeTest extends AbstractDriverBaseTest {
|
||||
Assert.assertNotNull(ruleChainsPage.createdTimeEntity(ruleChain, lastCreated));
|
||||
}
|
||||
|
||||
@Epic("Rule chains smoke tests")
|
||||
@Feature("Sort rule chain by time")
|
||||
@Test(priority = 10, groups = "smoke")
|
||||
@Description
|
||||
@Description("Sort rule chain 'UP'")
|
||||
public void sortByTimeUp() {
|
||||
String ruleChain = ENTITY_NAME;
|
||||
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
|
||||
|
||||
6
pom.xml
6
pom.xml
@ -67,6 +67,7 @@
|
||||
<jackson.version>2.13.4</jackson.version>
|
||||
<jackson-databind.version>2.13.4.2</jackson-databind.version>
|
||||
<fasterxml-classmate.version>1.3.4</fasterxml-classmate.version>
|
||||
<auth0-jwt.version>4.2.1</auth0-jwt.version>
|
||||
<json-schema-validator.version>2.2.6</json-schema-validator.version>
|
||||
<californium.version>3.0.0</californium.version>
|
||||
<leshan.version>2.0.0-M5</leshan.version>
|
||||
@ -1429,6 +1430,11 @@
|
||||
<artifactId>classmate</artifactId>
|
||||
<version>${fasterxml-classmate.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>${auth0-jwt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.fge</groupId>
|
||||
<artifactId>json-schema-validator</artifactId>
|
||||
|
||||
@ -47,6 +47,10 @@
|
||||
<groupId>org.thingsboard.common</groupId>
|
||||
<artifactId>util</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.thingsboard.rest.client;
|
||||
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
@ -28,9 +29,6 @@ import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.http.client.support.HttpRequestWrapper;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
@ -161,7 +159,6 @@ import org.thingsboard.server.common.data.widget.WidgetTypeInfo;
|
||||
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -171,6 +168,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.thingsboard.server.common.data.StringUtils.isEmpty;
|
||||
@ -178,40 +176,50 @@ import static org.thingsboard.server.common.data.StringUtils.isEmpty;
|
||||
/**
|
||||
* @author Andrew Shvayka
|
||||
*/
|
||||
public class RestClient implements ClientHttpRequestInterceptor, Closeable {
|
||||
public class RestClient implements Closeable {
|
||||
private static final String JWT_TOKEN_HEADER_PARAM = "X-Authorization";
|
||||
protected final RestTemplate restTemplate;
|
||||
protected final String baseURL;
|
||||
private String token;
|
||||
private String refreshToken;
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private ExecutorService service = ThingsBoardExecutors.newWorkStealingPool(10, getClass());
|
||||
|
||||
private static final long AVG_REQUEST_TIMEOUT = TimeUnit.SECONDS.toMillis(30);
|
||||
protected static final String ACTIVATE_TOKEN_REGEX = "/api/noauth/activate?activateToken=";
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private final ExecutorService service = ThingsBoardExecutors.newWorkStealingPool(10, getClass());
|
||||
protected final RestTemplate restTemplate;
|
||||
protected final RestTemplate loginRestTemplate;
|
||||
protected final String baseURL;
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
private String mainToken;
|
||||
private String refreshToken;
|
||||
private long mainTokenExpTs;
|
||||
private long refreshTokenExpTs;
|
||||
private long clientServerTimeDiff;
|
||||
|
||||
public RestClient(String baseURL) {
|
||||
this(new RestTemplate(), baseURL);
|
||||
}
|
||||
|
||||
public RestClient(RestTemplate restTemplate, String baseURL) {
|
||||
this.restTemplate = restTemplate;
|
||||
this.loginRestTemplate = new RestTemplate(restTemplate.getRequestFactory());
|
||||
this.baseURL = baseURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientHttpResponse intercept(HttpRequest request, byte[] bytes, ClientHttpRequestExecution execution) throws IOException {
|
||||
HttpRequest wrapper = new HttpRequestWrapper(request);
|
||||
wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
|
||||
ClientHttpResponse response = execution.execute(wrapper, bytes);
|
||||
if (response.getStatusCode() == HttpStatus.UNAUTHORIZED) {
|
||||
synchronized (this) {
|
||||
restTemplate.getInterceptors().remove(this);
|
||||
refreshToken();
|
||||
wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
|
||||
return execution.execute(wrapper, bytes);
|
||||
this.restTemplate.getInterceptors().add((request, bytes, execution) -> {
|
||||
HttpRequest wrapper = new HttpRequestWrapper(request);
|
||||
long calculatedTs = System.currentTimeMillis() + clientServerTimeDiff + AVG_REQUEST_TIMEOUT;
|
||||
if (calculatedTs > mainTokenExpTs) {
|
||||
synchronized (RestClient.this) {
|
||||
if (calculatedTs > mainTokenExpTs) {
|
||||
if (calculatedTs < refreshTokenExpTs) {
|
||||
refreshToken();
|
||||
} else {
|
||||
doLogin();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return response;
|
||||
wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + mainToken);
|
||||
return execution.execute(wrapper, bytes);
|
||||
});
|
||||
}
|
||||
|
||||
public RestTemplate getRestTemplate() {
|
||||
@ -219,7 +227,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
return mainToken;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
@ -229,22 +237,32 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
|
||||
public void refreshToken() {
|
||||
Map<String, String> refreshTokenRequest = new HashMap<>();
|
||||
refreshTokenRequest.put("refreshToken", refreshToken);
|
||||
ResponseEntity<JsonNode> tokenInfo = restTemplate.postForEntity(baseURL + "/api/auth/token", refreshTokenRequest, JsonNode.class);
|
||||
setTokenInfo(tokenInfo.getBody());
|
||||
long ts = System.currentTimeMillis();
|
||||
ResponseEntity<JsonNode> tokenInfo = loginRestTemplate.postForEntity(baseURL + "/api/auth/token", refreshTokenRequest, JsonNode.class);
|
||||
setTokenInfo(ts, tokenInfo.getBody());
|
||||
}
|
||||
|
||||
public void login(String username, String password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
doLogin();
|
||||
}
|
||||
|
||||
private void doLogin() {
|
||||
long ts = System.currentTimeMillis();
|
||||
Map<String, String> loginRequest = new HashMap<>();
|
||||
loginRequest.put("username", username);
|
||||
loginRequest.put("password", password);
|
||||
ResponseEntity<JsonNode> tokenInfo = restTemplate.postForEntity(baseURL + "/api/auth/login", loginRequest, JsonNode.class);
|
||||
setTokenInfo(tokenInfo.getBody());
|
||||
ResponseEntity<JsonNode> tokenInfo = loginRestTemplate.postForEntity(baseURL + "/api/auth/login", loginRequest, JsonNode.class);
|
||||
setTokenInfo(ts, tokenInfo.getBody());
|
||||
}
|
||||
|
||||
private void setTokenInfo(JsonNode tokenInfo) {
|
||||
this.token = tokenInfo.get("token").asText();
|
||||
private synchronized void setTokenInfo(long ts, JsonNode tokenInfo) {
|
||||
this.mainToken = tokenInfo.get("token").asText();
|
||||
this.refreshToken = tokenInfo.get("refreshToken").asText();
|
||||
restTemplate.getInterceptors().add(this);
|
||||
this.mainTokenExpTs = JWT.decode(this.mainToken).getExpiresAtAsInstant().toEpochMilli();
|
||||
this.refreshTokenExpTs = JWT.decode(refreshToken).getExpiresAtAsInstant().toEpochMilli();
|
||||
this.clientServerTimeDiff = JWT.decode(this.mainToken).getIssuedAtAsInstant().toEpochMilli() - ts;
|
||||
}
|
||||
|
||||
public Optional<AdminSettings> getAdminSettings(String key) {
|
||||
@ -3553,9 +3571,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (service != null) {
|
||||
service.shutdown();
|
||||
}
|
||||
service.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,6 +32,8 @@ import org.thingsboard.server.common.data.plugin.ComponentType;
|
||||
import org.thingsboard.server.common.data.script.ScriptLanguage;
|
||||
import org.thingsboard.server.common.msg.TbMsg;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@RuleNode(
|
||||
type = ComponentType.ACTION,
|
||||
@ -54,8 +56,12 @@ public class TbLogNode implements TbNode {
|
||||
@Override
|
||||
public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException {
|
||||
this.config = TbNodeUtils.convert(configuration, TbLogNodeConfiguration.class);
|
||||
this.standard = new TbLogNodeConfiguration().defaultConfiguration().getJsScript().equals(config.getJsScript());
|
||||
this.scriptEngine = this.standard ? null : ctx.createScriptEngine(config.getScriptLang(),
|
||||
this.standard = isStandard(config);
|
||||
this.scriptEngine = this.standard ? null : createScriptEngine(ctx, config);
|
||||
}
|
||||
|
||||
ScriptEngine createScriptEngine(TbContext ctx, TbLogNodeConfiguration config) {
|
||||
return ctx.createScriptEngine(config.getScriptLang(),
|
||||
ScriptLanguage.TBEL.equals(config.getScriptLang()) ? config.getTbelScript() : config.getJsScript());
|
||||
}
|
||||
|
||||
@ -83,6 +89,18 @@ public class TbLogNode implements TbNode {
|
||||
}, MoreExecutors.directExecutor()); //usually js responses runs on js callback executor
|
||||
}
|
||||
|
||||
boolean isStandard(TbLogNodeConfiguration conf) {
|
||||
Objects.requireNonNull(conf, "node config is null");
|
||||
final TbLogNodeConfiguration defaultConfig = new TbLogNodeConfiguration().defaultConfiguration();
|
||||
switch (conf.getScriptLang()) {
|
||||
case JS: return defaultConfig.getJsScript().equals(conf.getJsScript());
|
||||
case TBEL: return defaultConfig.getTbelScript().equals(conf.getTbelScript());
|
||||
default:
|
||||
log.warn("No rule to define isStandard script for script language [{}], assuming that is non-standard", conf.getScriptLang());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void logStandard(TbContext ctx, TbMsg msg) {
|
||||
log.info(toLogMessage(msg));
|
||||
ctx.tellSuccess(msg);
|
||||
|
||||
@ -17,14 +17,29 @@ package org.thingsboard.rule.engine.action;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
import org.thingsboard.common.util.JacksonUtil;
|
||||
import org.thingsboard.rule.engine.api.TbContext;
|
||||
import org.thingsboard.rule.engine.api.TbNodeConfiguration;
|
||||
import org.thingsboard.rule.engine.api.TbNodeException;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.script.ScriptLanguage;
|
||||
import org.thingsboard.server.common.msg.TbMsg;
|
||||
import org.thingsboard.server.common.msg.TbMsgMetaData;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
||||
@Slf4j
|
||||
public class TbLogNodeTest {
|
||||
@ -61,6 +76,7 @@ public class TbLogNodeTest {
|
||||
"Incoming metadata:\n" +
|
||||
"{}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenNullDataMsg_whenToLog_thenReturnString() {
|
||||
TbLogNode node = new TbLogNode();
|
||||
@ -77,4 +93,50 @@ public class TbLogNodeTest {
|
||||
"{}");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@EnumSource(ScriptLanguage.class)
|
||||
void givenDefaultConfig_whenIsStandardForEachScriptLanguage_thenTrue(ScriptLanguage scriptLanguage) throws TbNodeException {
|
||||
|
||||
TbLogNodeConfiguration config = new TbLogNodeConfiguration().defaultConfiguration();
|
||||
config.setScriptLang(scriptLanguage);
|
||||
TbLogNode node = spy(new TbLogNode());
|
||||
TbNodeConfiguration tbNodeConfiguration = new TbNodeConfiguration(JacksonUtil.valueToTree(config));
|
||||
TbContext ctx = mock(TbContext.class);
|
||||
node.init(ctx, tbNodeConfiguration);
|
||||
|
||||
assertThat(node.isStandard(config)).as("Script is standard for language " + scriptLanguage).isTrue();
|
||||
verify(node, never()).createScriptEngine(any(), any());
|
||||
verify(ctx, never()).createScriptEngine(any(), anyString());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenScriptEngineEnum_whenNewAdded_thenFailed() {
|
||||
assertThat(ScriptLanguage.values().length).as("only two ScriptLanguage supported").isEqualTo(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenScriptEngineLangJs_whenCreateScriptEngine_thenSupplyJsScript(){
|
||||
TbLogNodeConfiguration configJs = new TbLogNodeConfiguration().defaultConfiguration();
|
||||
configJs.setScriptLang(ScriptLanguage.JS);
|
||||
configJs.setJsScript(configJs.getJsScript() + " // This is JS script " + UUID.randomUUID());
|
||||
TbLogNode node = new TbLogNode();
|
||||
TbContext ctx = mock(TbContext.class);
|
||||
node.createScriptEngine(ctx, configJs);
|
||||
verify(ctx).createScriptEngine(ScriptLanguage.JS, configJs.getJsScript());
|
||||
verifyNoMoreInteractions(ctx);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenScriptEngineLangTbel_whenCreateScriptEngine_thenSupplyTbelScript(){
|
||||
TbLogNodeConfiguration configTbel = new TbLogNodeConfiguration().defaultConfiguration();
|
||||
configTbel.setScriptLang(ScriptLanguage.TBEL);
|
||||
configTbel.setTbelScript(configTbel.getTbelScript() + " // This is TBEL script " + UUID.randomUUID());
|
||||
TbLogNode node = new TbLogNode();
|
||||
TbContext ctx = mock(TbContext.class);
|
||||
node.createScriptEngine(ctx, configTbel);
|
||||
verify(ctx).createScriptEngine(ScriptLanguage.TBEL, configTbel.getTbelScript());
|
||||
verifyNoMoreInteractions(ctx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user