Skip to content

Commit a078dd9

Browse files
committed
[ci] Test multiple OS with latest Node version
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 5d595cd commit a078dd9

File tree

3 files changed

+58
-8
lines changed

3 files changed

+58
-8
lines changed

.github/workflows/test.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 'Test Selenium IDE'
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
branches:
67
- trunk
@@ -19,26 +20,41 @@ jobs:
1920
repository-projects: read
2021
security-events: read
2122
statuses: read
22-
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
include:
27+
- os: ubuntu-latest
28+
- os: windows-latest
29+
- os: macos-latest
30+
runs-on: ${{ matrix.os }}
2331
if: github.repository == 'seleniumhq/selenium-ide'
2432
steps:
25-
- uses: actions/checkout@v4
33+
- name: Checkout code
34+
uses: actions/checkout@v4
2635
- uses: pnpm/action-setup@v2
2736
with:
28-
version: 8.11.0
37+
version: 'latest'
2938
- uses: actions/setup-node@v3
3039
with:
31-
node-version: '20.x'
40+
node-version: 'latest'
3241
cache: 'pnpm'
3342
- name: Install dependencies
3443
run: pnpm -r i
3544
- name: Build side-runner and selenium-ide
3645
run: npm run build
3746
- name: Install xvfb
38-
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
39-
- name: Run all tests and also use xvfb
47+
if: matrix.os == 'ubuntu-latest'
4048
run: |
49+
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
4150
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
42-
export DISPLAY=:99
51+
echo "DISPLAY=:99" >> $GITHUB_ENV
52+
- name: Run all tests
53+
if: matrix.os != 'windows-latest'
54+
run: |
4355
npm run test:ci
56+
- name: Run all tests on Windows
57+
if: matrix.os == 'windows-latest'
58+
run: |
59+
npm run test:ci:windows
4460

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"test:jest:core": "jest",
2020
"test": "npm run test:jest && npm run test:side-runner && npm run test:ide && npm run test:code-export",
2121
"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'",
22+
"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\"",
2223
"test:jest": "npm-run-bg -s 'http-server -p 8080 ./packages/side-testkit/fixtures/static::Available on::8080' 'npm run test:jest:core'",
2324
"lint": "pnpm run lint:scripts",
2425
"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/",

packages/browser-info/src/chrome.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ const CHROME_BETA_LINUX_INSTALL_LOCATIONS = [
5555
'/opt/google/chrome-beta/google-chrome-beta',
5656
]
5757

58+
const CHROME_STABLE_WINDOWS_INSTALL_LOCATIONS = [
59+
'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
60+
'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
61+
]
62+
63+
const CHROME_BETA_WINDOWS_INSTALL_LOCATIONS = [
64+
'C:\\Program Files (x86)\\Google\\Chrome Beta\\Application\\chrome.exe',
65+
'C:\\Program Files\\Google\\Chrome Beta\\Application\\chrome.exe',
66+
]
67+
5868
export namespace Chrome {
5969
export async function getBrowserInfo(channel?: ChromeChannel) {
6070
const platform = os.platform()
@@ -103,7 +113,30 @@ export namespace Chrome {
103113
].map((p) => p.catch(() => {}))
104114
)
105115
).filter(Boolean) as BrowserInfo[]
106-
} else {
116+
} else if (platform === 'win32') {
117+
if (channel) {
118+
switch (channel) {
119+
case ChromeChannel.stable: {
120+
return await getChromeInfo(CHROME_STABLE_WINDOWS_INSTALL_LOCATIONS)
121+
}
122+
case ChromeChannel.beta: {
123+
return await getChromeInfo(CHROME_BETA_WINDOWS_INSTALL_LOCATIONS)
124+
}
125+
default: {
126+
throw new Error(`Unsupported channel ${channel}`)
127+
}
128+
}
129+
}
130+
return (
131+
await Promise.all(
132+
[
133+
getChromeInfo(CHROME_STABLE_WINDOWS_INSTALL_LOCATIONS),
134+
getChromeInfo(CHROME_BETA_WINDOWS_INSTALL_LOCATIONS),
135+
].map((p) => p.catch(() => {}))
136+
)
137+
).filter(Boolean) as BrowserInfo[]
138+
}
139+
else {
107140
throw new Error('Unsupported platform')
108141
}
109142
}

0 commit comments

Comments
 (0)