Skip to content

Commit 3e5e1e4

Browse files
committed
session name update
1 parent 34e9ae4 commit 3e5e1e4

File tree

13 files changed

+17
-26
lines changed

13 files changed

+17
-26
lines changed

browserstack.err

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[object Object]

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<maven-surefire-plugin>3.0.0-M5</maven-surefire-plugin>
1616
<browserstack-local-java>1.0.6</browserstack-local-java>
1717
<httpclient>4.5.13</httpclient>
18-
<parallel.count>5</parallel.count>
18+
<parallel.count>3</parallel.count>
1919
<tests.single>**/tests.SampleTest.java</tests.single>
2020
</properties>
2121
<dependencies>

src/test/java/runners/BstackRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContex
8383
platform.putAll(commonCapsConfig);
8484
platform.put("browserstack.username", username);
8585
platform.put("browserstack.accessKey", accessKey);
86-
if(System.getProperty("local") == "true") {
86+
if(Objects.equals(System.getProperty("local"), "true")) {
8787
platform.put("browserstack.local", "true");
8888
HashMap<String, String> localOptions = new HashMap<>();
8989
localOptions.put("key", accessKey);

src/test/java/tests/SampleTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ public class SampleTest {
99
@PlaywrightTest
1010
void singleTest(Browser browser) {
1111
Page page = browser.newPage();
12+
// Update Session Name
13+
String sessionName = new Object(){}.getClass().getEnclosingMethod().getName();
14+
page.evaluate("_ => {}", "browserstack_executor: {\"action\": \"setSessionName\", \"arguments\": {\"name\": \"" + sessionName + "\"}}");
1215
try {
1316
page.navigate("https://bstackdemo.com/");
1417
String product_name = page.locator("//*[@id='1']/p").textContent();
1518
page.locator("//*[@id='1']/div[4]").click();
1619
page.locator(".float\\-cart__content");
1720
String product_in_cart = page.locator("//*[@id='__next']/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1]").textContent();
21+
// Update Test Status
1822
if (product_name.equals(product_in_cart)) {
1923
page.evaluate("_ => {}", "browserstack_executor: { \"action\": \"setSessionStatus\", \"arguments\": { \"status\": \"" + "passed" + "\", \"reason\": \"" + "Product has been successfully added to the cart!" + "\"}}");
2024
} else {

src/test/resources/conf/browserstack.conf.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
"build": "browserstack-build-1",
88
"buildTag": "Regression",
99
"browserstack.debug": "true",
10-
"browserstack.console": "info",
11-
"browserstack.networkLogs": "true",
12-
"browserstack.networkLogsOptions":
13-
{
14-
"captureContent": "true"
15-
}
10+
"browserstack.console": "info"
1611
},
1712
"environments": [
1813
{

target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ runners/PlaywrightTest.class
55
runners/BstackRunner$1.class
66
utils/SetupLocalTesting.class
77
utils/SetupLocalTesting$Closer.class
8+
tests/SampleTest$1.class

target/surefire-reports/TEST-tests.SampleTest.xml

Lines changed: 6 additions & 11 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-------------------------------------------------------------------------------
22
Test set: tests.SampleTest
33
-------------------------------------------------------------------------------
4-
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 28.088 s - in tests.SampleTest
4+
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 22.542 s - in tests.SampleTest

target/test-classes/conf/browserstack.conf.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
"build": "browserstack-build-1",
88
"buildTag": "Regression",
99
"browserstack.debug": "true",
10-
"browserstack.console": "info",
11-
"browserstack.networkLogs": "true",
12-
"browserstack.networkLogsOptions":
13-
{
14-
"captureContent": "true"
15-
}
10+
"browserstack.console": "info"
1611
},
1712
"environments": [
1813
{
-151 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)