-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
node/selenium-webdriver/firefox.js: accept zip webextensions (#7464)
Firefox allow loading zipped WebExtensions
- Loading branch information
Showing
3 changed files
with
21 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+4.58 KB
javascript/node/selenium-webdriver/lib/test/data/firefox/webextension.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,10 @@ const {Context} = require('../firefox'); | |
const {Pages, suite, ignore} = require('../lib/test'); | ||
|
||
|
||
const WEBEXTENSION_EXTENSION = | ||
const WEBEXTENSION_EXTENSION_XPI = | ||
path.join(__dirname, '../lib/test/data/firefox/webextension.xpi'); | ||
const WEBEXTENSION_EXTENSION_ZIP = | ||
path.join(__dirname, '../lib/test/data/firefox/webextension.zip'); | ||
|
||
const WEBEXTENSION_EXTENSION_ID = | ||
'[email protected]'; | ||
|
@@ -57,7 +59,7 @@ suite(function(env) { | |
await io.mkdir(extensionsDir); | ||
await io.write( | ||
path.join(extensionsDir, WEBEXTENSION_EXTENSION_ID), | ||
await io.read(WEBEXTENSION_EXTENSION)); | ||
await io.read(WEBEXTENSION_EXTENSION_XPI)); | ||
}); | ||
|
||
before(async function createProfileWithUserPrefs() { | ||
|
@@ -133,7 +135,7 @@ suite(function(env) { | |
describe('addExtensions', function() { | ||
it('can add extension to brand new profile', async function() { | ||
let options = new firefox.Options(); | ||
options.addExtensions(WEBEXTENSION_EXTENSION); | ||
options.addExtensions(WEBEXTENSION_EXTENSION_XPI); | ||
|
||
driver = env.builder().setFirefoxOptions(options).build(); | ||
|
||
|
@@ -143,7 +145,7 @@ suite(function(env) { | |
|
||
it('can add extension to custom profile', async function() { | ||
let options = new firefox.Options() | ||
.addExtensions(WEBEXTENSION_EXTENSION) | ||
.addExtensions(WEBEXTENSION_EXTENSION_XPI) | ||
.setProfile(profileWithUserPrefs); | ||
|
||
driver = env.builder().setFirefoxOptions(options).build(); | ||
|
@@ -155,7 +157,7 @@ suite(function(env) { | |
|
||
it('can addExtensions and setPreference', async function() { | ||
let options = new firefox.Options() | ||
.addExtensions(WEBEXTENSION_EXTENSION) | ||
.addExtensions(WEBEXTENSION_EXTENSION_XPI) | ||
.setPreference('general.useragent.override', 'foo;bar') | ||
|
||
driver = env.builder().setFirefoxOptions(options).build(); | ||
|
@@ -164,6 +166,16 @@ suite(function(env) { | |
await verifyWebExtensionWasInstalled(); | ||
await verifyUserAgentWasChanged(); | ||
}); | ||
|
||
it('can load .zip webextensions', async function() { | ||
let options = new firefox.Options(); | ||
options.addExtensions(WEBEXTENSION_EXTENSION_ZIP); | ||
|
||
driver = env.builder().setFirefoxOptions(options).build(); | ||
|
||
await driver.get(Pages.echoPage); | ||
await verifyWebExtensionWasInstalled(); | ||
}); | ||
}); | ||
}); | ||
|
||
|
@@ -199,7 +211,7 @@ suite(function(env) { | |
await driver.get(Pages.echoPage); | ||
await verifyWebExtensionNotInstalled(); | ||
|
||
let id = await driver.installAddon(WEBEXTENSION_EXTENSION); | ||
let id = await driver.installAddon(WEBEXTENSION_EXTENSION_XPI); | ||
await driver.sleep(1000); // Give extension time to install (yuck). | ||
|
||
await driver.get(Pages.echoPage); | ||
|