File tree 9 files changed +50
-25
lines changed
main/java/com/saucelabs/saucebindings
test/java/com/saucelabs/saucebindings/examples 9 files changed +50
-25
lines changed Original file line number Diff line number Diff line change 125
125
<groupId >org.apache.maven.plugins</groupId >
126
126
<artifactId >maven-surefire-plugin</artifactId >
127
127
<version >3.1.2</version >
128
- <configuration >
129
- <properties >
130
- <configurationParameters >
131
- junit.jupiter.execution.parallel.enabled = true
132
- junit.jupiter.execution.parallel.mode.default = concurrent
133
- junit.jupiter.execution.parallel.config.strategy = fixed
134
- junit.jupiter.execution.parallel.config.fixed.parallelism = ${surefire.parallel}
135
- junit.jupiter.execution.parallel.config.fixed.max-pool-size = ${surefire.parallel}
136
- </configurationParameters >
137
- </properties >
138
- </configuration >
128
+ <executions >
129
+ <execution >
130
+ <id >parallel-tests</id >
131
+ <goals >
132
+ <goal >test</goal >
133
+ </goals >
134
+ <configuration >
135
+ <properties >
136
+ <configurationParameters >
137
+ junit.jupiter.execution.parallel.enabled = true
138
+ junit.jupiter.execution.parallel.mode.default = concurrent
139
+ junit.jupiter.execution.parallel.config.strategy = fixed
140
+ junit.jupiter.execution.parallel.config.fixed.parallelism = ${surefire.parallel}
141
+ junit.jupiter.execution.parallel.config.fixed.max-pool-size = ${surefire.parallel}
142
+ </configurationParameters >
143
+ </properties >
144
+ </configuration >
145
+ </execution >
146
+ <execution >
147
+ <id >sequential-tests</id >
148
+ <goals >
149
+ <goal >test</goal >
150
+ </goals >
151
+ <configuration >
152
+ <includes >
153
+ <include >**/*Example.java</include >
154
+ </includes >
155
+ <properties >
156
+ <configurationParameters >
157
+ junit.jupiter.execution.parallel.enabled = false
158
+ </configurationParameters >
159
+ </properties >
160
+ </configuration >
161
+ </execution >
162
+ </executions >
139
163
</plugin >
140
164
<plugin >
141
165
<groupId >org.apache.maven.plugins</groupId >
Original file line number Diff line number Diff line change 7
7
import java .net .MalformedURLException ;
8
8
import java .net .URL ;
9
9
import java .util .List ;
10
- import java .util .Objects ;
11
10
import lombok .Getter ;
12
11
import lombok .Setter ;
13
12
import org .openqa .selenium .Capabilities ;
@@ -275,6 +274,11 @@ public void addTags(List<String> tags) {
275
274
driver .executeScript ("sauce:job-tags=" + tagString );
276
275
}
277
276
277
+ public static boolean isDisabled () {
278
+ return Boolean .parseBoolean (System .getenv ("SAUCE_DISABLED" ))
279
+ || Boolean .getBoolean ("sauce.disabled" );
280
+ }
281
+
278
282
/**
279
283
* @deprecated Do not use magic strings, pass in boolean for whether test has passed.
280
284
*/
@@ -330,8 +334,4 @@ private void validateMac(String msg) {
330
334
throw new InvalidArgumentException (error );
331
335
}
332
336
}
333
-
334
- private boolean isDisabled () {
335
- return Objects .equals (System .getProperty ("saucelabs" ), "false" );
336
- }
337
337
}
Original file line number Diff line number Diff line change 5
5
import org .junit .jupiter .api .Test ;
6
6
import org .openqa .selenium .remote .RemoteWebDriver ;
7
7
8
- public class AccessibilityTest {
8
+ public class AccessibilityExample {
9
9
10
10
@ Test
11
11
public void startSession () {
Original file line number Diff line number Diff line change 6
6
import org .openqa .selenium .chrome .ChromeOptions ;
7
7
import org .openqa .selenium .remote .RemoteWebDriver ;
8
8
9
- public class BrowserOptionsTest {
9
+ public class BrowserOptionsExample {
10
10
11
11
@ Test
12
12
public void browserOptions () {
Original file line number Diff line number Diff line change 5
5
import org .junit .jupiter .api .Test ;
6
6
import org .openqa .selenium .remote .RemoteWebDriver ;
7
7
8
- public class CommonOptionsTest {
8
+ public class CommonOptionsExample {
9
9
10
10
@ Test
11
11
public void basicOptions () {
Original file line number Diff line number Diff line change 4
4
import org .junit .jupiter .api .Test ;
5
5
import org .openqa .selenium .remote .RemoteWebDriver ;
6
6
7
- public class DataCenterTest {
7
+ public class DataCenterExample {
8
8
9
9
@ Test
10
10
public void changeDataCenter () {
Original file line number Diff line number Diff line change 7
7
import org .junit .jupiter .api .Test ;
8
8
import org .openqa .selenium .WebDriver ;
9
9
10
- public class DisableTest {
10
+ public class DisableExample {
11
11
12
12
@ Test
13
13
public void startSession () {
14
14
// 1. Toggle off sauce labs
15
- System .setProperty ("saucelabs " , "false " );
15
+ System .setProperty ("sauce.disabled " , "true " );
16
16
17
17
// 2. Create a Sauce Session
18
18
SauceSession session = new SauceSession ();
@@ -22,6 +22,7 @@ public void startSession() {
22
22
Assertions .assertNull (driver );
23
23
24
24
// 4. All session commands will be ignored
25
+ Assertions .assertNull (session .getDriver ());
25
26
Assertions .assertDoesNotThrow (
26
27
() -> {
27
28
session .annotate ("This gets ignored" );
@@ -35,6 +36,6 @@ public void startSession() {
35
36
36
37
@ AfterEach
37
38
public void stopSession () {
38
- System .clearProperty ("saucelabs " );
39
+ System .clearProperty ("sauce.disabled " );
39
40
}
40
41
}
Original file line number Diff line number Diff line change 6
6
import org .junit .jupiter .api .Test ;
7
7
import org .openqa .selenium .remote .RemoteWebDriver ;
8
8
9
- public class SauceLabsOptionsTest {
9
+ public class SauceLabsOptionsExample {
10
10
11
11
@ Test
12
12
public void sauceOptions () {
Original file line number Diff line number Diff line change 4
4
import org .junit .jupiter .api .Test ;
5
5
import org .openqa .selenium .remote .RemoteWebDriver ;
6
6
7
- public class SessionTest {
7
+ public class SessionExample {
8
8
9
9
@ Test
10
10
public void startSession () {
You can’t perform that action at this time.
0 commit comments