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 3232 run : |
3333 ARCH="${{ matrix.runs-on == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}"
3434 bash utils/docker/build.sh --$ARCH ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
35- - name : Test
35+ - name : Start container
3636 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 {
114114 }
115115
116116 public static URI getDriverResourceURI () throws URISyntaxException {
117- ClassLoader classloader = Thread . currentThread (). getContextClassLoader ();
117+ ClassLoader classloader = DriverJar . class . getClassLoader ();
118118 return classloader .getResource ("driver/" + platformDir ()).toURI ();
119119 }
120120
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 55import org .springframework .boot .SpringApplication ;
66import org .springframework .boot .autoconfigure .SpringBootApplication ;
77
8+ import java .util .Arrays ;
9+ import java .util .concurrent .CompletableFuture ;
10+
811@ SpringBootApplication
912public class TestApp implements CommandLineRunner {
1013
@@ -14,6 +17,19 @@ public static void main(String[] args) {
1417
1518 @ Override
1619 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 () {
1733 try (Playwright playwright = Playwright .create ()) {
1834 BrowserType browserType = getBrowserTypeFromEnv (playwright );
1935 System .out .println ("Running test with " + browserType .name ());
You can’t perform that action at this time.
0 commit comments