Browse Source

add ui tests

pull/7746/head
Serafym Tuhai 4 years ago
parent
commit
843e6ee87c
  1. 80
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/TestRestClient.java
  2. 2
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/connectivity/MqttClientTest.java
  3. 42
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractBasePage.java
  4. 60
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractDiverBaseTest.java
  5. 17
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/listeners/RetryAnalyzer.java
  6. 17
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/listeners/RetryTestListener.java
  7. 31
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/listeners/TestListener.java
  8. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageElements.java
  9. 50
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageHelper.java
  10. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DashboardPageElements.java
  11. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DashboardPageHelper.java
  12. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/LoginPageElements.java
  13. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/LoginPageHelper.java
  14. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageElements.java
  15. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageHelper.java
  16. 20
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java
  17. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElementsHelper.java
  18. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/RuleChainsPageElements.java
  19. 94
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/RuleChainsPageHelper.java
  20. 21
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/SideBarMenuViewElements.java
  21. 56
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java
  22. 105
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java
  23. 54
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteCustomerTest.java
  24. 57
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteSeveralCustomerTest.java
  25. 31
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersAssetsTest.java
  26. 31
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDashboardsTest.java
  27. 31
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDevicesTest.java
  28. 33
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersEdgesTest.java
  29. 33
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersUsersTest.java
  30. 50
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SearchCustomerTest.java
  31. 65
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SortByNameTest.java
  32. 65
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainImportTest.java
  33. 74
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainTest.java
  34. 65
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteRuleChainTest.java
  35. 56
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteSeveralRuleChainsTest.java
  36. 41
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/MakeRuleChainRootTest.java
  37. 46
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/OpenRuleChainTest.java
  38. 54
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/RuleChainEditMenuTest.java
  39. 39
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SearchRuleChainTest.java
  40. 62
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByNameTest.java
  41. 38
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByTimeTest.java
  42. 21
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/Const.java
  43. 21
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/DataProviderCredential.java
  44. 17
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/EntityPrototypes.java
  45. 27
      msa/black-box-tests/src/test/resources/connectivity.xml
  46. 16
      msa/black-box-tests/src/test/resources/forImport.txt
  47. 6
      msa/black-box-tests/src/test/resources/smokeTests.xml
  48. 2
      msa/black-box-tests/src/test/resources/smokesCustomer.xml
  49. 2
      msa/black-box-tests/src/test/resources/smokesRuleChain.xml
  50. 10
      msa/black-box-tests/src/test/resources/testNG.xml
  51. 2
      msa/pom.xml

80
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/TestRestClient.java

