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

[ci] Test multiple OS with latest Node version #1878

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
30 changes: 23 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: 'Test Selenium IDE'

on:
workflow_dispatch:
pull_request:
branches:
- trunk
Expand All @@ -19,26 +20,41 @@ jobs:
repository-projects: read
security-events: read
statuses: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
- os: macos-latest
runs-on: ${{ matrix.os }}
if: github.repository == 'seleniumhq/selenium-ide'
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8.11.0
version: 'latest'
- uses: actions/setup-node@v3
with:
node-version: '20.x'
node-version: 'latest'
cache: 'pnpm'
- name: Install dependencies
run: pnpm -r i
- name: Build side-runner and selenium-ide
run: npm run build
- name: Install xvfb
run: sudo apt-get update -y && sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: Run all tests and also use xvfb
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -y && sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
export DISPLAY=:99
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Run all tests
if: matrix.os != 'windows-latest'
run: |
npm run test:ci
- name: Run all tests on Windows
if: matrix.os == 'windows-latest'
run: |
npm run test:ci:windows

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"test:jest:core": "jest",
"test": "npm run test:jest && npm run test:side-runner && npm run test:ide && npm run test:code-export",
"test:ci": "npm-run-bg -s 'http-server -p 8080 ./packages/side-testkit/fixtures/static::Available on::8080' 'npm run pretest && npm run test:jest:core && npm run test:side-runner:ci'",
"test:ci:windows": "npm-run-bg -s \"http-server -p 8080 ./packages/side-testkit/fixtures/static::Available on::8080\" \"npm run pretest && npm run test:jest:core && npm run test:side-runner:ci\"",
"test:jest": "npm-run-bg -s 'http-server -p 8080 ./packages/side-testkit/fixtures/static::Available on::8080' 'npm run test:jest:core'",
"lint": "pnpm run lint:scripts",
"lint:scripts": "eslint --ignore-pattern node_modules --ignore-pattern third-party --ignore-pattern dist --ignore-pattern build --ignore-pattern json --ext .ts,.tsx --ext .js packages/",
Expand Down
35 changes: 34 additions & 1 deletion packages/browser-info/src/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ const CHROME_BETA_LINUX_INSTALL_LOCATIONS = [
'/opt/google/chrome-beta/google-chrome-beta',
]

const CHROME_STABLE_WINDOWS_INSTALL_LOCATIONS = [
'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
]

const CHROME_BETA_WINDOWS_INSTALL_LOCATIONS = [
'C:\\Program Files (x86)\\Google\\Chrome Beta\\Application\\chrome.exe',
'C:\\Program Files\\Google\\Chrome Beta\\Application\\chrome.exe',
]

export namespace Chrome {
export async function getBrowserInfo(channel?: ChromeChannel) {
const platform = os.platform()
Expand Down Expand Up @@ -103,7 +113,30 @@ export namespace Chrome {
].map((p) => p.catch(() => {}))
)
).filter(Boolean) as BrowserInfo[]
} else {
} else if (platform === 'win32') {
if (channel) {
switch (channel) {
case ChromeChannel.stable: {
return await getChromeInfo(CHROME_STABLE_WINDOWS_INSTALL_LOCATIONS)
}
case ChromeChannel.beta: {
return await getChromeInfo(CHROME_BETA_WINDOWS_INSTALL_LOCATIONS)
}
default: {
throw new Error(`Unsupported channel ${channel}`)
}
}
}
return (
await Promise.all(
[
getChromeInfo(CHROME_STABLE_WINDOWS_INSTALL_LOCATIONS),
getChromeInfo(CHROME_BETA_WINDOWS_INSTALL_LOCATIONS),
].map((p) => p.catch(() => {}))
)
).filter(Boolean) as BrowserInfo[]
}
else {
throw new Error('Unsupported platform')
}
}
Expand Down
Loading