Skip to content

Build: Test more browsers and jquery versions in pull requests #551

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

Merged
merged 1 commit into from
Oct 29, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions .github/workflows/browser-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Browser Tests

on:
pull_request:
push:
branches:
- main

env:
NODE_VERSION: 20.x

jobs:
test:
runs-on: ubuntu-latest
name: ${{ matrix.BROWSER }} (${{ matrix.MIGRATE_VERSION }} Migrate)
strategy:
fail-fast: false
matrix:
BROWSER: ["chrome", "firefox"]
MIGRATE_VERSION: ["min"]
include:
- NAME: "Node"
BROWSER: "chrome"
MIGRATE_VERSION: "esmodules"
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-

- name: Install dependencies
run: npm install

- name: Run tests
run: |
npm run pretest
npm run test:unit -- -b ${{ matrix.BROWSER }} -h \
--jquery-migrate ${{ matrix.MIGRATE_VERSION }} \
--jquery git --jquery git.min --jquery git.slim --jquery git.slim.min \
--jquery 3.x-git --jquery 3.x-git.min --jquery 3.x-git.slim --jquery 3.x-git.slim.min \
--jquery 3.7.1 --jquery 3.7.1.slim \
--jquery 3.6.4 --jquery 3.5.1 --jquery 3.4.1 \
--jquery 3.3.1 --jquery 3.2.1 --jquery 3.1.1 --jquery 3.0.0 \
--retries 1

ie:
runs-on: windows-latest
name: Edge in IE mode (min Migrate)
env:
MIGRATE_VERSION: "min"
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-

- name: Install dependencies
run: npm install

- name: Run tests
shell: cmd
run: |
npm run test:ie -- ^
--jquery-migrate ${{ env.MIGRATE_VERSION }} ^
--jquery git --jquery git.min --jquery git.slim --jquery git.slim.min ^
--jquery 3.x-git --jquery 3.x-git.min --jquery 3.x-git.slim --jquery 3.x-git.slim.min ^
--jquery 3.7.1 --jquery 3.7.1.slim ^
--jquery 3.6.4 --jquery 3.5.1 --jquery 3.4.1 ^
--jquery 3.3.1 --jquery 3.2.1 --jquery 3.1.1 --jquery 3.0.0 ^
--retries 1

safari:
runs-on: macos-latest
name: Safari (min Migrate)
env:
MIGRATE_VERSION: "min"
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-

- name: Install dependencies
run: npm install

- name: Run tests
run: |
npm run test:safari -- \
--jquery-migrate ${{ env.MIGRATE_VERSION }} \
--jquery git --jquery git.min --jquery git.slim --jquery git.slim.min \
--jquery 3.x-git --jquery 3.x-git.min --jquery 3.x-git.slim --jquery 3.x-git.slim.min \
--jquery 3.7.1 --jquery 3.7.1.slim \
--jquery 3.6.4 --jquery 3.5.1 --jquery 3.4.1 \
--jquery 3.3.1 --jquery 3.2.1 --jquery 3.1.1 --jquery 3.0.0 \
--retries 1
68 changes: 0 additions & 68 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,71 +34,3 @@ jobs:

- name: Run Node smoke tests
run: npm run test:node_smoke_tests

test:
runs-on: ubuntu-latest
name: ${{ matrix.MIGRATE_VERSION }} - jQuery ${{ matrix.JQUERY_VERSION }} (Chrome/Firefox)
strategy:
fail-fast: false
matrix:
MIGRATE_VERSION: ["min"]
JQUERY_VERSION: ["git.min", "git.slim.min", "3.x-git.min", "3.x-git.slim.min"]
include:
- MIGRATE_VERSION: "esmodules"
JQUERY_VERSION: "3.x-git.slim.min"
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-

- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test:browser -- --jquery-migrate=${{ matrix.MIGRATE_VERSION }} --jquery=${{ matrix.JQUERY_VERSION }}

safari:
runs-on: macos-latest
name: ${{ matrix.MIGRATE_VERSION }} - jQuery ${{ matrix.JQUERY_VERSION }} (Safari)
strategy:
fail-fast: false
matrix:
MIGRATE_VERSION: ["min"]
JQUERY_VERSION: ["git.min", "git.slim.min", "3.x-git.min", "3.x-git.slim.min"]
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-

- name: Install dependencies
run: npm install

- name: Run tests
run: |
npm run test:safari -- \
--jquery-migrate=${{ matrix.MIGRATE_VERSION }} \
--jquery=${{ matrix.JQUERY_VERSION }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"pretest": "npm run npmcopy && npm run build && npm run lint",
"start": "npm run npmcopy && node build/tasks/build-watch.js",
"test:browser": "npm run pretest && npm run test:unit -- -b chrome -b firefox -h",
"test:ie": "npm run pretest && npm run test:unit -- -v -b ie",
"test:node_smoke_tests": "npm run pretest && node test/node_smoke_tests/smoke_tests.cjs",
"test:safari": "npm run pretest && npm run test:unit -- -v -b safari",
"test:server": "node test/runner/server.js",
Expand Down
19 changes: 16 additions & 3 deletions test/runner/selenium/createDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ import { Builder, Capabilities, logging } from "selenium-webdriver";
import Chrome from "selenium-webdriver/chrome.js";
import Edge from "selenium-webdriver/edge.js";
import Firefox from "selenium-webdriver/firefox.js";
import IE from "selenium-webdriver/ie.js";
import { browserSupportsHeadless } from "../lib/getBrowserString.js";

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

export default async function createDriver( { browserName, headless, url, verbose } ) {
const capabilities = Capabilities[ browserName ]();
const prefs = new logging.Preferences();
prefs.setLevel( logging.Type.BROWSER, logging.Level.ALL );
capabilities.setLoggingPrefs( prefs );

// Support: IE 11+
// When those are set for IE, the process crashes with an error:
// "Unable to match capability set 0: goog:loggingPrefs is an unknown
// extension capability for IE".
if ( browserName !== "ie" ) {
const prefs = new logging.Preferences();
prefs.setLevel( logging.Type.BROWSER, logging.Level.ALL );
capabilities.setLoggingPrefs( prefs );
}

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

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

const ieOptions = new IE.Options();
ieOptions.setEdgeChromium( true );
ieOptions.setEdgePath( "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" );

if ( headless ) {
chromeOptions.addArguments( "--headless=new" );
firefoxOptions.addArguments( "--headless" );
Expand All @@ -65,6 +77,7 @@ export default async function createDriver( { browserName, headless, url, verbos
.setChromeOptions( chromeOptions )
.setFirefoxOptions( firefoxOptions )
.setEdgeOptions( edgeOptions )
.setIeOptions( ieOptions )
.build();

if ( verbose ) {
Expand Down
Loading