Skip to content

Commit

Permalink
Updating Firefox AddOns for Testing (SeleniumHQ#13999)
Browse files Browse the repository at this point in the history
* Updating Firefox AddOns for Testing

* Running format script.

---------

Co-authored-by: Titus Fortner <[email protected]>
  • Loading branch information
2 people authored and sandeepsuryaprasad committed Oct 29, 2024
1 parent a884490 commit bc6b650
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 45 deletions.
1 change: 0 additions & 1 deletion .skipped-tests
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta
-//rb/spec/integration/selenium/webdriver:element-chrome
-//rb/spec/integration/selenium/webdriver/firefox:driver-firefox-beta
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-bidi
-//rb/spec/integration/selenium/webdriver/edge:service-edge-bidi
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-bidi
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Manifest-Version: 1.0

Name: inject.js
Digest-Algorithms: SHA1 SHA256
SHA1-Digest: b2nrco3zOUBDJuyARPlsNEU8O9A=
SHA256-Digest: lU8GPe0dnC/AH4PaP0/akwta9vNay0n7fsgkBOieLsg=

Name: manifest.json
Digest-Algorithms: SHA1 SHA256
SHA1-Digest: EjY6pS7xUwQxN7ijQqys3bdEHHc=
SHA256-Digest: eLH2wKnhmjOvDJk/13OJMeh+X4sdlSpbOIfyhp44Zaw=

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
Manifest-Version: 1.0

Name: inject.js
Digest-Algorithms: MD5 SHA1
MD5-Digest: smWyx4xRjcjf16hcPSMqDQ==
Digest-Algorithms: SHA1 SHA256
SHA1-Digest: b2nrco3zOUBDJuyARPlsNEU8O9A=
SHA256-Digest: lU8GPe0dnC/AH4PaP0/akwta9vNay0n7fsgkBOieLsg=

Name: manifest.json
Digest-Algorithms: MD5 SHA1
MD5-Digest: Lg0KzlWjz7XiEJL7d7ZaPA==
SHA1-Digest: /3TAazkDdAqLGI4xVOib3AN20/0=
Digest-Algorithms: SHA1 SHA256
SHA1-Digest: EjY6pS7xUwQxN7ijQqys3bdEHHc=
SHA256-Digest: eLH2wKnhmjOvDJk/13OJMeh+X4sdlSpbOIfyhp44Zaw=

Name: META-INF/cose.manifest
Digest-Algorithms: SHA1 SHA256
SHA1-Digest: BltD3hfKib5zAF8/AQ2KUfFQE8E=
SHA256-Digest: Jk/XoCcZp3zF0IZZ4clToX4K7o75eLH3+GbPfVrEC2w=

Name: META-INF/cose.sig
Digest-Algorithms: SHA1 SHA256
SHA1-Digest: ekekKataezcCjFQ6h2NqnkU9XIY=
SHA256-Digest: OFybAfaBj2GL8JcBp64tchoyn/9zoBWGyTqTiIoAbdQ=

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature-Version: 1.0
MD5-Digest-Manifest: IiKA2aoQtb4HEsrI/xxG+w==
SHA1-Digest-Manifest: XSiAa+3KAgzt9ns8AcBj/raqgn0=
SHA1-Digest-Manifest: jLWIpkk5tC4qYx/SVv8FJjbuMf0=
SHA256-Digest-Manifest: 0VRdWHWSGB1rGMGPEA5BsjCKjeHE6P5ElaLQd3KndEs=

Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{
"manifest_version": 2,
"manifest_version": 3,
"name": "webextensions-selenium-example",
"description": "Inject a div with id webextensions-selenium-example to verify that WebExtensions work in Firefox/Selenium" ,
"description": "Inject a div with id webextensions-selenium-example to verify that WebExtensions work in Firefox/Selenium",
"version": "0.1",
"content_scripts": [
{
"matches": ["https://*/*","http://*/*"],
"js": ["inject.js"]
"matches": [
"https://*/*",
"http://*/*"
],
"js": [
"inject.js"
]
}
],
"applications": {
"gecko": {
"id": "[email protected]"
}
}
}
"browser_specific_settings": {
"gecko": {
"id": "webextensions-selenium-example-v3@example.com"
}
}
}
Binary file modified common/extensions/webextensions-selenium-example-unsigned.zip
Binary file not shown.
Binary file modified common/extensions/webextensions-selenium-example.xpi
Binary file not shown.
Binary file modified common/extensions/webextensions-selenium-example.zip
Binary file not shown.
23 changes: 14 additions & 9 deletions common/extensions/webextensions-selenium-example/manifest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{
"manifest_version": 2,
"manifest_version": 3,
"name": "webextensions-selenium-example",
"description": "Inject a div with id webextensions-selenium-example to verify that WebExtensions work in Firefox/Selenium" ,
"description": "Inject a div with id webextensions-selenium-example to verify that WebExtensions work in Firefox/Selenium",
"version": "0.1",
"content_scripts": [
{
"matches": ["https://*/*","http://*/*"],
"js": ["inject.js"]
"matches": [
"https://*/*",
"http://*/*"
],
"js": [
"inject.js"
]
}
],
"applications": {
"gecko": {
"id": "[email protected]"
}
}
"browser_specific_settings": {
"gecko": {
"id": "webextensions-selenium-example-v3@example.com"
}
}
}
10 changes: 5 additions & 5 deletions java/test/org/openqa/selenium/firefox/ExtensionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void canAddRemoveXpiExtensions() {
Path extension = InProject.locate(EXT_XPI);

String id = ((HasExtensions) driver).installExtension(extension);
assertThat(id).isEqualTo("[email protected]");
assertThat(id).isEqualTo("webextensions-selenium-example-v3@example.com");

driver.get(pages.blankPage);
WebElement injected = driver.findElement(By.id("webextensions-selenium-example"));
Expand All @@ -69,7 +69,7 @@ void canAddRemoveZipUnSignedExtensions() {
Path extension = InProject.locate(EXT_UNSIGNED_ZIP);

String id = ((HasExtensions) driver).installExtension(extension, true);
assertThat(id).isEqualTo("[email protected]");
assertThat(id).isEqualTo("webextensions-selenium-example-v3@example.com");

driver.get(pages.blankPage);
WebElement injected = driver.findElement(By.id("webextensions-selenium-example"));
Expand All @@ -86,7 +86,7 @@ void canAddRemoveZipSignedExtensions() {
Path extension = InProject.locate(EXT_SIGNED_ZIP);

String id = ((HasExtensions) driver).installExtension(extension);
assertThat(id).isEqualTo("[email protected]");
assertThat(id).isEqualTo("webextensions-selenium-example-v3@example.com");

driver.get(pages.blankPage);
WebElement injected = driver.findElement(By.id("webextensions-selenium-example"));
Expand All @@ -103,7 +103,7 @@ void canAddRemoveUnsignedExtensionsDirectory() {
Path extension = InProject.locate(EXT_UNSIGNED_DIR);

String id = ((HasExtensions) driver).installExtension(extension, true);
assertThat(id).isEqualTo("[email protected]");
assertThat(id).isEqualTo("webextensions-selenium-example-v3@example.com");

driver.get(pages.blankPage);
WebElement injected = driver.findElement(By.id("webextensions-selenium-example"));
Expand All @@ -120,7 +120,7 @@ void canAddRemoveSignedExtensionsDirectory() {
Path extension = InProject.locate(EXT_SIGNED_DIR);

String id = ((HasExtensions) driver).installExtension(extension);
assertThat(id).isEqualTo("[email protected]");
assertThat(id).isEqualTo("webextensions-selenium-example-v3@example.com");

driver.get(pages.blankPage);
WebElement injected = driver.findElement(By.id("webextensions-selenium-example"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class RemoteFirefoxDriverTest extends JupiterTestBase {
public void shouldAllowRemoteWebDriverBuilderToUseHasExtensions() {
Path extension = InProject.locate("common/extensions/webextensions-selenium-example.xpi");
String id = ((HasExtensions) driver).installExtension(extension);
assertThat(id).isEqualTo("[email protected]");
assertThat(id).isEqualTo("webextensions-selenium-example-v3@example.com");

try {
((HasExtensions) driver).uninstallExtension(id);
Expand Down
10 changes: 5 additions & 5 deletions py/test/selenium/webdriver/firefox/ff_installs_addons_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_install_uninstall_signed_addon_xpi(driver, pages):
extension = os.path.join(extensions, "webextensions-selenium-example.xpi")

id = driver.install_addon(extension)
assert id == "[email protected]"
assert id == "webextensions-selenium-example-v3@example.com"

pages.load("blank.html")
injected = WebDriverWait(driver, timeout=2).until(
Expand All @@ -45,7 +45,7 @@ def test_install_uninstall_signed_addon_zip(driver, pages):
extension = os.path.join(extensions, "webextensions-selenium-example.zip")

id = driver.install_addon(extension)
assert id == "[email protected]"
assert id == "webextensions-selenium-example-v3@example.com"

pages.load("blank.html")
injected = WebDriverWait(driver, timeout=2).until(
Expand All @@ -62,7 +62,7 @@ def test_install_uninstall_unsigned_addon_zip(driver, pages):
extension = os.path.join(extensions, "webextensions-selenium-example-unsigned.zip")

id = driver.install_addon(extension, temporary=True)
assert id == "[email protected]"
assert id == "webextensions-selenium-example-v3@example.com"

pages.load("blank.html")
injected = WebDriverWait(driver, timeout=2).until(
Expand All @@ -83,7 +83,7 @@ def test_install_uninstall_signed_addon_dir(driver, pages):
zip_ref.extractall(target)

id = driver.install_addon(target)
assert id == "[email protected]"
assert id == "webextensions-selenium-example-v3@example.com"

pages.load("blank.html")
injected = WebDriverWait(driver, timeout=2).until(
Expand All @@ -103,7 +103,7 @@ def test_install_uninstall_unsigned_addon_dir(driver, pages):
zip_ref.extractall(target)

id = driver.install_addon(target, temporary=True)
assert id == "[email protected]"
assert id == "webextensions-selenium-example-v3@example.com"

pages.load("blank.html")
injected = WebDriverWait(driver, timeout=2).until(
Expand Down
16 changes: 9 additions & 7 deletions rb/spec/integration/selenium/webdriver/firefox/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module Firefox
ext = File.expand_path("#{extensions}/webextensions-selenium-example.xpi", __dir__)
id = driver.install_addon(ext)

expect(id).to eq '[email protected]'
expect(id).to eq 'webextensions-selenium-example-v3@example.com'
driver.navigate.to url_for('blank.html')

injected = driver.find_element(id: 'webextensions-selenium-example')
Expand All @@ -81,7 +81,7 @@ module Firefox
ext = File.expand_path("#{extensions}/webextensions-selenium-example.zip", __dir__)
id = driver.install_addon(ext)

expect(id).to eq '[email protected]'
expect(id).to eq 'webextensions-selenium-example-v3@example.com'
driver.navigate.to url_for('blank.html')

injected = driver.find_element(id: 'webextensions-selenium-example')
Expand All @@ -96,7 +96,7 @@ module Firefox
ext = File.expand_path("#{extensions}/webextensions-selenium-example-unsigned.zip", __dir__)
id = driver.install_addon(ext, true)

expect(id).to eq '[email protected]'
expect(id).to eq 'webextensions-selenium-example-v3@example.com'
driver.navigate.to url_for('blank.html')

injected = driver.find_element(id: 'webextensions-selenium-example')
Expand All @@ -107,12 +107,14 @@ module Firefox
expect(driver.find_elements(id: 'webextensions-selenium-example')).to be_empty
end

it 'install and uninstall signed directory', except: {platform: :windows,
reason: 'signature must be different for windows'} do
it 'install and uninstall signed directory', except: {browser: :firefox,
platform: :windows,
reason: 'signature must be different for windows,
skipping everywhere until Firefox 127 is released'} do
ext = File.expand_path("#{extensions}/webextensions-selenium-example-signed/", __dir__)
id = driver.install_addon(ext)

expect(id).to eq '[email protected]'
expect(id).to eq 'webextensions-selenium-example-v3@example.com'
driver.navigate.to url_for('blank.html')

injected = driver.find_element(id: 'webextensions-selenium-example')
Expand All @@ -127,7 +129,7 @@ module Firefox
ext = File.expand_path("#{extensions}/webextensions-selenium-example/", __dir__)
id = driver.install_addon(ext, true)

expect(id).to eq '[email protected]'
expect(id).to eq 'webextensions-selenium-example-v3@example.com'
driver.navigate.to url_for('blank.html')

injected = driver.find_element(id: 'webextensions-selenium-example')
Expand Down

0 comments on commit bc6b650

Please sign in to comment.