diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 769166eb2..ed19b9693 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -87,6 +87,34 @@ jobs: - name: Run tests run: npm run ${{ matrix.NPM_SCRIPT }} + ie: + runs-on: windows-latest + env: + NODE_VERSION: 20.x + name: test:ie - IE + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + 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 in Edge in IE mode + run: npm run test:ie + safari: runs-on: macos-latest env: diff --git a/package.json b/package.json index cdbdd4e76..1c330ddd9 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,10 @@ "test:jsdom": "npm run pretest && npm run build:main && npm run test:unit -- -b jsdom -m basic", "test:node_smoke_tests": "npm run pretest && npm run build:all && node build/tasks/node_smoke_tests.js", "test:promises_aplus": "npm run build:main && node build/tasks/promises_aplus_tests.js", + "test:chrome": "npm run pretest && npm run build:main && npm run test:unit -- -v -b chrome -h", + "test:edge": "npm run pretest && npm run build:main && npm run test:unit -- -v -b edge -h", "test:firefox": "npm run pretest && npm run build:main && npm run test:unit -- -v -b firefox -h", + "test:ie": "npm run pretest && npm run build:main && npm run test:unit -- -v -b ie", "test:safari": "npm run pretest && npm run build:main && npm run test:unit -- -b safari", "test:server": "node test/runner/server.js", "test:amd": "npm run pretest && npm run build:main && npm run test:unit -- --amd -h", diff --git a/test/runner/selenium/createDriver.js b/test/runner/selenium/createDriver.js index 095c12214..df1204763 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 ) {