Skip to content

Commit 579e08e

Browse files
authored
Build: Test more browsers and jquery versions in pull requests
Improve the actions setup for PRs so that more issues are detected pre-merge. Changes: 1. Test on Edge in IE mode 2. Test on more jQuery versions: `git`, `3.x-git`, `3.7.1` & their slim versions as well as full versions of each `3.x` jQuery minor. This is still fewer tests than post-merge: we don't test all slim versions and Migrate dev, but this should cover the majority of cases. Closes jquerygh-551
1 parent bfd4b3a commit 579e08e

File tree

4 files changed

+145
-71
lines changed

4 files changed

+145
-71
lines changed

.github/workflows/browser-tests.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Browser Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
NODE_VERSION: 20.x
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
name: ${{ matrix.BROWSER }} (${{ matrix.MIGRATE_VERSION }} Migrate)
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
BROWSER: ["chrome", "firefox"]
20+
MIGRATE_VERSION: ["min"]
21+
include:
22+
- NAME: "Node"
23+
BROWSER: "chrome"
24+
MIGRATE_VERSION: "esmodules"
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
28+
29+
- name: Use Node.js ${{ env.NODE_VERSION }}
30+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
31+
with:
32+
node-version: ${{ env.NODE_VERSION }}
33+
34+
- name: Cache
35+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
36+
with:
37+
path: ~/.npm
38+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
39+
restore-keys: |
40+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
41+
42+
- name: Install dependencies
43+
run: npm install
44+
45+
- name: Run tests
46+
run: |
47+
npm run pretest
48+
npm run test:unit -- -b ${{ matrix.BROWSER }} -h \
49+
--jquery-migrate ${{ matrix.MIGRATE_VERSION }} \
50+
--jquery git --jquery git.min --jquery git.slim --jquery git.slim.min \
51+
--jquery 3.x-git --jquery 3.x-git.min --jquery 3.x-git.slim --jquery 3.x-git.slim.min \
52+
--jquery 3.7.1 --jquery 3.7.1.slim \
53+
--jquery 3.6.4 --jquery 3.5.1 --jquery 3.4.1 \
54+
--jquery 3.3.1 --jquery 3.2.1 --jquery 3.1.1 --jquery 3.0.0 \
55+
--retries 1
56+
57+
ie:
58+
runs-on: windows-latest
59+
name: Edge in IE mode (min Migrate)
60+
env:
61+
MIGRATE_VERSION: "min"
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
65+
66+
- name: Use Node.js ${{ env.NODE_VERSION }}
67+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
68+
with:
69+
node-version: ${{ env.NODE_VERSION }}
70+
71+
- name: Cache
72+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
73+
with:
74+
path: ~/.npm
75+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
76+
restore-keys: |
77+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
78+
79+
- name: Install dependencies
80+
run: npm install
81+
82+
- name: Run tests
83+
shell: cmd
84+
run: |
85+
npm run test:ie -- ^
86+
--jquery-migrate ${{ env.MIGRATE_VERSION }} ^
87+
--jquery git --jquery git.min --jquery git.slim --jquery git.slim.min ^
88+
--jquery 3.x-git --jquery 3.x-git.min --jquery 3.x-git.slim --jquery 3.x-git.slim.min ^
89+
--jquery 3.7.1 --jquery 3.7.1.slim ^
90+
--jquery 3.6.4 --jquery 3.5.1 --jquery 3.4.1 ^
91+
--jquery 3.3.1 --jquery 3.2.1 --jquery 3.1.1 --jquery 3.0.0 ^
92+
--retries 1
93+
94+
safari:
95+
runs-on: macos-latest
96+
name: Safari (min Migrate)
97+
env:
98+
MIGRATE_VERSION: "min"
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
102+
103+
- name: Use Node.js ${{ env.NODE_VERSION }}
104+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
105+
with:
106+
node-version: ${{ env.NODE_VERSION }}
107+
108+
- name: Cache
109+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
110+
with:
111+
path: ~/.npm
112+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
113+
restore-keys: |
114+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
115+
116+
- name: Install dependencies
117+
run: npm install
118+
119+
- name: Run tests
120+
run: |
121+
npm run test:safari -- \
122+
--jquery-migrate ${{ env.MIGRATE_VERSION }} \
123+
--jquery git --jquery git.min --jquery git.slim --jquery git.slim.min \
124+
--jquery 3.x-git --jquery 3.x-git.min --jquery 3.x-git.slim --jquery 3.x-git.slim.min \
125+
--jquery 3.7.1 --jquery 3.7.1.slim \
126+
--jquery 3.6.4 --jquery 3.5.1 --jquery 3.4.1 \
127+
--jquery 3.3.1 --jquery 3.2.1 --jquery 3.1.1 --jquery 3.0.0 \
128+
--retries 1

.github/workflows/node.js.yml

-68
Original file line numberDiff line numberDiff line change
@@ -34,71 +34,3 @@ jobs:
3434

