diff --git a/.github/workflows/browser-tests.yml b/.github/workflows/browser-tests.yml new file mode 100644 index 00000000..eedc96db --- /dev/null +++ b/.github/workflows/browser-tests.yml @@ -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 diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index c2284317..75ffbc8a 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -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 }} diff --git a/package.json b/package.json index 2934cf56..f12e695f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/runner/selenium/createDriver.js b/test/runner/selenium/createDriver.js index 095c1221..df120476 100644 --- a/test/runner/selenium/createDriver.js +++ b/test/runner/selenium/createDriver.js @@ -2,6 +2,7 @@ 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 @@ -9,9 +10,16 @@ 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 ); @@ -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" ); @@ -65,6 +77,7 @@ export default async function createDriver( { browserName, headless, url, verbos .setChromeOptions( chromeOptions ) .setFirefoxOptions( firefoxOptions ) .setEdgeOptions( edgeOptions ) + .setIeOptions( ieOptions ) .build(); if ( verbose ) {