@ -26,7 +26,9 @@ import io.restassured.http.ContentType;
import io.restassured.path.json.JsonPath;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.Device;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.DeviceId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.RuleChainId;
@ -76,7 +78,7 @@ public class TestRestClient {
loginRequest.put("password", password);
JsonPath jsonPath = given().spec(requestSpec).body(loginRequest)
.post( "/api/auth/login")
.post("/api/auth/login")
.getBody().jsonPath();
token = jsonPath.get("token");
refreshToken = jsonPath.get("refreshToken");
@ -84,7 +86,7 @@ public class TestRestClient {
}
public Device postDevice(String accessToken, Device device) {
return given().spec(requestSpec).body(device)
return given().spec(requestSpec).body(device)
.pathParams("accessToken", accessToken)
.post("/api/device?accessToken={accessToken}")
.then()
@ -94,62 +96,65 @@ public class TestRestClient {
}
public ValidatableResponse getDeviceById(DeviceId deviceId, int statusCode) {
return given().spec(requestSpec)
return given().spec(requestSpec)
.pathParams("deviceId", deviceId.getId())
.get("/api/device/{deviceId}")
.then()
.statusCode(statusCode);
}
public Device getDeviceById(DeviceId deviceId) {
return getDeviceById(deviceId, HTTP_OK)
return getDeviceById(deviceId, HTTP_OK)
.extract()
.as(Device.class);
}
public DeviceCredentials getDeviceCredentialsByDeviceId(DeviceId deviceId) {
return given().spec(requestSpec).get("/api/device/{deviceId}/credentials", deviceId.getId())
.then()
.assertThat()
.statusCode(HTTP_OK)
.extract()
.as(DeviceCredentials.class);
.then()
.assertThat()
.statusCode(HTTP_OK)
.extract()
.as(DeviceCredentials.class);
}
public ValidatableResponse postTelemetry(String credentialsId, JsonNode telemetry) {
return given().spec(requestSpec).body(telemetry)
.post("/api/v1/{credentialsId}/telemetry", credentialsId)
.then()
.statusCode(HTTP_OK);
return given().spec(requestSpec).body(telemetry)
.post("/api/v1/{credentialsId}/telemetry", credentialsId)
.then()
.statusCode(HTTP_OK);
}
public ValidatableResponse deleteDevice(DeviceId deviceId) {
return given().spec(requestSpec)
return given().spec(requestSpec)
.delete("/api/device/{deviceId}", deviceId.getId())
.then()
.statusCode(HTTP_OK);
}
public ValidatableResponse deleteDeviceIfExists(DeviceId deviceId) {
return given().spec(requestSpec)
return given().spec(requestSpec)
.delete("/api/device/{deviceId}", deviceId.getId())
.then()
.statusCode(anyOf(is(HTTP_OK),is(HTTP_NOT_FOUND)));
.statusCode(anyOf(is(HTTP_OK), is(HTTP_NOT_FOUND)));
}
public ValidatableResponse postTelemetryAttribute(String entityType, DeviceId deviceId, String scope, JsonNode attribute) {
return given().spec(requestSpec).body(attribute)
return given().spec(requestSpec).body(attribute)
.post("/api/plugins/telemetry/{entityType}/{entityId}/attributes/{scope}", entityType, deviceId.getId(), scope)
.then()
.statusCode(HTTP_OK);
}
public ValidatableResponse postAttribute(String accessToken, JsonNode attribute) {
return given().spec(requestSpec).body(attribute)
return given().spec(requestSpec).body(attribute)
.post("/api/v1/{accessToken}/attributes/", accessToken)
.then()
.statusCode(HTTP_OK);
}
public JsonNode getAttributes(String accessToken, String clientKeys, String sharedKeys) {
return given().spec(requestSpec)
return given().spec(requestSpec)
.queryParam("clientKeys", clientKeys)
.queryParam("sharedKeys", sharedKeys)
.get("/api/v1/{accessToken}/attributes", accessToken)
@ -167,10 +172,11 @@ public class TestRestClient {
.then()
.statusCode(HTTP_OK)
.extract()
.as(new TypeRef<PageData<RuleChain>>() {});
.as(new TypeRef<PageData<RuleChain>>() {
});
}
public RuleChain postRootRuleChain(RuleChain ruleChain) {
public RuleChain postRuleChain(RuleChain ruleChain) {
return given().spec(requestSpec)
.body(ruleChain)
.post("/api/ruleChain")
@ -239,7 +245,8 @@ public class TestRestClient {
.then()
.statusCode(HTTP_OK)
.extract()
.as(new TypeRef<List<EntityRelation>>() {});
.as(new TypeRef<List<EntityRelation>>() {
});
}
public JsonNode postServerSideRpc(DeviceId deviceId, JsonNode serverRpcPayload) {
@ -252,6 +259,35 @@ public class TestRestClient {
.as(JsonNode.class);
}
public Customer postCustomer(Customer customer) {
return given().spec(requestSpec)
.body(customer)
.post("/api/customer")
.then()
.statusCode(HTTP_OK)
.extract()
.as(Customer.class);
}
public void deleteCustomer(CustomerId customerId) {
given().spec(requestSpec)
.delete("/api/customer/{customerId}", customerId.getId())
.then()
.statusCode(HTTP_OK);
}
public PageData<Customer> getCustomers(PageLink pageLink) {
Map<String, String> params = new HashMap<>();
addPageLinkToParam(params, pageLink);
return given().spec(requestSpec).queryParams(params)
.get("/api/customers")
.then()
.statusCode(HTTP_OK)
.extract()
.as(new TypeRef<PageData<Customer>>() {
});
}
public String getToken() {
return token;
}

2
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/connectivity/MqttClientTest.java

@ -326,7 +326,7 @@ public class MqttClientTest extends AbstractContainerTest {
RuleChain newRuleChain = new RuleChain();
newRuleChain.setName("testRuleChain");
RuleChain ruleChain = testRestClient.postRootRuleChain(newRuleChain);
RuleChain ruleChain = testRestClient.postRuleChain(newRuleChain);
JsonNode configuration = mapper.readTree(this.getClass().getClassLoader().getResourceAsStream("RpcResponseRuleChainMetadata.json"));
RuleChainMetaData ruleChainMetaData = new RuleChainMetaData();

42
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractBasePage.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.base;
import lombok.SneakyThrows;
@ -9,33 +24,22 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.thingsboard.rest.client.RestClient;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.msa.ui.utils.Const;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@Slf4j
abstract public class BasePage extends Base {
abstract public class AbstractBasePage {
protected WebDriver driver;
protected WebDriverWait wait;
protected Actions actions;
protected RestClient client;
protected PageLink pageLink;
public BasePage(WebDriver driver) {
public AbstractBasePage(WebDriver driver) {
this.driver = driver;
this.wait = new WebDriverWait(driver, Duration.ofMillis(5000));
this.actions = new Actions(driver);
try {
client = new RestClient(Const.URL);
client.login(Const.TENANT_EMAIL, Const.TENANT_PASSWORD);
pageLink = new PageLink(10);
} catch (Exception e) {
log.info("Can't login");
}
}
@SneakyThrows
@ -126,4 +130,14 @@ abstract public class BasePage extends Base {
ArrayList<String> tabs = new ArrayList<>(driver.getWindowHandles());
driver.switchTo().window(tabs.get(tabNumber - 1));
}
public static long getRandomNumber() {
return System.currentTimeMillis();
}
public static char getRandomSymbol() {
Random rand = new Random();
String s = "~`!@#$^&*()_+=-";
return s.charAt(rand.nextInt(s.length()));
}
}

60
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractDiverBaseTest.java

@ -1,10 +1,27 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.base;
import com.google.common.io.Files;
import io.github.bonigarcia.wdm.WebDriverManager;
import io.qameta.allure.Attachment;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
@ -12,20 +29,27 @@ import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Listeners;
import org.thingsboard.server.msa.TestListener;
import org.thingsboard.server.msa.ui.listeners.RetryTestListener;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.rule.RuleChain;
import org.thingsboard.server.msa.AbstractContainerTest;
import org.thingsboard.server.msa.ui.listeners.TestListener;
import java.io.File;
import java.time.Duration;
import java.util.stream.Collectors;
@Slf4j
@Listeners({TestListener.class, RetryTestListener.class})
abstract public class DiverBaseTest extends Base {
protected WebDriver driver;
@Listeners(TestListener.class)
abstract public class AbstractDiverBaseTest extends AbstractContainerTest {
protected WebDriver driver;
private final Dimension dimension = new Dimension(WIDTH, HEIGHT);
private static final int WIDTH = 1680;
private static final int HEIGHT = 1050;
private static final boolean HEADLESS = false;
protected static final PageLink pageLink = new PageLink(10);
@BeforeMethod
public void openBrowser() {
@ -63,7 +87,7 @@ abstract public class DiverBaseTest extends Base {
}
protected boolean urlContains(String urlPath) {
WebDriverWait wait = new WebDriverWait(driver, Duration.ofMillis(10000));
WebDriverWait wait = new WebDriverWait(driver, Duration.ofMillis(5000));
try {
wait.until(ExpectedConditions.urlContains(urlPath));
} catch (WebDriverException e) {
@ -71,4 +95,22 @@ abstract public class DiverBaseTest extends Base {
}
return driver.getCurrentUrl().contains(urlPath);
}
public static RuleChain getRuleChainByName(String name) {
return testRestClient.getRuleChains(pageLink).getData().stream()
.filter(s -> s.getName().equals(name)).collect(Collectors.toList()).get(0);
}
public static Customer getCustomerByName(String name) {
return testRestClient.getCustomers(pageLink).getData().stream()
.filter(x -> x.getName().equals(name)).collect(Collectors.toList()).get(0);
}
@SneakyThrows
@Attachment(value = "Page screenshot", type = "image/png")
public static byte[] captureScreen(WebDriver driver, String dirPath) {
File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshot, new File("./target/allure-results/screenshots/" + dirPath + "//" + screenshot.getName()));
return Files.toByteArray(screenshot);
}
}

17
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/listeners/RetryAnalyzer.java

@ -1,4 +1,19 @@
package listeners;
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.listeners;
import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;

17
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/listeners/RetryTestListener.java

@ -1,4 +1,19 @@
package listeners;
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.listeners;
import org.testng.IAnnotationTransformer;
import org.testng.annotations.ITestAnnotation;

31
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/listeners/TestListener.java

@ -1,16 +1,33 @@
package listeners;
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.listeners;
import base.Base;
import base.TestInit;
import io.qameta.allure.Allure;
import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.WebDriver;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import static org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest.captureScreen;
@Slf4j
public class TestListener extends Base implements ITestListener {
public class TestListener implements ITestListener {
WebDriver driver;
@ -20,7 +37,7 @@ public class TestListener extends Base implements ITestListener {
Allure.getLifecycle().updateTestCase((t) -> {
t.setStatusDetails(t.getStatusDetails().setMessage(str));
});
driver = ((TestInit) tr.getInstance()).getDriver();
driver = ((AbstractDiverBaseTest) tr.getInstance()).getDriver();
captureScreen(driver, "success");
}
@ -33,7 +50,7 @@ public class TestListener extends Base implements ITestListener {
t.setStatusDetails(t.getStatusDetails().setMessage(str));
t.setStatusDetails(t.getStatusDetails().setMessage(str1));
});
driver = ((TestInit) tr.getInstance()).getDriver();
driver = ((AbstractDiverBaseTest) tr.getInstance()).getDriver();
captureScreen(driver, "failure");
}
@ -46,7 +63,7 @@ public class TestListener extends Base implements ITestListener {
t.setStatusDetails(t.getStatusDetails().setMessage(str));
t.setStatusDetails(t.getStatusDetails().setMessage(str1));
});
driver = ((TestInit) tr.getInstance()).getDriver();
driver = ((AbstractDiverBaseTest) tr.getInstance()).getDriver();
captureScreen(driver, "skipped");
}

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageElements.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
@ -5,8 +20,8 @@ import org.openqa.selenium.WebElement;
import java.util.List;
public class CustomerPageElementsAbstract extends OtherPageElementsHelperAbstract {
public CustomerPageElementsAbstract(WebDriver driver) {
public class CustomerPageElements extends OtherPageElementsHelper {
public CustomerPageElements(WebDriver driver) {
super(driver);
}

50
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageHelper.java

@ -1,17 +1,28 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.page.PageData;
import java.util.stream.Collectors;
@Slf4j
public class CustomerPageHelperAbstract extends CustomerPageElementsAbstract {
public CustomerPageHelperAbstract(WebDriver driver) {
public class CustomerPageHelper extends CustomerPageElements {
public CustomerPageHelper(WebDriver driver) {
super(driver);
}
@ -84,33 +95,6 @@ public class CustomerPageHelperAbstract extends CustomerPageElementsAbstract {
return customerCity;
}
public void createCustomer(String entityName) {
try {
PageData<Customer> tenantCustomer;
tenantCustomer = client.getCustomers(pageLink);
Customer customer = new Customer();
customer.setTitle(entityName);
client.saveCustomer(customer);
tenantCustomer.getData().add(customer);
} catch (Exception e) {
log.info("Can't create!");
}
}
public void deleteCustomer(String entityName) {
try {
PageData<Customer> tenantRuleChains;
tenantRuleChains = client.getCustomers(pageLink);
try {
client.deleteCustomer(tenantRuleChains.getData().stream().filter(s -> s.getName().equals(entityName)).collect(Collectors.toList()).get(0).getId());
} catch (Exception e) {
client.deleteCustomer(tenantRuleChains.getData().stream().filter(s -> s.getName().equals(entityName)).collect(Collectors.toList()).get(1).getId());
}
} catch (Exception e) {
log.info("Can't delete!");
}
}
public void changeTitleEditMenu(String newTitle) {
titleFieldEntityView().clear();
wait.until(ExpectedConditions.textToBe(By.xpath(String.format(INPUT_FIELD, INPUT_FIELD_NAME_TITLE)), ""));

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DashboardPageElements.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
@ -5,8 +20,8 @@ import org.openqa.selenium.WebElement;
import java.util.List;
public class DashboardPageElementsAbstract extends OtherPageElementsHelperAbstract {
public DashboardPageElementsAbstract(WebDriver driver) {
public class DashboardPageElements extends OtherPageElementsHelper {
public DashboardPageElements(WebDriver driver) {
super(driver);
}

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DashboardPageHelper.java

@ -1,9 +1,24 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
public class DashboardPageHelperAbstract extends DashboardPageElementsAbstract {
public DashboardPageHelperAbstract(WebDriver driver) {
public class DashboardPageHelper extends DashboardPageElements {
public DashboardPageHelper(WebDriver driver) {
super(driver);
}

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/LoginPageElements.java

@ -1,11 +1,26 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.thingsboard.server.msa.ui.base.AbstractBasePage;
public class LoginPageElementsAbstract extends AbstractBasePage {
public LoginPageElementsAbstract(WebDriver driver) {
public class LoginPageElements extends AbstractBasePage {
public LoginPageElements(WebDriver driver) {
super(driver);
}

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/LoginPageHelper.java

@ -1,10 +1,25 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
import org.thingsboard.server.msa.ui.utils.Const;
public class LoginPageHelperAbstract extends LoginPageElementsAbstract {
public LoginPageHelperAbstract(WebDriver driver) {
public class LoginPageHelper extends LoginPageElements {
public LoginPageHelper(WebDriver driver) {
super(driver);
}

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageElements.java

@ -1,11 +1,26 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.thingsboard.server.msa.ui.base.AbstractBasePage;
public class OpenRuleChainPageElementsAbstract extends AbstractBasePage {
public OpenRuleChainPageElementsAbstract(WebDriver driver) {
public class OpenRuleChainPageElements extends AbstractBasePage {
public OpenRuleChainPageElements(WebDriver driver) {
super(driver);
}

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageHelper.java

@ -1,9 +1,24 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
public class OpenRuleChainPageHelperAbstract extends OpenRuleChainPageElementsAbstract {
public OpenRuleChainPageHelperAbstract(WebDriver driver) {
public class OpenRuleChainPageHelper extends OpenRuleChainPageElements {
public OpenRuleChainPageHelper(WebDriver driver) {
super(driver);
}

20
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
@ -6,8 +21,8 @@ import org.thingsboard.server.msa.ui.base.AbstractBasePage;
import java.util.List;
public class OtherPageElementsAbstract extends AbstractBasePage {
public OtherPageElementsAbstract(WebDriver driver) {
public class OtherPageElements extends AbstractBasePage {
public OtherPageElements(WebDriver driver) {
super(driver);
}
@ -103,6 +118,7 @@ public class OtherPageElementsAbstract extends AbstractBasePage {
}
public WebElement editPencilBtn() {
waitUntilVisibilityOfElementsLocated(EDIT_PENCIL_BTN);
return waitUntilElementToBeClickable(EDIT_PENCIL_BTN);
}

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElementsHelper.java

@ -1,11 +1,26 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
public class OtherPageElementsHelperAbstract extends OtherPageElementsAbstract {
public OtherPageElementsHelperAbstract(WebDriver driver) {
public class OtherPageElementsHelper extends OtherPageElements {
public OtherPageElementsHelper(WebDriver driver) {
super(driver);
}

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/RuleChainsPageElements.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.By;
@ -6,8 +21,8 @@ import org.openqa.selenium.WebElement;
import java.util.List;
public class RuleChainsPageElementsAbstract extends OtherPageElementsHelperAbstract {
public RuleChainsPageElementsAbstract(WebDriver driver) {
public class RuleChainsPageElements extends OtherPageElementsHelper {
public RuleChainsPageElements(WebDriver driver) {
super(driver);
}

94
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/RuleChainsPageHelper.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import lombok.extern.slf4j.Slf4j;
@ -5,17 +20,14 @@ import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.Assert;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.rule.RuleChain;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import java.util.stream.Collectors;
@Slf4j
public class RuleChainsPageHelperAbstract extends RuleChainsPageElementsAbstract {
public RuleChainsPageHelperAbstract(WebDriver driver) {
public class RuleChainsPageHelper extends RuleChainsPageElements {
public RuleChainsPageHelper(WebDriver driver) {
super(driver);
}
@ -52,74 +64,6 @@ public class RuleChainsPageHelperAbstract extends RuleChainsPageElementsAbstract
return this.ruleChainName;
}
public String getRuleChainId(String entityName) {
PageData<RuleChain> tenantRuleChains;
tenantRuleChains = client.getRuleChains(pageLink);
return String.valueOf(tenantRuleChains.getData().stream().filter(s -> s.getName().equals(entityName)).collect(Collectors.toList()).get(0).getId());
}
public void deleteRuleChain(String entityName) {
try {
PageData<RuleChain> tenantRuleChains;
tenantRuleChains = client.getRuleChains(pageLink);
try {
client.deleteRuleChain(tenantRuleChains.getData().stream().filter(s -> s.getName().equals(entityName)).collect(Collectors.toList()).get(0).getId());
} catch (Exception e) {
client.deleteRuleChain(tenantRuleChains.getData().stream().filter(s -> s.getName().equals(entityName)).collect(Collectors.toList()).get(1).getId());
}
} catch (Exception e) {
log.info("Can't delete!");
}
}
public void deleteAllRuleChain(String entityName) {
try {
PageData<RuleChain> tenantRuleChains;
tenantRuleChains = client.getRuleChains(pageLink);
tenantRuleChains.getData().stream().filter(s -> s.getName().equals(entityName)).collect(Collectors.toList()).forEach(x -> client.deleteRuleChain(x.getId()));
} catch (Exception e) {
log.info("Can't delete!");
}
}
public void createRuleChain(String entityName) {
try {
PageData<RuleChain> tenantRuleChains;
tenantRuleChains = client.getRuleChains(pageLink);
RuleChain ruleChain = new RuleChain();
ruleChain.setName(entityName);
client.saveRuleChain(ruleChain);
tenantRuleChains.getData().add(ruleChain);
} catch (Exception e) {
log.info("Can't create!");
}
}
public void makeRoot() {
try {
PageData<RuleChain> tenantRuleChains;
tenantRuleChains = client.getRuleChains(pageLink);
tenantRuleChains.getData().stream().filter(s -> s.getName().equals("Root Rule Chain")).collect(Collectors.toList()).forEach(x -> client.setRootRuleChain(x.getId()));
} catch (Exception e) {
log.info("Can't make root!");
}
}
public void createRuleChains(String entityName, int count) {
try {
PageData<RuleChain> tenantRuleChains;
tenantRuleChains = client.getRuleChains(pageLink);
RuleChain ruleChain = new RuleChain();
for (int i = 0; i < count; i++) {
ruleChain.setName(entityName);
client.saveRuleChain(ruleChain);
tenantRuleChains.getData().add(ruleChain);
}
} catch (Exception e) {
log.info("Can't create!");
}
}
public String deleteRuleChainFromView(String ruleChainName) {
String s = "";
if (deleteBtnFromView() != null) {
@ -149,8 +93,8 @@ public class RuleChainsPageHelperAbstract extends RuleChainsPageElementsAbstract
Assert.assertFalse(driver.findElement(By.xpath(getCheckbox(entityName))).isDisplayed());
}
public void assertDeleteBtnInRootRuleChainIsNotDisplayed() {
Assert.assertFalse(driver.findElement(By.xpath(getDeleteRuleChainFromViewBtn())).isDisplayed());
public boolean deleteBtnInRootRuleChainIsNotDisplayed() {
return wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(getDeleteRuleChainFromViewBtn())));
}
public boolean ruleChainsIsNotPresent(String ruleChainName) {

21
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/SideBarMenuViewElements.java

@ -1,10 +1,25 @@
package pages;
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.pages;
import base.BasePage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.thingsboard.server.msa.ui.base.AbstractBasePage;
public class SideBarMenuViewElements extends BasePage {
public class SideBarMenuViewElements extends AbstractBasePage {
public SideBarMenuViewElements(WebDriver driver) {
super(driver);
}

56
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -6,56 +21,57 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.*;
public class CreateCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class CreateCustomerTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private CustomerPageHelper customerPage;
private String customerName;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
}
@AfterMethod
public void delete() {
if (customerName != null) {
customerPage.deleteCustomer(customerName);
testRestClient.deleteCustomer(getCustomerByName(customerName).getId());
customerName = null;
}
}
@Test(priority = 10, groups = "smoke")
@Description("Can click on Add after specifying the name (text/numbers /special characters)")
@Description
public void createCustomer() {
String customerName = ENTITY_NAME;
customerName = ENTITY_NAME;
sideBarMenuView.customerBtn().click();
customerPage.plusBtn().click();
customerPage.titleFieldAddEntityView().sendKeys(customerName);
customerPage.addBtnC().click();
customerPage.refreshBtn().click();
this.customerName = customerName;
Assert.assertNotNull(customerPage.customer(customerName));
Assert.assertTrue(customerPage.customer(customerName).isDisplayed());
}
@Test(priority = 20, groups = "smoke")
@Description
public void createCustomerWithFullInformation() {
String customerName = ENTITY_NAME;
customerName = ENTITY_NAME;
String text = "Text";
String email = "email@mail.com";
String number = "2015550123";
String number = "12015550123";
sideBarMenuView.customerBtn().click();
customerPage.plusBtn().click();
@ -74,7 +90,6 @@ public class CreateCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
customerPage.setCustomerCountry(customerName);
customerPage.setCustomerCity(customerName);
customerPage.entity(customerName).click();
this.customerName = customerName;
Assert.assertNotNull(customerPage.customer(customerName));
Assert.assertEquals(customerPage.entityViewTitle().getText(), customerName);
@ -86,7 +101,7 @@ public class CreateCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
Assert.assertEquals(customerPage.zipEntityView().getAttribute("value"), text);
Assert.assertEquals(customerPage.addressEntityView().getAttribute("value"), text);
Assert.assertEquals(customerPage.address2EntityView().getAttribute("value"), text);
Assert.assertEquals(customerPage.phoneNumberEntityView().getAttribute("value"), "+1" + number);
Assert.assertEquals(customerPage.phoneNumberEntityView().getAttribute("value"), "+" + number);
Assert.assertEquals(customerPage.emailEntityView().getAttribute("value"), email);
Assert.assertEquals(customerPage.getCustomerEmail(), email);
Assert.assertEquals(customerPage.getCustomerCountry(), customerPage.getCountry());
@ -94,7 +109,7 @@ public class CreateCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t add customer without the name (empty field or just space)")
@Description
public void createCustomerWithoutName() {
sideBarMenuView.customerBtn().click();
customerPage.plusBtn().click();
@ -103,7 +118,7 @@ public class CreateCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
}
@Test(priority = 20, groups = "smoke")
@Description()
@Description
public void createCustomerWithOnlySpace() {
sideBarMenuView.customerBtn().click();
customerPage.plusBtn().click();
@ -118,7 +133,7 @@ public class CreateCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
}
@Test(priority = 20, groups = "smoke")
@Description("Can't create a customer with the same name")
@Description
public void createCustomerSameName() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@ -135,22 +150,21 @@ public class CreateCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
}
@Test(priority = 20, groups = "smoke")
@Description("Can click on Add after specifying the name (text/numbers /special characters)")
@Description
public void createCustomerWithoutRefresh() {
String customerName = ENTITY_NAME;
customerName = ENTITY_NAME;
sideBarMenuView.customerBtn().click();
customerPage.plusBtn().click();
customerPage.titleFieldAddEntityView().sendKeys(customerName);
customerPage.addBtnC().click();
this.customerName = customerName;
Assert.assertNotNull(customerPage.customer(customerName));
Assert.assertTrue(customerPage.customer(customerName).isDisplayed());
}
@Test(priority = 40, groups = "smoke")
@Description("Question mark icon leads to rule chain documentation (PE)")
@Description
public void documentation() {
String urlPath = "docs/user-guide/ui/customers/";

105
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -6,62 +21,64 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.DashboardPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.DashboardPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import org.thingsboard.server.msa.ui.utils.DataProviderCredential;
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.getRandomNumber;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultCustomerPrototype;
public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class CustomerEditMenuTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private DashboardPageHelperAbstract dashboardPage;
private CustomerPageHelper customerPage;
private DashboardPageHelper dashboardPage;
private String customerName;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
dashboardPage = new DashboardPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
dashboardPage = new DashboardPageHelper(driver);
}
@AfterMethod
public void delete() {
if (customerName != null) {
customerPage.deleteCustomer(customerName);
testRestClient.deleteCustomer(getCustomerByName(customerName).getId());
customerName = null;
}
}
@Test(priority = 10, groups = "smoke")
@Description("Can click by pencil icon and edit the title (change the title) and save the changes. All changes have been applied")
@Description
public void changeTitle() {
customerPage.createCustomer(ENTITY_NAME);
String title = "Changed" + getRandomNumber();
customerName = "Changed" + getRandomNumber();
testRestClient.postCustomer(defaultCustomerPrototype(ENTITY_NAME));
sideBarMenuView.customerBtn().click();
customerPage.entityTitles().get(0).click();
customerPage.setHeaderName();
String titleBefore = customerPage.getHeaderName();
customerPage.editPencilBtn().click();
customerPage.changeTitleEditMenu(title);
customerPage.changeTitleEditMenu(customerName);
customerPage.doneBtnEditView().click();
customerPage.setHeaderName();
String titleAfter = customerPage.getHeaderName();
customerName = title;
Assert.assertNotEquals(titleBefore, titleAfter);
Assert.assertEquals(titleAfter, title);
Assert.assertEquals(titleAfter, customerName);
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t delete the title and save changes")
@Description
public void deleteTitle() {
sideBarMenuView.customerBtn().click();
customerPage.entityTitles().get(0).click();
@ -72,7 +89,7 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t save just a space in the title")
@Description
public void saveOnlyWithSpace() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@ -89,10 +106,10 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description("Can write/change/delete the descriptionEntityView and save the changes. All changes have been applied")
@Description
public void editDescription() {
String title = ENTITY_NAME;
customerPage.createCustomer(title);
customerName = ENTITY_NAME;
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
String description = "Description";
sideBarMenuView.customerBtn().click();
@ -108,7 +125,6 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
customerPage.editPencilBtn().click();
customerPage.changeDescription("");
customerPage.doneBtnEditView().click();
customerName = title;
Assert.assertEquals(description, description1);
Assert.assertEquals(description + description, description2);
@ -118,24 +134,23 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
@Test(priority = 20, groups = "smoke")
@Description
public void assignedDashboardFromDashboard() {
String title = ENTITY_NAME;
customerPage.createCustomer(title);
customerName = ENTITY_NAME;
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
sideBarMenuView.dashboardBtn().click();
dashboardPage.setDashboardTitle();
dashboardPage.assignedBtn(dashboardPage.getDashboardTitle()).click();
dashboardPage.assignedCustomer(title);
dashboardPage.assignedCustomer(customerName);
sideBarMenuView.customerBtn().click();
customerPage.entity(title).click();
customerPage.entity(customerName).click();
customerPage.editPencilBtn().click();
customerPage.chooseDashboard();
customerPage.doneBtnEditView().click();
customerPage.setDashboardFromView();
customerPage.closeEntityViewBtn().click();
customerPage.manageCustomersUserBtn(title).click();
customerPage.manageCustomersUserBtn(customerName).click();
customerPage.createCustomersUser();
customerPage.userLoginBtn().click();
customerName = title;
Assert.assertNotNull(customerPage.usersWidget());
Assert.assertTrue(customerPage.usersWidget().isDisplayed());
@ -145,23 +160,22 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
@Test(priority = 20, groups = "smoke")
@Description
public void assignedDashboard() {
String title = ENTITY_NAME;
customerPage.createCustomer(title);
customerName = ENTITY_NAME;
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
sideBarMenuView.customerBtn().click();
customerPage.manageCustomersDashboardsBtn(title).click();
customerPage.manageCustomersDashboardsBtn(customerName).click();
customerPage.assignedDashboard();
sideBarMenuView.customerBtn().click();
customerPage.entity(title).click();
customerPage.entity(customerName).click();
customerPage.editPencilBtn().click();
customerPage.chooseDashboard();
customerPage.doneBtnEditView().click();
customerPage.setDashboardFromView();
customerPage.closeEntityViewBtn().click();
customerPage.manageCustomersUserBtn(title).click();
customerPage.manageCustomersUserBtn(customerName).click();
customerPage.createCustomersUser();
customerPage.userLoginBtn().click();
customerName = title;
Assert.assertNotNull(customerPage.usersWidget());
Assert.assertTrue(customerPage.usersWidget().isDisplayed());
@ -171,24 +185,23 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
@Test(priority = 20, groups = "smoke")
@Description
public void assignedDashboardWithoutHide() {
String title = ENTITY_NAME;
customerPage.createCustomer(title);
customerName = ENTITY_NAME;
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
sideBarMenuView.customerBtn().click();
customerPage.manageCustomersDashboardsBtn(title).click();
customerPage.manageCustomersDashboardsBtn(customerName).click();
customerPage.assignedDashboard();
sideBarMenuView.customerBtn().click();
customerPage.entity(title).click();
customerPage.entity(customerName).click();
customerPage.editPencilBtn().click();
customerPage.chooseDashboard();
customerPage.hideHomeDashboardToolbarCheckbox().click();
customerPage.doneBtnEditView().click();
customerPage.setDashboardFromView();
customerPage.closeEntityViewBtn().click();
customerPage.manageCustomersUserBtn(title).click();
customerPage.manageCustomersUserBtn(customerName).click();
customerPage.createCustomersUser();
customerPage.userLoginBtn().click();
customerName = title;
Assert.assertNotNull(customerPage.usersWidget());
Assert.assertTrue(customerPage.usersWidget().isDisplayed());
@ -204,8 +217,8 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
@Test(priority = 20, groups = "smoke")
@Description
public void addPhoneNumber() {
String title = ENTITY_NAME;
customerPage.createCustomer(title);
customerName = ENTITY_NAME;
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
String number = "2015550123";
sideBarMenuView.customerBtn().click();
@ -213,7 +226,6 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
customerPage.editPencilBtn().click();
customerPage.phoneNumberEntityView().sendKeys(number);
customerPage.doneBtnEditView().click();
customerName = title;
Assert.assertTrue(customerPage.phoneNumberEntityView().getAttribute("value").contains(number));
}
@ -235,9 +247,11 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 30, groups = "smoke")
@Description
public void addAllInformation() {
String title = ENTITY_NAME;
customerPage.createCustomer(title);
customerName = ENTITY_NAME;
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
;
String text = "Text";
String email = "email@mail.com";
String number = "2015550123";
@ -255,7 +269,6 @@ public class CustomerEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest
customerPage.phoneNumberEntityView().sendKeys(number);
customerPage.emailEntityView().sendKeys(email);
customerPage.doneBtnEditView().click();
customerName = title;
Assert.assertEquals(customerPage.countrySelectMenuEntityView().getText(), customerPage.getCountry());
Assert.assertEquals(customerPage.descriptionEntityView().getAttribute("value"), text);

54
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteCustomerTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -5,34 +20,35 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultCustomerPrototype;
public class DeleteCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class DeleteCustomerTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private RuleChainsPageHelperAbstract ruleChainsPage;
private CustomerPageHelper customerPage;
private RuleChainsPageHelper ruleChainsPage;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@Test(priority = 10, groups = "smoke")
@Description("Can remove the customer by clicking on the trash can icon in the right corner")
@Description
public void removeCustomerByRightSideBtn() {
String customer = ENTITY_NAME;
customerPage.createCustomer(customer);
testRestClient.postCustomer(defaultCustomerPrototype(customer));
sideBarMenuView.customerBtn().click();
String deletedCustomer = customerPage.deleteRuleChainTrash(customer);
@ -42,10 +58,10 @@ public class DeleteCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
}
@Test(priority = 20, groups = "smoke")
@Description("Can mark the customer in the checkbox and then click on the trash can icon in the menu that appears at the top")
@Description
public void removeSelectedCustomer() {
String customerName = ENTITY_NAME;
customerPage.createCustomer(customerName);
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
sideBarMenuView.customerBtn().click();
String deletedCustomer = customerPage.deleteSelected(customerName);
@ -55,10 +71,10 @@ public class DeleteCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
}
@Test(priority = 20, groups = "smoke")
@Description("Can click on the name of the rule chain and click on the 'Delete customer' button")
@Description
public void removeFromCustomerView() {
String customerName = ENTITY_NAME;
customerPage.createCustomer(customerName);
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
sideBarMenuView.customerBtn().click();
customerPage.entity(customerName).click();
@ -69,10 +85,10 @@ public class DeleteCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
}
@Test(priority = 20, groups = "smoke")
@Description("The rule chain is deleted immediately after clicking remove (no need to refresh the page)")
@Description
public void removeCustomerByRightSideBtnWithoutRefresh() {
String customer = ENTITY_NAME;
customerPage.createCustomer(customer);
testRestClient.postCustomer(defaultCustomerPrototype(customer));
sideBarMenuView.customerBtn().click();
String deletedCustomer = customerPage.deleteRuleChainTrash(customer);

57
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteSeveralCustomerTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -5,41 +20,37 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultCustomerPrototype;
public class DeleteSeveralCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class DeleteSeveralCustomerTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private CustomerPageHelper customerPage;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
}
@Test(priority = 10, groups = "smoke")
@Description("Can mark several customers in the checkbox near the names and then click on the trash can icon in the menu that appears at the top")
@Description
public void canDeleteSeveralCustomersByTopBtn() {
String title1 = ENTITY_NAME + "1";
String title2 = ENTITY_NAME + "2";
int count = 2;
customerPage.createCustomer(title1);
customerPage.createCustomer(title2);
testRestClient.postCustomer(defaultCustomerPrototype(title1));
testRestClient.postCustomer(defaultCustomerPrototype(title2));
sideBarMenuView.customerBtn().click();
customerPage.clickOnCheckBoxes(count);
Assert.assertEquals(customerPage.markCheckbox().size(), count);
customerPage.markCheckbox().forEach(x -> Assert.assertTrue(x.isDisplayed()));
customerPage.clickOnCheckBoxes(2);
customerPage.deleteSelectedBtn().click();
customerPage.warningPopUpYesBtn().click();
customerPage.refreshBtn().click();
@ -49,7 +60,7 @@ public class DeleteSeveralCustomerAbstractDiverBaseTest extends AbstractDiverBas
}
@Test(priority = 10, groups = "smoke")
@Description("Can mark several rule chains in the checkbox near the names and then click on the trash can icon in the menu that appears at the top")
@Description
public void selectAllCustomers() {
sideBarMenuView.customerBtn().click();
customerPage.selectAllCheckBox().click();
@ -61,17 +72,15 @@ public class DeleteSeveralCustomerAbstractDiverBaseTest extends AbstractDiverBas
}
@Test(priority = 30, groups = "smoke")
@Description("The rule chains are deleted immediately after clicking remove (no need to refresh the page)")
@Description
public void deleteSeveralCustomersByTopBtnWithoutRefresh() {
String title1 = ENTITY_NAME + "1";
String title2 = ENTITY_NAME + "2";
int count = 2;
customerPage.createCustomer(title1);
customerPage.createCustomer(title2);
testRestClient.postCustomer(defaultCustomerPrototype(title1));
testRestClient.postCustomer(defaultCustomerPrototype(title2));
sideBarMenuView.customerBtn().click();
customerPage.clickOnCheckBoxes(count);
customerPage.clickOnCheckBoxes(2);
customerPage.deleteSelectedBtn().click();
customerPage.warningPopUpYesBtn().click();

31
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersAssetsTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -5,28 +20,28 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
public class ManageCustomersAssetsAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class ManageCustomersAssetsTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private CustomerPageHelper customerPage;
private final String manage = "Assets";
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer assets' window by clicking on the 'Manage customer users' icon in the right corner")
@Description
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@ -39,7 +54,7 @@ public class ManageCustomersAssetsAbstractDiverBaseTest extends AbstractDiverBas
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Assets' window by clicking on the name/row of the customer and click on the 'Manage users' button")
@Description
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();

31
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDashboardsTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -5,27 +20,27 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
public class ManageCustomersDashboardsAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class ManageCustomersDashboardsTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private CustomerPageHelper customerPage;
private final String manage = "Dashboards";
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Dashboards' window by clicking on the 'Manage customer users' icon in the right corner")
@Description
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@ -38,7 +53,7 @@ public class ManageCustomersDashboardsAbstractDiverBaseTest extends AbstractDive
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Dashboards' window by clicking on the name/row of the customer and click on the 'Manage users' button")
@Description
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();

31
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDevicesTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -5,27 +20,27 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
public class ManageCustomersDevicesAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class ManageCustomersDevicesTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private CustomerPageHelper customerPage;
private final String manage = "Devices";
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Devices' window by clicking on the 'Manage customer users' icon in the right corner")
@Description
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@ -38,7 +53,7 @@ public class ManageCustomersDevicesAbstractDiverBaseTest extends AbstractDiverBa
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Devices' window by clicking on the name/row of the customer and click on the 'Manage users' button")
@Description
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();

33
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersEdgesTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -5,28 +20,28 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
public class ManageCustomersEdgesAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class ManageCustomersEdgesTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private String iconText = "Edge instances";
private CustomerPageHelper customerPage;
private final String iconText = "Edge instances";
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Edges' window by clicking on the 'Manage customer users' icon in the right corner")
@Description
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@ -39,7 +54,7 @@ public class ManageCustomersEdgesAbstractDiverBaseTest extends AbstractDiverBase
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Edges' window by clicking on the name/row of the customer and click on the 'Manage users' button")
@Description
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();

33
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersUsersTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -5,28 +20,28 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
public class ManageCustomersUsersAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class ManageCustomersUsersTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private String iconText = "Customer Users";
private CustomerPageHelper customerPage;
private final String iconText = "Customer Users";
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Users' window by clicking on the 'Manage customer users' icon in the right corner")
@Description
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@ -39,7 +54,7 @@ public class ManageCustomersUsersAbstractDiverBaseTest extends AbstractDiverBase
}
@Test(groups = "smoke")
@Description("Can go to the 'Customer Users' window by clicking on the name/row of the customer and click on the 'Manage users' button")
@Description
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();

50
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SearchCustomerTest.java

@ -1,39 +1,49 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import org.thingsboard.server.msa.ui.utils.DataProviderCredential;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultCustomerPrototype;
public class SearchCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class SearchCustomerTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private String entityName;
private CustomerPageHelper customerPage;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
}
@AfterMethod
public void deleteCustomer() {
customerPage.deleteCustomer(entityName);
customerPage = new CustomerPageHelper(driver);
}
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "customerNameForSearchByFirstAndSecondWord")
@Description("Can search by the first/second word of the name")
@Description
public void searchFirstWord(String namePath) {
sideBarMenuView.customerBtn().click();
customerPage.searchEntity(namePath);
@ -42,15 +52,17 @@ public class SearchCustomerAbstractDiverBaseTest extends AbstractDiverBaseTest {
}
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSearchBySymbolAndNumber")
@Description("Can search by number/symbol")
@Description
public void searchNumber(String name, String namePath) {
customerPage.createCustomer(name);
testRestClient.postCustomer(defaultCustomerPrototype(name));
sideBarMenuView.customerBtn().click();
customerPage.searchEntity(namePath);
customerPage.setCustomerName();
entityName = name;
boolean customerNameContainsPath = customerPage.getCustomerName().contains(namePath);
testRestClient.deleteCustomer(getCustomerByName(name).getId());
Assert.assertTrue(customerPage.getCustomerName().contains(namePath));
Assert.assertTrue(customerNameContainsPath);
}
}

65
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SortByNameTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
@ -6,30 +21,32 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import org.thingsboard.server.msa.ui.utils.DataProviderCredential;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultCustomerPrototype;
public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class SortByNameTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private CustomerPageHelperAbstract customerPage;
private CustomerPageHelper customerPage;
private String customerName;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
customerPage = new CustomerPageHelperAbstract(driver);
customerPage = new CustomerPageHelper(driver);
}
@AfterMethod
public void delete() {
if (customerName != null) {
customerPage.deleteCustomer(customerName);
testRestClient.deleteCustomer(getCustomerByName(customerName).getId());
customerName = null;
}
}
@ -37,12 +54,12 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
@Description
public void specialCharacterUp(String title) {
customerPage.createCustomer(title);
customerName = title;
testRestClient.postCustomer(defaultCustomerPrototype(title));
sideBarMenuView.customerBtn().click();
customerPage.sortByTitleBtn().click();
customerPage.setCustomerName();
customerName = title;
Assert.assertEquals(customerPage.getCustomerName(), title);
}
@ -50,9 +67,9 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
@Description
public void allSortUp(String customer, String customerSymbol, String customerNumber) {
customerPage.createCustomer(customerSymbol);
customerPage.createCustomer(customer);
customerPage.createCustomer(customerNumber);
testRestClient.postCustomer(defaultCustomerPrototype(customerSymbol));
testRestClient.postCustomer(defaultCustomerPrototype(customer));
testRestClient.postCustomer(defaultCustomerPrototype(customerNumber));
sideBarMenuView.customerBtn().click();
customerPage.sortByTitleBtn().click();
@ -67,9 +84,9 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
boolean secondEquals = secondCustomer.equals(customerNumber);
boolean thirdEquals = thirdCustomer.equals(customer);
customerPage.deleteCustomer(customer);
customerPage.deleteCustomer(customerNumber);
customerPage.deleteCustomer(customerSymbol);
testRestClient.deleteCustomer(getCustomerByName(customer).getId());
testRestClient.deleteCustomer(getCustomerByName(customerNumber).getId());
testRestClient.deleteCustomer(getCustomerByName(customerSymbol).getId());
Assert.assertTrue(firstEquals);
Assert.assertTrue(secondEquals);
@ -79,12 +96,12 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
@Description
public void specialCharacterDown(String title) {
customerPage.createCustomer(title);
customerName = title;
testRestClient.postCustomer(defaultCustomerPrototype(title));
sideBarMenuView.customerBtn().click();
customerPage.sortByNameDown();
customerPage.setCustomerName(customerPage.allEntity().size() - 1);
customerName = title;
Assert.assertEquals(customerPage.getCustomerName(), title);
}
@ -92,9 +109,9 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
@Description
public void allSortDown(String customer, String customerSymbol, String customerNumber) {
customerPage.createCustomer(customerSymbol);
customerPage.createCustomer(customer);
customerPage.createCustomer(customerNumber);
testRestClient.postCustomer(defaultCustomerPrototype(customerSymbol));
testRestClient.postCustomer(defaultCustomerPrototype(customer));
testRestClient.postCustomer(defaultCustomerPrototype(customerNumber));
sideBarMenuView.customerBtn().click();
int lastIndex = customerPage.allEntity().size() - 1;
@ -110,9 +127,9 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
boolean secondEquals = secondCustomer.equals(customerNumber);
boolean thirdEquals = thirdCustomer.equals(customer);
customerPage.deleteCustomer(customer);
customerPage.deleteCustomer(customerNumber);
customerPage.deleteCustomer(customerSymbol);
testRestClient.deleteCustomer(getCustomerByName(customer).getId());
testRestClient.deleteCustomer(getCustomerByName(customerNumber).getId());
testRestClient.deleteCustomer(getCustomerByName(customerSymbol).getId());
Assert.assertTrue(firstEquals);
Assert.assertTrue(secondEquals);

65
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainImportTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -6,17 +21,20 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.OpenRuleChainPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.OpenRuleChainPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import java.util.ArrayList;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultRuleChainPrototype;
public class CreateRuleChainImportAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class CreateRuleChainImportTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private OpenRuleChainPageHelperAbstract openRuleChainPage;
private RuleChainsPageHelper ruleChainsPage;
private OpenRuleChainPageHelper openRuleChainPage;
private final String absolutePathToFileImportRuleChain = getClass().getClassLoader().getResource(IMPORT_RULE_CHAIN_FILE_NAME).getPath();
private final String absolutePathToFileImportTxt = getClass().getClassLoader().getResource(IMPORT_TXT_FILE_NAME).getPath();
private String ruleChainName;
@ -24,22 +42,23 @@ public class CreateRuleChainImportAbstractDiverBaseTest extends AbstractDiverBas
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
openRuleChainPage = new OpenRuleChainPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
openRuleChainPage = new OpenRuleChainPageHelper(driver);
}
@AfterMethod
public void delete() {
if (ruleChainName != null) {
ruleChainsPage.deleteRuleChain(ruleChainName);
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainName).getId());
ruleChainName = null;
}
}
@Test(priority = 10, groups = "smoke")
@Description("Can drop a JSON file and import it")
@Description
public void importRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
@ -50,7 +69,7 @@ public class CreateRuleChainImportAbstractDiverBaseTest extends AbstractDiverBas
}
@Test(priority = 20, groups = "smoke")
@Description("Can delete a file by clicking on the icon Remove")
@Description
public void importRuleChainAndDeleteFile() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
@ -63,7 +82,7 @@ public class CreateRuleChainImportAbstractDiverBaseTest extends AbstractDiverBas
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t Select / drop a file of a different format than JSON")
@Description
public void importTxtFile() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
@ -74,7 +93,7 @@ public class CreateRuleChainImportAbstractDiverBaseTest extends AbstractDiverBas
}
@Test(priority = 30, groups = "smoke")
@Description("After clicking on Import - imported rule chain opens (need to save by clicking on the Apply changes icon)")
@Description
public void importRuleChainAndSave() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
@ -90,9 +109,11 @@ public class CreateRuleChainImportAbstractDiverBaseTest extends AbstractDiverBas
}
@Test(priority = 40, groups = "smoke")
@Description("Can create a rule chain with the same name")
@Description
public void importRuleChainAndSaveWithSameName() {
ruleChainsPage.createRuleChain(IMPORT_RULE_CHAIN_NAME);
ruleChainName = IMPORT_RULE_CHAIN_NAME;
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
;
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
@ -101,10 +122,16 @@ public class CreateRuleChainImportAbstractDiverBaseTest extends AbstractDiverBas
openRuleChainPage.doneBtn().click();
openRuleChainPage.waitUntilDoneBtnDisable();
sideBarMenuView.ruleChainsBtn().click();
boolean sizeBigger1 = ruleChainsPage.entities(IMPORT_RULE_CHAIN_NAME).size() > 1;
ruleChainsPage.deleteAllRuleChain(IMPORT_RULE_CHAIN_NAME);
boolean entityNotNull = ruleChainsPage.entity(ruleChainName) != null;
boolean entitiesSizeMoreOne = ruleChainsPage.entities(ruleChainName).size() > 1;
ArrayList<Boolean> entityIsDisplayed = new ArrayList<>();
ruleChainsPage.entities(ruleChainName).forEach(x -> entityIsDisplayed.add(x.isDisplayed()));
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainName).getId());
Assert.assertTrue(sizeBigger1);
Assert.assertTrue(entityNotNull);
Assert.assertTrue(entitiesSizeMoreOne);
entityIsDisplayed.forEach(Assert::assertTrue);
}
}

74
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -6,54 +21,57 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import org.thingsboard.server.msa.ui.utils.EntityPrototypes;
import java.util.ArrayList;
import static org.thingsboard.server.msa.ui.utils.Const.*;
public class CreateRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class CreateRuleChainTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private RuleChainsPageHelper ruleChainsPage;
private String ruleChainName;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@AfterMethod
public void delete() {
if (ruleChainName != null) {
ruleChainsPage.deleteRuleChain(ruleChainName);
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainName).getId());
ruleChainName = null;
}
}
@Test(priority = 10, groups = "smoke")
@Description("Can click on Add after specifying the name (text/numbers /special characters)")
@Description
public void createRuleChain() {
String ruleChainName = ENTITY_NAME;
ruleChainName = ENTITY_NAME;
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openCreateRuleChainView();
ruleChainsPage.nameField().sendKeys(ruleChainName);
ruleChainsPage.addBtnC().click();
ruleChainsPage.refreshBtn().click();
this.ruleChainName = ruleChainName;
Assert.assertNotNull(ruleChainsPage.entity(ruleChainName));
Assert.assertTrue(ruleChainsPage.entity(ruleChainName).isDisplayed());
}
@Test(priority = 10, groups = "smoke")
@Description()
@Description
public void createRuleChainWithDescription() {
String ruleChainName = ENTITY_NAME;
ruleChainName = ENTITY_NAME;
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openCreateRuleChainView();
@ -63,14 +81,13 @@ public class CreateRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
ruleChainsPage.refreshBtn().click();
ruleChainsPage.entity(ENTITY_NAME).click();
ruleChainsPage.setHeaderName();
this.ruleChainName = ruleChainName;
Assert.assertEquals(ruleChainsPage.getHeaderName(), ruleChainName);
Assert.assertEquals(ruleChainsPage.descriptionEntityView().getAttribute("value"), ruleChainName);
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t add rule chain without the name (empty field or just space)")
@Description
public void createRuleChainWithoutName() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openCreateRuleChainView();
@ -79,7 +96,7 @@ public class CreateRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description()
@Description
public void createRuleChainWithOnlySpace() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openCreateRuleChainView();
@ -94,38 +111,45 @@ public class CreateRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description("Can create a rule chain with the same name")
@Description
public void createRuleChainWithSameName() {
ruleChainName = ENTITY_NAME;
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot();
ruleChainsPage.openCreateRuleChainView();
String ruleChainName = ruleChainsPage.getRuleChainName();
ruleChainsPage.nameField().sendKeys(ruleChainName);
ruleChainsPage.addBtnC().click();
ruleChainsPage.refreshBtn().click();
this.ruleChainName = ruleChainName;
Assert.assertNotNull(ruleChainsPage.entity(ruleChainName));
Assert.assertTrue(ruleChainsPage.entities(ruleChainName).size() > 1);
boolean entityNotNull = ruleChainsPage.entity(ruleChainName) != null;
boolean entitiesSizeMoreOne = ruleChainsPage.entities(ruleChainName).size() > 1;
ArrayList<Boolean> entityIsDisplayed = new ArrayList<>();
ruleChainsPage.entities(ruleChainName).forEach(x -> entityIsDisplayed.add(x.isDisplayed()));
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainName).getId());
Assert.assertTrue(entityNotNull);
Assert.assertTrue(entitiesSizeMoreOne);
entityIsDisplayed.forEach(Assert::assertTrue);
}
@Test(priority = 30, groups = "smoke")
@Description("After clicking on Add - appears immediately in the list (no need to refresh the page)")
@Description
public void createRuleChainWithoutRefresh() {
String ruleChainName = ENTITY_NAME;
ruleChainName = ENTITY_NAME;
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openCreateRuleChainView();
ruleChainsPage.nameField().sendKeys(ruleChainName);
ruleChainsPage.addBtnC().click();
this.ruleChainName = ruleChainName;
Assert.assertNotNull(ruleChainsPage.entity(ruleChainName));
Assert.assertTrue(ruleChainsPage.entity(ruleChainName).isDisplayed());
}
@Test(priority = 40, groups = "smoke")
@Description("Question mark icon leads to rule chain documentation (PE)")
@Description
public void documentation() {
String urlPath = "docs/user-guide/ui/rule-chains/";

65
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteRuleChainTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -5,41 +20,44 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultRuleChainPrototype;
public class DeleteRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class DeleteRuleChainTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private RuleChainsPageHelper ruleChainsPage;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@Test(priority = 10, groups = "smoke")
@Description("Can remove the rule chain by clicking on the trash can icon in the right corner")
@Description
public void removeRuleChainByRightSideBtn() {
ruleChainsPage.createRuleChain(ENTITY_NAME);
String ruleChainName = ENTITY_NAME;
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
String deletedRuleChain = ruleChainsPage.deleteRuleChainTrash(ENTITY_NAME);
String deletedRuleChain = ruleChainsPage.deleteRuleChainTrash(ruleChainName);
ruleChainsPage.refreshBtn().click();
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedRuleChain));
}
@Test(priority = 20, groups = "smoke")
@Description("Can mark the rule chain in the checkbox and then click on the trash can icon in the menu that appears at the top")
@Description
public void removeSelectedRuleChain() {
String ruleChainName = ENTITY_NAME;
ruleChainsPage.createRuleChain(ruleChainName);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
String deletedRuleChain = ruleChainsPage.deleteSelected(ruleChainName);
@ -49,20 +67,21 @@ public class DeleteRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description("Can click on the name of the rule chain and click on the 'Delete rule chain' button")
@Description
public void removeFromRuleChainView() {
ruleChainsPage.createRuleChain(ENTITY_NAME);
String ruleChainName = ENTITY_NAME;
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.entity(ENTITY_NAME).click();
String deletedRuleChain = ruleChainsPage.deleteRuleChainFromView(ENTITY_NAME);
String deletedRuleChain = ruleChainsPage.deleteRuleChainFromView(ruleChainName);
ruleChainsPage.refreshBtn().click();
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedRuleChain));
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t remove Root Rule Chain (the trash can is disabled in the right corner)")
@Description
public void removeRootRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
@ -70,7 +89,7 @@ public class DeleteRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t remove Root Rule Chain (can`t mark the rule chain in the checkbox )")
@Description
public void removeSelectedRootRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
@ -78,17 +97,17 @@ public class DeleteRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t remove Root Rule Chain (missing delete button)")
@Description
public void removeFromRootRuleChainView() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.entity(ROOT_RULE_CHAIN_NAME).click();
ruleChainsPage.deleteBtnFromView();
ruleChainsPage.assertDeleteBtnInRootRuleChainIsNotDisplayed();
Assert.assertTrue(ruleChainsPage.deleteBtnInRootRuleChainIsNotDisplayed());
}
@Test(priority = 10, groups = "smoke")
@Description("Can remove the rule chain by clicking on the trash can icon in the right corner")
@Description
public void removeProfileRuleChainByRightSideBtn() {
String deletedRuleChain = "Thermostat";
@ -105,7 +124,7 @@ public class DeleteRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description("Can mark the rule chain in the checkbox and then click on the trash can icon in the menu that appears at the top")
@Description
public void removeSelectedProfileRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
String deletedRuleChain = ruleChainsPage.deleteSelected("Thermostat");
@ -119,7 +138,7 @@ public class DeleteRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 20, groups = "smoke")
@Description("Can click on the name of the rule chain and click on the 'Delete rule chain' button")
@Description
public void removeFromProfileRuleChainView() {
String deletedRuleChain = "Thermostat";
@ -135,10 +154,10 @@ public class DeleteRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 30, groups = "smoke")
@Description("The rule chain is deleted immediately after clicking remove (no need to refresh the page)")
@Description
public void removeRuleChainByRightSideBtnWithoutRefresh() {
String ruleChainName = ENTITY_NAME;
ruleChainsPage.createRuleChain(ruleChainName);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
String deletedRuleChain = ruleChainsPage.deleteRuleChainTrash(ruleChainName);

56
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteSeveralRuleChainsTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -5,35 +20,36 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultRuleChainPrototype;
public class DeleteSeveralRuleChainsAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class DeleteSeveralRuleChainsTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private RuleChainsPageHelper ruleChainsPage;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@Test(priority = 10, groups = "smoke")
@Description("Can mark several rule chains in the checkbox near the names and then click on the trash can icon in the menu that appears at the top")
@Description
public void canDeleteSeveralRuleChainsByTopBtn() {
String ruleChainName = ENTITY_NAME;
int count = 2;
ruleChainsPage.createRuleChains(ruleChainName, count);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.clickOnCheckBoxes(count);
ruleChainsPage.clickOnCheckBoxes(2);
ruleChainsPage.deleteSelectedBtn().click();
ruleChainsPage.warningPopUpYesBtn().click();
ruleChainsPage.refreshBtn().click();
@ -42,11 +58,11 @@ public class DeleteSeveralRuleChainsAbstractDiverBaseTest extends AbstractDiverB
}
@Test(priority = 10, groups = "smoke")
@Description("Can mark several rule chains in the checkbox near the names and then click on the trash can icon in the menu that appears at the top")
@Description
public void selectAllRuleChain() {
String ruleChainName = ENTITY_NAME;
int count = 2;
ruleChainsPage.createRuleChains(ruleChainName, count);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.selectAllCheckBox().click();
@ -58,7 +74,7 @@ public class DeleteSeveralRuleChainsAbstractDiverBaseTest extends AbstractDiverB
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t remove Root Rule Chain (the trash can is disabled in the right corner)")
@Description
public void removeRootRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.selectAllCheckBox().click();
@ -67,7 +83,7 @@ public class DeleteSeveralRuleChainsAbstractDiverBaseTest extends AbstractDiverB
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t remove Root Rule Chain (can`t mark the rule chain in the checkbox )")
@Description
public void removeSelectedRootRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.selectAllCheckBox().click();
@ -76,14 +92,14 @@ public class DeleteSeveralRuleChainsAbstractDiverBaseTest extends AbstractDiverB
}
@Test(priority = 30, groups = "smoke")
@Description("The rule chains are deleted immediately after clicking remove (no need to refresh the page)")
@Description
public void deleteSeveralRuleChainsByTopBtnWithoutRefresh() {
String ruleChainName = ENTITY_NAME;
int count = 2;
ruleChainsPage.createRuleChains(ruleChainName, count);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.clickOnCheckBoxes(count);
ruleChainsPage.clickOnCheckBoxes(2);
ruleChainsPage.deleteSelectedBtn().click();
ruleChainsPage.warningPopUpYesBtn().click();

41
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/MakeRuleChainRootTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -6,32 +21,33 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
public class MakeRuleChainRootAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class MakeRuleChainRootTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private RuleChainsPageHelper ruleChainsPage;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@AfterMethod
public void makeRoot() {
ruleChainsPage.makeRoot();
testRestClient.setRootRuleChain(getRuleChainByName("Root Rule Chain").getId());
}
@Test(priority = 10, groups = "smoke")
@Description("Can make rule chain root by clicking on the 'Make rule chain root' icon in the right corner")
@Description
public void makeRuleChainRootByRightCornerBtn() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);
@ -43,7 +59,7 @@ public class MakeRuleChainRootAbstractDiverBaseTest extends AbstractDiverBaseTes
}
@Test(priority = 20, groups = "smoke")
@Description("Can make rule chain by clicking on the name/row of the rule chain and click on the 'make rule chain root' button")
@Description
public void makeRuleChainRootFromView() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);
@ -57,11 +73,8 @@ public class MakeRuleChainRootAbstractDiverBaseTest extends AbstractDiverBaseTes
}
@Test(priority = 30, groups = "smoke")
@Description("Can't make multiple root rule chains (only one rule chain can be root)")
@Description
public void multiplyRoot() {
SideBarMenuViewElements sideBarMenuView = new SideBarMenuViewElements(driver);
RuleChainsPageHelperAbstract ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);
String ruleChain = ruleChainsPage.getRuleChainName();

46
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/OpenRuleChainTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -5,30 +20,31 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.OpenRuleChainPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.OpenRuleChainPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
public class OpenRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class OpenRuleChainTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private OpenRuleChainPageHelperAbstract openRuleChainPage;
private RuleChainsPageHelper ruleChainsPage;
private OpenRuleChainPageHelper openRuleChainPage;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
openRuleChainPage = new OpenRuleChainPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
openRuleChainPage = new OpenRuleChainPageHelper(driver);
}
@Test(priority = 10, groups = "smoke")
@Description("Can open the rule chain by clicking on the 'Open rule chain' icon in the right corner")
@Description
public void openRuleChainByRightCornerBtn() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);
@ -36,14 +52,14 @@ public class OpenRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest {
ruleChainsPage.openRuleChainBtn(ruleChain).click();
openRuleChainPage.setHeadName();
Assert.assertTrue(urlContains(ruleChainsPage.getRuleChainId(ruleChainsPage.getRuleChainName())));
Assert.assertTrue(urlContains(String.valueOf(getRuleChainByName(ruleChainsPage.getRuleChainName()).getId())));
Assert.assertTrue(openRuleChainPage.headRuleChainName().isDisplayed());
Assert.assertTrue(openRuleChainPage.inputNode().isDisplayed());
Assert.assertEquals(ruleChainsPage.getRuleChainName(), openRuleChainPage.getHeadName());
}
@Test(priority = 10, groups = "smoke")
@Description("Can open the rule chain by clicking on the name/row of the rule chain and click on the 'Open rule chain' button")
@Description
public void openRuleChainByViewBtn() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);
@ -52,14 +68,14 @@ public class OpenRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest {
ruleChainsPage.openRuleChainFromViewBtn().click();
openRuleChainPage.setHeadName();
Assert.assertTrue(urlContains(ruleChainsPage.getRuleChainId(ruleChain)));
Assert.assertTrue(urlContains(String.valueOf(getRuleChainByName(ruleChainsPage.getRuleChainName()).getId())));
Assert.assertTrue(openRuleChainPage.headRuleChainName().isDisplayed());
Assert.assertTrue(openRuleChainPage.inputNode().isDisplayed());
Assert.assertEquals(ruleChain, openRuleChainPage.getHeadName());
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t open the rule chain by clicking twice on the row/name")
@Description
public void openRuleChainDoubleClick() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);

54
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/RuleChainEditMenuTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -6,38 +21,41 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultRuleChainPrototype;
public class RuleChainEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class RuleChainEditMenuTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private RuleChainsPageHelper ruleChainsPage;
private String ruleChainName;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@AfterMethod
public void delete() {
if (ruleChainName != null) {
ruleChainsPage.deleteRuleChain(ruleChainName);
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainName).getId());
ruleChainName = null;
}
}
@Test(priority = 10, groups = "smoke")
@Description("Can click by pencil icon and edit the name (change the name) and save the changes. All changes have been applied")
@Description
public void changeName() {
ruleChainsPage.createRuleChain(ENTITY_NAME);
testRestClient.postRuleChain(defaultRuleChainPrototype(ENTITY_NAME));
;
String name = "Changed";
sideBarMenuView.ruleChainsBtn().click();
@ -56,7 +74,7 @@ public class RuleChainEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTes
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t delete the name and save changes")
@Description
public void deleteName() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.notRootRuleChainsNames().get(0).click();
@ -67,7 +85,7 @@ public class RuleChainEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTes
}
@Test(priority = 20, groups = "smoke")
@Description("Can`t save just a space in the name")
@Description
public void saveOnlyWithSpace() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.notRootRuleChainsNames().get(0).click();
@ -81,10 +99,10 @@ public class RuleChainEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTes
}
@Test(priority = 20, groups = "smoke")
@Description("Can write/change/delete the descriptionEntityView and save the changes. All changes have been applied")
@Description
public void editDescription() {
String name = ENTITY_NAME;
ruleChainsPage.createRuleChain(name);
ruleChainName = ENTITY_NAME;
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
String description = "Description";
sideBarMenuView.ruleChainsBtn().click();
@ -100,7 +118,6 @@ public class RuleChainEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTes
ruleChainsPage.editPencilBtn().click();
ruleChainsPage.changeDescription("");
ruleChainsPage.doneBtnEditView().click();
ruleChainName = name;
Assert.assertTrue(ruleChainsPage.descriptionEntityView().getAttribute("value").isEmpty());
Assert.assertEquals(description, description1);
@ -108,10 +125,10 @@ public class RuleChainEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTes
}
@Test(priority = 20, groups = "smoke")
@Description("Can enable / disable debug and save changes. All changes have been applied")
@Description
public void debugMode() {
String name = ENTITY_NAME;
ruleChainsPage.createRuleChain(name);
ruleChainName = ENTITY_NAME;
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.notRootRuleChainsNames().get(0).click();
@ -122,7 +139,6 @@ public class RuleChainEditMenuAbstractDiverBaseTest extends AbstractDiverBaseTes
ruleChainsPage.editPencilBtn().click();
ruleChainsPage.debugCheckboxEdit().click();
ruleChainsPage.doneBtnEditView().click();
ruleChainName = name;
Assert.assertFalse(Boolean.parseBoolean(ruleChainsPage.debugCheckboxView().getAttribute("aria-checked")));
Assert.assertTrue(debugMode);

39
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SearchRuleChainTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -5,28 +20,30 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import org.thingsboard.server.msa.ui.utils.DataProviderCredential;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultRuleChainPrototype;
public class SearchRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class SearchRuleChainTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private RuleChainsPageHelper ruleChainsPage;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "ruleChainNameForSearchByFirstAndSecondWord")
@Description("Can search by the first/second word of the name")
@Description
public void searchFirstWord(String namePath) {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.searchEntity(namePath);
@ -36,16 +53,16 @@ public class SearchRuleChainAbstractDiverBaseTest extends AbstractDiverBaseTest
}
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSearchBySymbolAndNumber")
@Description("Can search by number/symbol")
@Description
public void searchNumber(String name, String namePath) {
ruleChainsPage.createRuleChain(name);
testRestClient.postRuleChain(defaultRuleChainPrototype(name));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.searchEntity(namePath);
ruleChainsPage.setRuleChainName(0);
boolean ruleChainContainsNamePath = ruleChainsPage.getRuleChainName().contains(namePath);
ruleChainsPage.deleteRuleChain(name);
testRestClient.deleteRuleChain(getRuleChainByName(name).getId());
Assert.assertTrue(ruleChainContainsNamePath);
}

62
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByNameTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -6,31 +21,33 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import org.thingsboard.server.msa.ui.utils.DataProviderCredential;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultRuleChainPrototype;
public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class SortByNameTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private RuleChainsPageHelper ruleChainsPage;
private String ruleChainName;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@AfterMethod
public void delete() {
if (ruleChainName != null) {
ruleChainsPage.deleteRuleChain(ruleChainName);
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainName).getId());
ruleChainName = null;
}
}
@ -38,7 +55,8 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
@Description
public void specialCharacterUp(String ruleChainName) {
ruleChainsPage.createRuleChain(ruleChainName);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
;
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.sortByNameBtn().click();
@ -51,9 +69,9 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
@Description
public void allSortUp(String ruleChain, String ruleChainSymbol, String ruleChainNumber) {
ruleChainsPage.createRuleChain(ruleChainSymbol);
ruleChainsPage.createRuleChain(ruleChain);
ruleChainsPage.createRuleChain(ruleChainNumber);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainSymbol));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainNumber));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.sortByNameBtn().click();
@ -68,9 +86,9 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
boolean secondEquals = secondRuleChain.equals(ruleChainNumber);
boolean thirdEquals = thirdRuleChain.equals(ruleChain);
ruleChainsPage.deleteRuleChain(ruleChain);
ruleChainsPage.deleteRuleChain(ruleChainNumber);
ruleChainsPage.deleteRuleChain(ruleChainSymbol);
testRestClient.deleteRuleChain(getRuleChainByName(ruleChain).getId());
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainNumber).getId());
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainSymbol).getId());
Assert.assertTrue(firstEquals);
Assert.assertTrue(secondEquals);
@ -80,7 +98,7 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
@Description
public void specialCharacterDown(String ruleChainName) {
ruleChainsPage.createRuleChain(ruleChainName);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.sortByNameDown();
@ -93,9 +111,9 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
@Description
public void allSortDown(String ruleChain, String ruleChainSymbol, String ruleChainNumber) {
ruleChainsPage.createRuleChain(ruleChainSymbol);
ruleChainsPage.createRuleChain(ruleChain);
ruleChainsPage.createRuleChain(ruleChainNumber);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainSymbol));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainNumber));
sideBarMenuView.ruleChainsBtn().click();
int lastIndex = ruleChainsPage.allNames().size() - 1;
@ -111,9 +129,9 @@ public class SortByNameAbstractDiverBaseTest extends AbstractDiverBaseTest {
boolean secondEquals = secondRuleChain.equals(ruleChainNumber);
boolean thirdEquals = thirdRuleChain.equals(ruleChain);
ruleChainsPage.deleteRuleChain(ruleChain);
ruleChainsPage.deleteRuleChain(ruleChainNumber);
ruleChainsPage.deleteRuleChain(ruleChainSymbol);
testRestClient.deleteRuleChain(getRuleChainByName(ruleChain).getId());
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainNumber).getId());
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainSymbol).getId());
Assert.assertTrue(firstEquals);
Assert.assertTrue(secondEquals);

38
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByTimeTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
@ -6,31 +21,32 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.thingsboard.server.msa.ui.base.AbstractDiverBaseTest;
import org.thingsboard.server.msa.ui.pages.LoginPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelperAbstract;
import org.thingsboard.server.msa.ui.pages.LoginPageHelper;
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper;
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements;
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
import static org.thingsboard.server.msa.ui.utils.Const.URL;
import static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultRuleChainPrototype;
public class SortByTimeAbstractDiverBaseTest extends AbstractDiverBaseTest {
public class SortByTimeTest extends AbstractDiverBaseTest {
private SideBarMenuViewElements sideBarMenuView;
private RuleChainsPageHelperAbstract ruleChainsPage;
private RuleChainsPageHelper ruleChainsPage;
private String ruleChainName;
@BeforeMethod
public void login() {
openUrl(URL);
new LoginPageHelperAbstract(driver).authorizationTenant();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewElements(driver);
ruleChainsPage = new RuleChainsPageHelperAbstract(driver);
ruleChainsPage = new RuleChainsPageHelper(driver);
}
@AfterMethod
public void delete() {
if (ruleChainName != null) {
ruleChainsPage.deleteRuleChain(ruleChainName);
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainName).getId());
ruleChainName = null;
}
}
@ -39,7 +55,7 @@ public class SortByTimeAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Description
public void sortByTimeDown() {
String ruleChain = ENTITY_NAME;
ruleChainsPage.createRuleChain(ruleChain);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setSort();
@ -55,7 +71,7 @@ public class SortByTimeAbstractDiverBaseTest extends AbstractDiverBaseTest {
@Description
public void sortByTimeUp() {
String ruleChain = ENTITY_NAME;
ruleChainsPage.createRuleChain(ruleChain);
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.sortByTimeBtn().click();

21
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/Const.java

@ -1,8 +1,23 @@
package utils;
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.utils;
import base.Base;
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.getRandomNumber;
public class Const extends Base {
public class Const {
public static final String URL = "http://localhost:8080/";
public static final String TENANT_EMAIL = "tenant@thingsboard.org";

21
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/DataProviderCredential.java

@ -1,9 +1,24 @@
package utils;
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.utils;
import org.testng.annotations.DataProvider;
import static base.Base.getRandomSymbol;
import static utils.Const.ENTITY_NAME;
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.getRandomSymbol;
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME;
public class DataProviderCredential {

17
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/EntityPrototypes.java

@ -1,9 +1,24 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.utils;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.rule.RuleChain;
public class CustomerPrototypes {
public class EntityPrototypes {
public static Customer defaultCustomerPrototype(String entityName){
Customer customer = new Customer();

27
msa/black-box-tests/src/test/resources/connectivity.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright © 2016-2022 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Connectivity tests">
<test verbose="2" name="Connectivity tests" preserve-order="false">
<packages>
<package name="org.thingsboard.server.msa.connectivity" />
</packages>
</test>
</suite>

16
msa/black-box-tests/src/test/resources/forImport.txt

@ -0,0 +1,16 @@
====
Copyright © 2016-2022 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
====

6
msa/black-box-tests/src/test/resources/smokeTests.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright © 2016-2022 The Thingsboard Authors
Copyright © 2016-2022 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -20,7 +20,7 @@
<suite name="Smoke tests">
<suite-files>
<suite-file path="SmokesRuleChain.xml"/>
<suite-file path="SmokesCustomer.xml"/>
<suite-file path="smokesRuleChain.xml"/>
<suite-file path="smokesCustomer.xml"/>
</suite-files>
</suite>

2
msa/black-box-tests/src/test/resources/smokesCustomer.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright © 2016-2022 The Thingsboard Authors
Copyright © 2016-2022 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

2
msa/black-box-tests/src/test/resources/smokesRuleChain.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright © 2016-2022 The Thingsboard Authors
Copyright © 2016-2022 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

10
msa/black-box-tests/src/test/resources/testNG.xml

@ -17,11 +17,9 @@
-->
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Black-box tests">
<test verbose="2" name="Connectivity tests" preserve-order="false">
<packages>
<package name="org.thingsboard.server.msa.connectivity" />
</packages>
</test>
<suite-files>
<suite-file path="connectivity.xml"/>
<suite-file path="smokesCustomer.xml"/>
</suite-files>
</suite>

2
msa/pom.xml

@ -46,6 +46,8 @@
<module>web-ui</module>
<module>tb-node</module>
<module>transport</module>
<module>black-box-tests</module>
</modules>
<profiles>

Loading…
Cancel
Save