3535
- name: Run Node smoke tests
3636
run: npm run test:node_smoke_tests
37-
38-
test:
39-
runs-on: ubuntu-latest
40-
name: ${{ matrix.MIGRATE_VERSION }} - jQuery ${{ matrix.JQUERY_VERSION }} (Chrome/Firefox)
41-
strategy:
42-
fail-fast: false
43-
matrix:
44-
MIGRATE_VERSION: ["min"]
45-
JQUERY_VERSION: ["git.min", "git.slim.min", "3.x-git.min", "3.x-git.slim.min"]
46-
include:
47-
- MIGRATE_VERSION: "esmodules"
48-
JQUERY_VERSION: "3.x-git.slim.min"
49-
steps:
50-
- name: Checkout
51-
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
52-
53-
- name: Use Node.js ${{ env.NODE_VERSION }}
54-
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
55-
with:
56-
node-version: ${{ env.NODE_VERSION }}
57-
58-
- name: Cache
59-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
60-
with:
61-
path: ~/.npm
62-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
63-
restore-keys: |
64-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
65-
66-
- name: Install dependencies
67-
run: npm install
68-
69-
- name: Run tests
70-
run: npm run test:browser -- --jquery-migrate=${{ matrix.MIGRATE_VERSION }} --jquery=${{ matrix.JQUERY_VERSION }}
71-
72-
safari:
73-
runs-on: macos-latest
74-
name: ${{ matrix.MIGRATE_VERSION }} - jQuery ${{ matrix.JQUERY_VERSION }} (Safari)
75-
strategy:
76-
fail-fast: false
77-
matrix:
78-
MIGRATE_VERSION: ["min"]
79-
JQUERY_VERSION: ["git.min", "git.slim.min", "3.x-git.min", "3.x-git.slim.min"]
80-
steps:
81-
- name: Checkout
82-
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
83-
84-
- name: Use Node.js ${{ env.NODE_VERSION }}
85-
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
86-
with:
87-
node-version: ${{ env.NODE_VERSION }}
88-
89-
- name: Cache
90-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
91-
with:
92-
path: ~/.npm
93-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
94-
restore-keys: |
95-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
96-
97-
- name: Install dependencies
98-
run: npm install
99-
100-
- name: Run tests
101-
run: |
102-
npm run test:safari -- \
103-
--jquery-migrate=${{ matrix.MIGRATE_VERSION }} \
104-
--jquery=${{ matrix.JQUERY_VERSION }}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"pretest": "npm run npmcopy && npm run build && npm run lint",
2727
"start": "npm run npmcopy && node build/tasks/build-watch.js",
2828
"test:browser": "npm run pretest && npm run test:unit -- -b chrome -b firefox -h",
29+
"test:ie": "npm run pretest && npm run test:unit -- -v -b ie",
2930
"test:node_smoke_tests": "npm run pretest && node test/node_smoke_tests/smoke_tests.cjs",
3031
"test:safari": "npm run pretest && npm run test:unit -- -v -b safari",
3132
"test:server": "node test/runner/server.js",

test/runner/selenium/createDriver.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@ import { Builder, Capabilities, logging } from "selenium-webdriver";
22
import Chrome from "selenium-webdriver/chrome.js";
33
import Edge from "selenium-webdriver/edge.js";
44
import Firefox from "selenium-webdriver/firefox.js";
5+
import IE from "selenium-webdriver/ie.js";
56
import { browserSupportsHeadless } from "../lib/getBrowserString.js";
67

78
// Set script timeout to 10min
89
const DRIVER_SCRIPT_TIMEOUT = 1000 * 60 * 10;
910

1011
export default async function createDriver( { browserName, headless, url, verbose } ) {
1112
const capabilities = Capabilities[ browserName ]();
12-
const prefs = new logging.Preferences();
13-
prefs.setLevel( logging.Type.BROWSER, logging.Level.ALL );
14-
capabilities.setLoggingPrefs( prefs );
13+
14+
// Support: IE 11+
15+
// When those are set for IE, the process crashes with an error:
16+
// "Unable to match capability set 0: goog:loggingPrefs is an unknown
17+
// extension capability for IE".
18+
if ( browserName !== "ie" ) {
19+
const prefs = new logging.Preferences();
20+
prefs.setLevel( logging.Type.BROWSER, logging.Level.ALL );
21+
capabilities.setLoggingPrefs( prefs );
22+
}
1523

1624
let driver = new Builder().withCapabilities( capabilities );
1725

@@ -49,6 +57,10 @@ export default async function createDriver( { browserName, headless, url, verbos
4957
edgeOptions.setEdgeChromiumBinaryPath( process.env.EDGE_BIN );
5058
}
5159

60+
const ieOptions = new IE.Options();
61+
ieOptions.setEdgeChromium( true );
62+
ieOptions.setEdgePath( "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" );
63+
5264
if ( headless ) {
5365
chromeOptions.addArguments( "--headless=new" );
5466
firefoxOptions.addArguments( "--headless" );
@@ -65,6 +77,7 @@ export default async function createDriver( { browserName, headless, url, verbos
6577
.setChromeOptions( chromeOptions )
6678
.setFirefoxOptions( firefoxOptions )
6779
.setEdgeOptions( edgeOptions )
80+
.setIeOptions( ieOptions )
6881
.build();
6982

7083
if ( verbose ) {

0 commit comments

Comments
 (0)