Run JavaScript examples #1391
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run JavaScript examples | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '40 22 * * *' | |
pull_request: | |
branches: | |
- trunk | |
paths: | |
- 'examples/javascript/**' | |
push: | |
branches: | |
- trunk | |
paths: | |
- 'examples/javascript/**' | |
env: | |
DISPLAY: :99 | |
GITHUB_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }} | |
GH_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }} | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu, windows, macos ] | |
release: [ stable, nightly ] | |
runs-on: ${{ format('{0}-latest', matrix.os) }} | |
steps: | |
- name: Checkout GitHub repo | |
uses: actions/checkout@v4 | |
- name: Remove driver directories Windows | |
if: matrix.os == 'windows' | |
run: | | |
rm "$env:ChromeWebDriver" -r -v | |
rm "$env:EdgeWebDriver" -r -v | |
rm "$env:GeckoWebDriver" -r -v | |
- name: Remove driver directories Non-Windows | |
if: matrix.os != 'windows' | |
run: | | |
sudo rm -rf $CHROMEWEBDRIVER $EDGEWEBDRIVER $GECKOWEBDRIVER | |
- name: Start Xvfb | |
if: matrix.os == 'ubuntu' | |
run: Xvfb :99 & | |
- name: Setup Node Stable | |
if: matrix.release == 'stable' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.x' | |
- name: Setup Node Nightly | |
if: matrix.release == 'nightly' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.x' | |
registry-url: 'https://npm.pkg.github.com' | |
- name: Use Nightly package.json in Ubuntu/macOS | |
if: matrix.release == 'nightly' && matrix.os != 'windows' | |
run: | |
| | |
pip install -r ./scripts/requirements.txt | |
latest_nightly=$(python ./scripts/latest-nightly-version.py npm selenium-webdriver) | |
echo $latest_nightly | |
npm install --prefix ./examples/javascript --save selenium-webdriver@npm:@seleniumhq/selenium-webdriver@$latest_nightly | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Use Nightly package.json in Windows | |
if: matrix.release == 'nightly' && matrix.os == 'windows' | |
run: | |
| | |
pip install -r ./scripts/requirements.txt | |
$latest_nightly = python ./scripts/latest-nightly-version.py npm selenium-webdriver | |
npm install --prefix ./examples/javascript --save selenium-webdriver@npm:@seleniumhq/selenium-webdriver@$latest_nightly | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Requirements | |
working-directory: ./examples/javascript | |
run: npm install | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run tests | |
uses: nick-invision/retry@v3.0.2 | |
with: | |
timeout_minutes: 20 | |
max_attempts: 2 | |
command: | | |
cd examples/javascript | |
npm test |