Browse Source

add guide for run tests on built UI

pull/7906/head
Seraphym-Tuhai 4 years ago
parent
commit
5eebe2e6ff
  1. 8
      msa/black-box-tests/README.md
  2. 19
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/TestProperties.java
  3. 2
      msa/black-box-tests/src/test/resources/config.properties

8
msa/black-box-tests/README.md

@ -42,6 +42,8 @@ As result, in REPOSITORY column, next images should be present:
mvn clean install -DblackBoxTests.skip=false -Dsuite=all
### To run a separate test manually on a built UI:
1. Add the black-box-tests module in the [pom.xml](../pom.xml)
2. Add Vm Option "-DrunLocal=true -Dtb.baseUiUrl=http://localhost:4200/" in Run -> Edit Configuration -> Edit Configuration Templates -> TestNG
3. Go to the test class you need in the [UI tests directory](../black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests) and run the test in it
or go to the [resources](../black-box-tests/src/test/resources) and run test suite you need

19
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/TestProperties.java

@ -36,33 +36,20 @@ public class TestProperties {
if (instance.isActive()) {
return HTTPS_URL;
}
return getProperties().getProperty("tb.baseUrl");
return System.getProperty("tb.baseUrl", "http://localhost:8080");
}
public static String getBaseUiUrl() {
if (instance.isActive()) {
return "https://host.docker.internal";
}
return getProperties().getProperty("tb.baseUrl");
return System.getProperty("tb.baseUiUrl", "http://localhost:8080");
}
public static String getWebSocketUrl() {
if (instance.isActive()) {
return WSS_URL;
}
return getProperties().getProperty("tb.wsUrl");
return System.getProperty("tb.wsUrl", "ws://localhost:8080");
}
private static Properties getProperties() {
if (properties == null) {
try (InputStream input = TestProperties.class.getClassLoader().getResourceAsStream("config.properties")) {
properties = new Properties();
properties.load(input);
} catch (IOException ex) {
log.error("Exception while reading test properties " + ex.getMessage());
}
}
return properties;
}
}

2
msa/black-box-tests/src/test/resources/config.properties

@ -1,2 +0,0 @@
tb.baseUrl=http://localhost:8080
tb.wsUrl=ws://localhost:8080
Loading…
Cancel
Save