Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ncc #148

Merged
merged 5 commits into from
Mar 29, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 14 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ jobs:
run: echo 'CHROMEAPP=google-chrome' >> $GITHUB_ENV
- if: startsWith(matrix.os, 'macos')
run: echo 'CHROMEAPP=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' >> $GITHUB_ENV
- run: rm -rf node_modules && yarn install --frozen-lockfile
- run: yarn install --frozen-lockfile
- 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: |
CHROME_VERSION=$("$CHROMEAPP" --version | cut -f 3 -d ' ' | cut -d '.' -f 1)
echo "CHROMEDRIVER_VERSION=$(curl --location --fail --retry 10 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION})" >> $GITHUB_ENV
Expand All @@ -48,7 +53,7 @@ jobs:
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # disable headless mode
yarn ts-node $GITHUB_WORKSPACE/__tests__/chromedriver.ts
node $GITHUB_WORKSPACE/__tests__/index.js

test_default_version:
runs-on: ${{ matrix.os }}
Expand All @@ -63,9 +68,14 @@ jobs:
run: echo 'CHROMEAPP=google-chrome' >> $GITHUB_ENV
- if: startsWith(matrix.os, 'macos')
run: echo 'CHROMEAPP=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' >> $GITHUB_ENV
- run: rm -rf node_modules && yarn install --frozen-lockfile
- run: yarn install --frozen-lockfile
- 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
- uses: ./
if: matrix.branch == 'now'
- uses: nanasess/setup-chromedriver@master
Expand All @@ -76,4 +86,4 @@ jobs:
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # disable headless mode
yarn ts-node $GITHUB_WORKSPACE/__tests__/chromedriver.ts
node $GITHUB_WORKSPACE/__tests__/index.js
22 changes: 16 additions & 6 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ jobs:
- uses: actions/checkout@v3
- shell: pwsh
run: echo "CHROMEAPP=C:\Program Files\Google\Chrome\Application\chrome.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- run: rm -rf node_modules && yarn install --frozen-lockfile
shell: bash
- run: yarn install --frozen-lockfile
- 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
- shell: pwsh
run: |
$chrome_fullversion = (Get-Item $Env:CHROMEAPP).VersionInfo.FileVersion
Expand All @@ -49,7 +54,7 @@ jobs:
- name: setup
run: |
chromedriver --url-base=/wd/hub &
yarn ts-node "$Env:GITHUB_WORKSPACE\__tests__\chromedriver.ts"
node "$Env:GITHUB_WORKSPACE\__tests__\index.js"

test_default_version:
runs-on: ${{ matrix.os }}
Expand All @@ -62,15 +67,20 @@ jobs:
- uses: actions/checkout@v3
- shell: pwsh
run: echo "CHROMEAPP=C:\Program Files\Google\Chrome\Application\chrome.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- run: rm -rf node_modules && yarn install --frozen-lockfile
shell: bash
- run: yarn install --frozen-lockfile
- 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
- uses: ./
if: matrix.branch == 'now'
- uses: nanasess/setup-chromedriver@master
if: matrix.branch == 'master'
- name: setup
run: |
chromedriver --url-base=/wd/hub &
yarn ts-node "$Env:GITHUB_WORKSPACE\__tests__\chromedriver.ts"
node "$Env:GITHUB_WORKSPACE\__tests__\index.js"
5 changes: 3 additions & 2 deletions __tests__/chromedriver.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Builder, Capabilities, until, By, Key } from 'selenium-webdriver';
(async () => {
const timeout = 30000;
const driver = new Builder()
.withCapabilities(Capabilities.chrome())
.build();
try {
await driver.get('https://google.com');
await driver.wait(until.titleContains('Google'), 5000);
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'), 5000);
await driver.wait(until.titleContains('ChromeDriver'), timeout);
console.log(await driver.getTitle());
} finally {
driver.quit();
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ inputs:
required: false
runs:
using: 'node16'
main: 'lib/setup-chromedriver.js'
main: 'dist/index.js'

Loading