File tree Expand file tree Collapse file tree 4 files changed +40
-4
lines changed
driver-bundle/src/main/java/com/microsoft/playwright/impl/driver/jar
tools/test-spring-boot-starter
src/main/java/com/microsoft/playwright/springboottest Expand file tree Collapse file tree 4 files changed +40
-4
lines changed Original file line number Diff line number Diff line change 32
32
run : |
33
33
ARCH="${{ matrix.runs-on == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}"
34
34
bash utils/docker/build.sh --$ARCH ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
35
- - name : Test
35
+ - name : Start container
36
36
run : |
37
- CONTAINER_ID="$(docker run --rm -e CI --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-${{ matrix.flavor }} /bin/bash)"
38
- docker exec "${CONTAINER_ID}" /root/playwright/tools/test-local-installation/create_project_and_run_tests.sh
37
+ CONTAINER_ID=$(docker run --rm -e CI --ipc=host -v "$(pwd)":/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-${{ matrix.flavor }} /bin/bash)
38
+ echo "CONTAINER_ID=$CONTAINER_ID" >> $GITHUB_ENV
39
+
40
+ - name : Run test in container
41
+ run : |
42
+ docker exec "$CONTAINER_ID" /root/playwright/tools/test-local-installation/create_project_and_run_tests.sh
43
+
44
+ - name : Test ClassLoader
45
+ run : |
46
+ docker exec "${CONTAINER_ID}" /root/playwright/tools/test-spring-boot-starter/package_and_run_async_test.sh
47
+
48
+ - name : Stop container
49
+ run : |
50
+ docker stop "$CONTAINER_ID"
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ private FileSystem initFileSystem(URI uri) throws IOException {
114
114
}
115
115
116
116
public static URI getDriverResourceURI () throws URISyntaxException {
117
- ClassLoader classloader = Thread . currentThread (). getContextClassLoader ();
117
+ ClassLoader classloader = DriverJar . class . getClassLoader ();
118
118
return classloader .getResource ("driver/" + platformDir ()).toURI ();
119
119
}
120
120
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+ set +x
5
+
6
+ cd " $( dirname " $0 " ) "
7
+ mvn package -D skipTests --no-transfer-progress
8
+ java -jar target/test-spring-boot-starter* .jar --async
Original file line number Diff line number Diff line change 5
5
import org .springframework .boot .SpringApplication ;
6
6
import org .springframework .boot .autoconfigure .SpringBootApplication ;
7
7
8
+ import java .util .Arrays ;
9
+ import java .util .concurrent .CompletableFuture ;
10
+
8
11
@ SpringBootApplication
9
12
public class TestApp implements CommandLineRunner {
10
13
@@ -14,6 +17,19 @@ public static void main(String[] args) {
14
17
15
18
@ Override
16
19
public void run (String ... args ) {
20
+ if (Arrays .asList (args ).contains ("--async" )) {
21
+ runAsync ();
22
+ } else {
23
+ runSync ();
24
+ }
25
+ }
26
+
27
+ private void runAsync () {
28
+ CompletableFuture <Void > voidCompletableFuture = CompletableFuture .runAsync (this ::runSync );
29
+ voidCompletableFuture .join ();
30
+ }
31
+
32
+ private void runSync () {
17
33
try (Playwright playwright = Playwright .create ()) {
18
34
BrowserType browserType = getBrowserTypeFromEnv (playwright );
19
35
System .out .println ("Running test with " + browserType .name ());
You can’t perform that action at this time.
0 commit comments