diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml new file mode 100644 index 00000000..1023daba --- /dev/null +++ b/.github/workflows/test_docker.yml @@ -0,0 +1,28 @@ +name: Test Docker +on: + push: + paths: + - '.github/workflows/test_docker.yml' + - 'Dockerfile*' + branches: + - master + - release-* + pull_request: + paths: + - '.github/workflows/test_docker.yml' + - 'Dockerfile*' + branches: + - master + - release-* +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Build Docker image + run: docker build -t playwright-java:localbuild-focal -f Dockerfile.focal . + - name: Test + run: | + CONTAINER_ID="$(docker run --rm --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-focal /bin/bash)" + docker exec "${CONTAINER_ID}" /root/playwright/tools/test-local-installation/create_project_and_run_tests.sh diff --git a/Dockerfile.focal b/Dockerfile.focal index cee1b1d8..90c6981f 100644 --- a/Dockerfile.focal +++ b/Dockerfile.focal @@ -136,5 +136,6 @@ COPY . /tmp/pw-java RUN cd /tmp/pw-java && \ ./scripts/download_driver_for_all_platforms.sh && \ mvn install -D skipTests --no-transfer-progress && \ - mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install" -f playwright/pom.xml && \ + mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \ + -D exec.args="install" -f playwright/pom.xml --no-transfer-progress && \ rm -rf /tmp/pw-java diff --git a/tools/test-local-installation/create_project_and_run_tests.sh b/tools/test-local-installation/create_project_and_run_tests.sh new file mode 100755 index 00000000..525ca924 --- /dev/null +++ b/tools/test-local-installation/create_project_and_run_tests.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e +set +x + +trap "cd $(pwd -P)" EXIT +cd "$(dirname $0)" + + +PROJECT_DIR=$(mktemp -d) +echo "Creating project in $PROJECT_DIR" +cp -R . $PROJECT_DIR +cp -R ../../driver-bundle/src/test/ $PROJECT_DIR/src/ +cp -R ../../playwright/src/test/ $PROJECT_DIR/src/ +cd $PROJECT_DIR + +mvn test --no-transfer-progress + +rm -rf $PROJECT_DIR diff --git a/tools/test-local-installation/pom.xml b/tools/test-local-installation/pom.xml new file mode 100644 index 00000000..315ede68 --- /dev/null +++ b/tools/test-local-installation/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + com.microsoft.playwright + test-local-installation + 1.10.0-SNAPSHOT + Test local installation + Runs Playwright test suite (copied from playwright module) against locally cached Playwright + + 1.8 + 2.8.6 + 5.7.0 + UTF-8 + 1.5.1 + + + + com.microsoft.playwright + playwright + ${project.version} + + + com.google.code.gson + gson + ${gson.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + test + + + org.java-websocket + Java-WebSocket + ${websocket.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${compiler.version} + ${compiler.version} + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + true + + + + + diff --git a/tools/test-local-installation/src/README.md b/tools/test-local-installation/src/README.md new file mode 100644 index 00000000..344bf0a9 --- /dev/null +++ b/tools/test-local-installation/src/README.md @@ -0,0 +1,2 @@ +This derictory is populated with test files from playwright and playwright-driver projects. They are copied +here on each test run.