Skip to content

Commit

Permalink
Merge pull request #370 from nanasess/master
Browse files Browse the repository at this point in the history
Merged from master to v2
  • Loading branch information
nanasess authored Dec 3, 2024
2 parents e226512 + e93e57b commit 5ff44aa
Show file tree
Hide file tree
Showing 14 changed files with 25,554 additions and 2,414 deletions.
46 changes: 34 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-20.04, macos-latest, macos-11 ]
os:
- ubuntu-latest
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-20.04
- macos-latest
- macos-14
- macos-13
- macos-12
branch:
# - 'master'
- 'now'
Expand All @@ -39,10 +47,12 @@ jobs:
- run: yarn build
- run: yarn package
- run: yarn test
- run: |
node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
rm -rf node_modules
# - run: |
# node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
# # Cannot find chromedriver when using ncc.
# # see https://github.com/nanasess/setup-chromedriver/issues/303
# # node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
# # rm -rf node_modules
- if: matrix.chrome_version != 'current'
env:
CHROME_VERSION: ${{ matrix.chrome_version }}
Expand All @@ -63,23 +73,33 @@ jobs:
if: matrix.branch == 'now'
with:
chromedriver-version: ${{ env.CHROMEDRIVER_VERSION }}
chromeapp: ${{ env.CHROMEAPP }}
- uses: nanasess/setup-chromedriver@master
if: matrix.branch == 'master'
with:
chromedriver-version: ${{ env.CHROMEDRIVER_VERSION }}
chromeapp: ${{ env.CHROMEAPP }}
- name: setup
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # disable headless mode
node $GITHUB_WORKSPACE/__tests__/index.js
node_modules/.bin/ts-node $GITHUB_WORKSPACE/__tests__/chromedriver.ts
test_default_version:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-20.04, macos-latest, macos-11 ]
os:
- ubuntu-latest
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-20.04
- macos-latest
- macos-14
- macos-13
- macos-12
branch:
# - 'master'
- 'now'
Expand All @@ -93,10 +113,12 @@ jobs:
- run: yarn build
- run: yarn package
- run: yarn test
- run: |
node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
rm -rf node_modules
# - run: |
# node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
# # Cannot find chromedriver when using ncc.
# # see https://github.com/nanasess/setup-chromedriver/issues/303
# # node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
# rm -rf node_modules
- uses: ./
if: matrix.branch == 'now'
- uses: nanasess/setup-chromedriver@master
Expand All @@ -107,4 +129,4 @@ jobs:
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # disable headless mode
node $GITHUB_WORKSPACE/__tests__/index.js
node_modules/.bin/ts-node $GITHUB_WORKSPACE/__tests__/chromedriver.ts
30 changes: 18 additions & 12 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ jobs:
- run: yarn build
- run: yarn package
- run: yarn test
- run: |
node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
rm -rf node_modules
shell: bash
# - run: |
# node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
# # Cannot find chromedriver when using ncc.
# # see https://github.com/nanasess/setup-chromedriver/issues/303
# # node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
# # rm -rf node_modules
# shell: bash
- shell: pwsh
run: |
$chrome_fullversion = (Get-Item $Env:CHROMEAPP).VersionInfo.FileVersion
Expand All @@ -56,14 +58,16 @@ jobs:
if: matrix.branch == 'now'
with:
chromedriver-version: ${{ env.CHROMEDRIVER_VERSION }}
chromeapp: ${{ env.CHROMEAPP }}
- uses: nanasess/setup-chromedriver@master
if: matrix.branch == 'master'
with:
chromedriver-version: ${{ env.CHROMEDRIVER_VERSION }}
chromeapp: ${{ env.CHROMEAPP }}
- name: setup
run: |
chromedriver --url-base=/wd/hub &
node "$Env:GITHUB_WORKSPACE\__tests__\index.js"
node_modules\.bin\ts-node "$Env:GITHUB_WORKSPACE\__tests__\chromedriver.ts"
test_default_version:
runs-on: ${{ matrix.os }}
Expand All @@ -82,16 +86,18 @@ jobs:
- run: yarn build
- run: yarn package
- run: yarn test
- run: |
node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
rm -rf node_modules
shell: bash
# - run: |
# node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
# # Cannot find chromedriver when using ncc.
# # see https://github.com/nanasess/setup-chromedriver/issues/303
# # node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
# # rm -rf node_modules
# shell: bash
- uses: ./
if: matrix.branch == 'now'
- uses: nanasess/setup-chromedriver@master
if: matrix.branch == 'master'
- name: setup
run: |
chromedriver --url-base=/wd/hub &
node "$Env:GITHUB_WORKSPACE\__tests__\index.js"
node_modules\.bin\ts-node "$Env:GITHUB_WORKSPACE\__tests__\chromedriver.ts"
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ This action sets up a [ChromeDriver](https://chromedriver.chromium.org/) for use

## OS/Platform support

- ubuntu-latest, ubuntu-22.04 and ubuntu-20.04
- macos-latest, macos-12 and macos-11
- ubuntu-latest, ubuntu-24.04, ubuntu-22.04 and ubuntu-20.04
- macos-latest, macos-14, macos-13 and macos-12
- windows-latest, windows-2022 and windows-2019

# Usage
Expand All @@ -26,6 +26,8 @@ steps:
with:
# Optional: do not specify to match Chrome's version
chromedriver-version: '88.0.4324.96'
# Optional: if your chrome binary name is different
chromeapp: chrome
- run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
Expand Down
16 changes: 7 additions & 9 deletions __tests__/chromedriver.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { Builder, Capabilities, until, By, Key } from 'selenium-webdriver';
import { Builder, Capabilities, until, By, Key } from "selenium-webdriver";
(async () => {
const timeout = 30000;
const driver = new Builder()
.withCapabilities(Capabilities.chrome())
.build();
const driver = new Builder().withCapabilities(Capabilities.chrome()).build();
try {
await driver.get('https://google.com');
await driver.wait(until.titleContains('Google'), timeout);
await driver.get("https://google.com");
await driver.wait(until.titleContains("Google"), timeout);
console.log(await driver.getTitle());

const searchBox = await driver.findElement(By.name('q'));
await searchBox.sendKeys('ChromeDriver', Key.RETURN);
await driver.wait(until.titleContains('ChromeDriver'), timeout);
const searchBox = await driver.findElement(By.name("q"));
await searchBox.sendKeys("ChromeDriver", Key.RETURN);
await driver.wait(until.titleContains("ChromeDriver"), timeout);
console.log(await driver.getTitle());
} finally {
driver.quit();
Expand Down
16 changes: 9 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: 'setup-chromedriver'
description: 'Setup chromedriver'
author: 'nanasess'
name: "setup-chromedriver"
description: "Setup chromedriver"
author: "nanasess"
inputs:
chromedriver-version:
description: 'The chromedriver version to install'
description: "The chromedriver version to install"
required: false
chromeapp:
description: "Custom chrome binary name (for Linux or MacOS)"
required: false
runs:
using: 'node20'
main: 'dist/index.js'

using: "node20"
main: "dist/index.js"
Loading

0 comments on commit 5ff44aa

Please sign in to comment.