Skip to content

Commit

Permalink
Remove node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Mar 28, 2023
1 parent 25efa68 commit ebb42a3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ 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: |
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 @@ -49,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 @@ -68,6 +72,10 @@ 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
- uses: ./
if: matrix.branch == 'now'
- uses: nanasess/setup-chromedriver@master
Expand All @@ -78,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
16 changes: 12 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ jobs:
- shell: pwsh
run: echo "CHROMEAPP=C:\Program Files\Google\Chrome\Application\chrome.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- run: yarn install --frozen-lockfile
shell: bash
- 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 @@ -50,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 @@ -64,15 +68,19 @@ jobs:
- shell: pwsh
run: echo "CHROMEAPP=C:\Program Files\Google\Chrome\Application\chrome.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- run: yarn install --frozen-lockfile
shell: bash
- 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

0 comments on commit ebb42a3

Please sign in to comment.