Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- .github/workflows/test_docker.yml
- '**/Dockerfile*'
- scripts/DRIVER_VERSION
- scripts/NODE_VERSION
- '**/pom.xml'
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cd playwright-java
scripts/download_driver.sh
```

Each driver is assembled from the [`playwright-core`](https://www.npmjs.com/package/playwright-core) npm package (version pinned in [scripts/DRIVER_VERSION](scripts/DRIVER_VERSION)) and the matching Node.js binary from https://nodejs.org, the same way the upstream Playwright build does it.
Each driver is assembled from the [`playwright-core`](https://www.npmjs.com/package/playwright-core) npm package (version pinned in [scripts/DRIVER_VERSION](scripts/DRIVER_VERSION)) and the latest Node.js binary of the major version pinned in [scripts/NODE_VERSION](scripts/NODE_VERSION) from https://nodejs.org, the same way the upstream Playwright build does it.

### Building and running the tests with Maven

Expand Down
1 change: 1 addition & 0 deletions scripts/NODE_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
26
29 changes: 16 additions & 13 deletions scripts/download_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ if [[ ($1 == '-h') || ($1 == '--help') ]]; then
echo ""
echo "This script downloads and assembles the Playwright driver for all platforms."
echo "The platform-independent 'playwright-core' npm package is assembled once into the driver"
echo "module ('driver/src/main/resources/driver/package'), and the matching Node.js binary from"
echo "https://nodejs.org for each platform goes into the driver-bundle module"
echo "('driver-bundle/src/main/resources/driver/<platform>'), the same way the upstream"
echo "Playwright build does it."
echo "module ('driver/src/main/resources/driver/package'), and the Node.js binary from"
echo "https://nodejs.org (major version pinned in scripts/NODE_VERSION) for each platform goes"
echo "into the driver-bundle module ('driver-bundle/src/main/resources/driver/<platform>'), the"
echo "same way the upstream Playwright build does it."
echo ""
echo "Usage: scripts/download_driver.sh [option]"
echo ""
Expand Down Expand Up @@ -46,13 +46,19 @@ npm_at_root() {
(cd "$ROOT" && npm "$@")
}

# The Node.js version used to be pinned in the upstream driver build script. The script was
# removed in microsoft/playwright#41518, so we follow the same policy it had: the latest
# Node.js LTS (see upstream utils/build/update-playwright-node.mjs).
NODE_VERSION=$(curl -fsSL "https://nodejs.org/dist/index.json" \
| node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log(JSON.parse(s).find(r=>r.lts).version.slice(1)))")
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT

# scripts/NODE_VERSION pins the Node.js major version, like ARG NODE_VERSION in the upstream
# Docker images. Use the latest release of that major version.
NODE_MAJOR_VERSION=$(head -1 ./NODE_VERSION)
# The checksum list of the latest release names every file after the release, e.g.
# d38bd5e5... node-v26.13.0-darwin-arm64.tar.gz
SHASUMS="$TMP_DIR/SHASUMS256.txt"
download "https://nodejs.org/dist/latest-v$NODE_MAJOR_VERSION.x/SHASUMS256.txt" "$SHASUMS"
NODE_VERSION=$(sed -nE 's/.*node-v([0-9]+\.[0-9]+\.[0-9]+)-.*/\1/p' "$SHASUMS" | head -1)
if [[ -z "$NODE_VERSION" ]]; then
echo "Failed to determine the latest Node.js LTS version"
echo "Failed to determine the latest Node.js $NODE_MAJOR_VERSION.x version"
exit 1
fi

Expand All @@ -64,9 +70,6 @@ echo "Node.js version: $NODE_VERSION"
CORE_DEST="$ROOT/driver/src/main/resources/driver"
NODE_DEST="$ROOT/driver-bundle/src/main/resources/driver"

TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT

# 1. playwright-core package -> driver module (once, shared by every platform).
echo "Assembling playwright-core package to $CORE_DEST/package"
rm -rf "$CORE_DEST/package"
Expand Down
10 changes: 4 additions & 6 deletions scripts/roll_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ fi
CURRENT_VERSION=$(head -1 ./DRIVER_VERSION)
echo "Rolling driver from $CURRENT_VERSION to $NEW_VERSION"

if [[ "$CURRENT_VERSION" == "$NEW_VERSION" ]]; then
echo "Current version is up to date. Skipping driver download.";
else
echo $NEW_VERSION > ./DRIVER_VERSION
./download_driver.sh
fi;
echo $NEW_VERSION > ./DRIVER_VERSION
# Download even when the driver version is unchanged: the driver bundles the latest release
# of the Node.js major version pinned in NODE_VERSION.
./download_driver.sh

./generate_api.sh
./update_readme.sh
Expand Down
2 changes: 2 additions & 0 deletions utils/docker/Dockerfile.jammy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ RUN find /etc/apt -type f \( -name '*.list' -o -name '*.sources' \) \
wget \
# Install utilities required for downloading driver
unzip \
# The Node.js binary of the driver links against libatomic (since Node.js 25)
libatomic1 \
# For the MSEdge install script
gpg && \
rm -rf /var/lib/apt/lists/* && \
Expand Down
2 changes: 2 additions & 0 deletions utils/docker/Dockerfile.noble
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ RUN find /etc/apt -type f \( -name '*.list' -o -name '*.sources' \) \
wget \
# Install utilities required for downloading driver
unzip \
# The Node.js binary of the driver links against libatomic (since Node.js 25)
libatomic1 \
# For the MSEdge install script
gpg && \
rm -rf /var/lib/apt/lists/* && \
Expand Down
2 changes: 2 additions & 0 deletions utils/docker/Dockerfile.resolute
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ RUN find /etc/apt -type f \( -name '*.list' -o -name '*.sources' \) \
wget \
# Install utilities required for downloading driver
unzip \
# The Node.js binary of the driver links against libatomic (since Node.js 25)
libatomic1 \
# For the MSEdge install script
gpg && \
rm -rf /var/lib/apt/lists/* && \
Expand Down
Loading