test_docker: align container launch with playwright-browsers (#1919)
This commit is contained in:
@@ -28,24 +28,49 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
flavor: [jammy, noble]
|
flavor: [jammy, noble]
|
||||||
runs-on: [ubuntu-24.04, ubuntu-24.04-arm]
|
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:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
ARCH="${{ matrix.runs-on == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}"
|
bash utils/docker/build.sh --${{ matrix.arch }} ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
|
||||||
bash utils/docker/build.sh --$ARCH ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
|
|
||||||
- name: Start container
|
- name: Start container
|
||||||
run: |
|
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
|
echo "CONTAINER_ID=$CONTAINER_ID" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Run test in container
|
- name: Copy repository inside docker container
|
||||||
run: |
|
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
|
- name: Test ClassLoader
|
||||||
run: |
|
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
|
- name: Stop container
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.microsoft.playwright.junit.FixtureTest;
|
import com.microsoft.playwright.junit.FixtureTest;
|
||||||
import com.microsoft.playwright.junit.UsePlaywright;
|
import com.microsoft.playwright.junit.UsePlaywright;
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.condition.EnabledIf;
|
import org.junit.jupiter.api.condition.EnabledIf;
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
|
|
||||||
@FixtureTest
|
@FixtureTest
|
||||||
@UsePlaywright(TestOptionsFactories.BasicOptionsFactory.class)
|
@UsePlaywright(TestOptionsFactories.BasicOptionsFactory.class)
|
||||||
|
@Tag("smoke")
|
||||||
public class TestBrowser1 {
|
public class TestBrowser1 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.microsoft.playwright;
|
|||||||
|
|
||||||
import com.microsoft.playwright.junit.FixtureTest;
|
import com.microsoft.playwright.junit.FixtureTest;
|
||||||
import com.microsoft.playwright.junit.UsePlaywright;
|
import com.microsoft.playwright.junit.UsePlaywright;
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
@@ -32,6 +33,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
|
|
||||||
@FixtureTest
|
@FixtureTest
|
||||||
@UsePlaywright(TestOptionsFactories.BasicOptionsFactory.class)
|
@UsePlaywright(TestOptionsFactories.BasicOptionsFactory.class)
|
||||||
|
@Tag("smoke")
|
||||||
public class TestBrowserContextBasic {
|
public class TestBrowserContextBasic {
|
||||||
@Test
|
@Test
|
||||||
void shouldCreateNewContext(Browser browser) {
|
void shouldCreateNewContext(Browser browser) {
|
||||||
|
|||||||
@@ -17,12 +17,14 @@
|
|||||||
package com.microsoft.playwright;
|
package com.microsoft.playwright;
|
||||||
|
|
||||||
import com.microsoft.playwright.options.KeyboardModifier;
|
import com.microsoft.playwright.options.KeyboardModifier;
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
|
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.asList;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@Tag("smoke")
|
||||||
public class TestLocatorClick extends TestBase {
|
public class TestLocatorClick extends TestBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.microsoft.playwright;
|
package com.microsoft.playwright;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
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 java.util.Arrays.asList;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
@Tag("smoke")
|
||||||
public class TestPageBasic extends TestBase {
|
public class TestPageBasic extends TestBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.microsoft.playwright;
|
package com.microsoft.playwright;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -24,6 +25,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
@Tag("smoke")
|
||||||
public class TestSelectorsCss extends TestBase {
|
public class TestSelectorsCss extends TestBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ cp -R ../../driver-bundle/src/test/ $PROJECT_DIR/src/
|
|||||||
cp -R ../../playwright/src/test/ $PROJECT_DIR/src/
|
cp -R ../../playwright/src/test/ $PROJECT_DIR/src/
|
||||||
cd $PROJECT_DIR
|
cd $PROJECT_DIR
|
||||||
|
|
||||||
mvn test --no-transfer-progress
|
mvn test --no-transfer-progress "$@"
|
||||||
|
|
||||||
rm -rf $PROJECT_DIR
|
rm -rf $PROJECT_DIR
|
||||||
|
|||||||
Reference in New Issue
Block a user