aboutsummaryrefslogtreecommitdiffstats
path: root/test/runner/selenium/createDriver.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2024-09-09 18:24:28 +0200
committerGitHub <noreply@github.com>2024-09-09 18:24:28 +0200
commit6d78c0768d9aa6ba213678724c89af69a1958df6 (patch)
tree9a4b65317ac5af425710f8d9496cf05bfcbca0d9 /test/runner/selenium/createDriver.js
parent4b7ecbad24463c875f03ef4c7a7d307a091f93fd (diff)
downloadjquery-6d78c0768d9aa6ba213678724c89af69a1958df6.tar.gz
jquery-6d78c0768d9aa6ba213678724c89af69a1958df6.zip
Tests: Run tests in Edge in IE mode in GitHub Actions
While Edge in IE mode is not guaranteed to match IE 11 in every aspect, in practice it generally does. Testing in this mode in GitHub Actions will allow us to catch most IE-breaking issues at the PR level. This change also adds missing npm scripts: `test:chrome`, `test:edge` & `test:ie`. Closes gh-5540
Diffstat (limited to 'test/runner/selenium/createDriver.js')
-rw-r--r--test/runner/selenium/createDriver.js19
1 files changed, 16 insertions, 3 deletions
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 ) {