test_docker: align container launch with playwright-browsers (#1919)
This commit is contained in:
@@ -28,24 +28,49 @@ jobs:
|
||||
matrix:
|
||||
flavor: [jammy, noble]
|
||||
runs-on: [ubuntu-24.04, ubuntu-24.04-arm]
|
||||
include:
|
||||
- runs-on: ubuntu-24.04
|
||||
arch: amd64
|
||||
- runs-on: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
ARCH="${{ matrix.runs-on == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}"
|
||||
bash utils/docker/build.sh --$ARCH ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
|
||||
bash utils/docker/build.sh --${{ matrix.arch }} ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
|
||||
- name: Start container
|
||||
run: |
|
||||
CONTAINER_ID=$(docker run --rm -e CI -e PW_MAX_RETRIES --ipc=host -v "$(pwd)":/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-${{ matrix.flavor }} /bin/bash)
|
||||
CONTAINER_ID=$(docker run \
|
||||
--rm \
|
||||
--name playwright-docker-test \
|
||||
--platform linux/${{ matrix.arch }} \
|
||||
--user=pwuser \
|
||||
--workdir /home/pwuser \
|
||||
--shm-size=2g \
|
||||
-e CI \
|
||||
-e PW_MAX_RETRIES \
|
||||
-d -t \
|
||||
playwright-java:localbuild-${{ matrix.flavor }} /bin/bash)
|
||||
echo "CONTAINER_ID=$CONTAINER_ID" >> $GITHUB_ENV
|
||||
|
||||
- name: Run test in container
|
||||
- name: Copy repository inside docker container
|
||||
run: |
|
||||
docker exec "$CONTAINER_ID" /root/playwright/tools/test-local-installation/create_project_and_run_tests.sh
|
||||
docker cp . "$CONTAINER_ID":/home/pwuser/playwright
|
||||
# /root/.m2 was populated as root during image build; move it to
|
||||
# pwuser so the locally-installed SNAPSHOT artifacts resolve.
|
||||
docker exec --user root "$CONTAINER_ID" bash -c '
|
||||
chown -R pwuser /home/pwuser/playwright
|
||||
mv /root/.m2 /home/pwuser/.m2
|
||||
chown -R pwuser /home/pwuser/.m2
|
||||
'
|
||||
|
||||
- name: Run smoke tests in container
|
||||
run: |
|
||||
docker exec "$CONTAINER_ID" /home/pwuser/playwright/tools/test-local-installation/create_project_and_run_tests.sh -Dgroups=smoke
|
||||
|
||||
- name: Test ClassLoader
|
||||
run: |
|
||||
docker exec "${CONTAINER_ID}" /root/playwright/tools/test-spring-boot-starter/package_and_run_async_test.sh
|
||||
docker exec "${CONTAINER_ID}" /home/pwuser/playwright/tools/test-spring-boot-starter/package_and_run_async_test.sh
|
||||
|
||||
- name: Stop container
|
||||
run: |
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.microsoft.playwright.junit.FixtureTest;
|
||||
import com.microsoft.playwright.junit.UsePlaywright;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIf;
|
||||
|
||||
@@ -30,6 +31,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@FixtureTest
|
||||
@UsePlaywright(TestOptionsFactories.BasicOptionsFactory.class)
|
||||
@Tag("smoke")
|
||||
public class TestBrowser1 {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.microsoft.playwright;
|
||||
|
||||
import com.microsoft.playwright.junit.FixtureTest;
|
||||
import com.microsoft.playwright.junit.UsePlaywright;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.OutputStreamWriter;
|
||||
@@ -32,6 +33,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@FixtureTest
|
||||
@UsePlaywright(TestOptionsFactories.BasicOptionsFactory.class)
|
||||
@Tag("smoke")
|
||||
public class TestBrowserContextBasic {
|
||||
@Test
|
||||
void shouldCreateNewContext(Browser browser) {
|
||||
|
||||
@@ -17,12 +17,14 @@
|
||||
package com.microsoft.playwright;
|
||||
|
||||
import com.microsoft.playwright.options.KeyboardModifier;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@Tag("smoke")
|
||||
public class TestLocatorClick extends TestBase {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.microsoft.playwright;
|
||||
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledIf;
|
||||
|
||||
@@ -30,6 +31,7 @@ import static com.microsoft.playwright.options.LoadState.LOAD;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@Tag("smoke")
|
||||
public class TestPageBasic extends TestBase {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.microsoft.playwright;
|
||||
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -24,6 +25,7 @@ import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@Tag("smoke")
|
||||
public class TestSelectorsCss extends TestBase {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -14,6 +14,6 @@ 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
|
||||
mvn test --no-transfer-progress "$@"
|
||||
|
||||
rm -rf $PROJECT_DIR
|
||||
|
||||
Reference in New Issue
Block a user