Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Firefox AddOns for Testing #13999

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -67,7 +67,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 @@ -82,7 +82,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 @@ -97,7 +97,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 @@ -108,12 +108,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 @@ -128,7 +130,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
Loading