Skip to content

Instantly share code, notes, and snippets.

@daleharvey
Created March 23, 2020 12:53
Show Gist options
  • Save daleharvey/9b2257384d187ee3d8ee677947605e74 to your computer and use it in GitHub Desktop.
Save daleharvey/9b2257384d187ee3d8ee677947605e74 to your computer and use it in GitHub Desktop.
let extension = await installSearchExtension("example", "Example", "1.0");
extension = await installSearchExtension("example", "Example", "2.0");
async function installSearchExtension(id, name, version) {
let extensionInfo = {
useAddonManager: "permanent",
manifest: {
version,
applications: {
gecko: {
id: `${id}@tests.mozilla.org`,
},
},
chrome_settings_overrides: {
search_provider: {
name,
search_url: `https://example.com/?q={searchTerms}&version=${version}`,
},
},
},
};
let extension = ExtensionTestUtils.loadExtension(extensionInfo);
await extension.startup();
return extension;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment