Bug 1360687 - Update puppeteer notification class for webextensions.
To support webextensions in Puppeteer the current restartless
extension gets replaced by a webextension. It allow us to test
at least the permission notification. This patch only adds basic
support.
MozReview-Commit-ID: FKq76qcOxKu
deleted file mode 100644
index ed86213e7917b3eba0816b547759fcc0cbef6157..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index d0768103d56491bf9c24f49832b25787be7438e5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
new file mode 100644
index 0000000000000000000000000000000000000000..5363911af16be0fb2b6aab4c3d31f2f8b6126bbd
GIT binary patch
literal 4221
zc$|$_XHXMbw+#|H0R*HsX+nTdrFRXT0D>T*^xm6PsX+)mbOfXaK@g=$2aztlO7Dac
z>0K!g-^};Exp(fJdHc-%vCf>mX6>`jkF&JZv4NBT001ArnLnrI56@=@f&c(ZG63Mu
zt|nAZfln2t#P8(dXXof>266W=n>Vo0ySG(|8j@geACw?SBsnHn%Mt{r(dp5+lW0=)
zGEfpEQtCWrx54WD9?W8BNrucyvZPH61_tDMcljO#Hko+O*X*_~ylmVqEx)$^0VdOO
z3Sqw+Hyk(h9)K{V_1P|E$$pN93$PVJ0#&&b2_h=U$%8HBRONBAn@Bq-PJ?}XG;tYl
zznZFi^*r+H<5D@GCSs9#Md<LG3FsUqKiU>UJp7XdL(76H7z?>%eEEX6eu72IyJu{4
z_OAP*Xn3(O5AD0JIr{e)Wp;V8k+Jb7v>~%!M-~P~2C`?rPLBN;nW2is?HpoQ@(kS#
zO3*fzQ{i$@7gVRG?-@|<KT#GD>=|Q<#TE=gsoW7b^uNMie-k>_{5Wtw=$z+f%L-H<
znx#Q$%dJh$7K=49YWo(WK}plko&1X$*q%S^$ubbXrW(X~*(#TPw@?oIu_vV@GCs2w
zRX|@`QLv*aGGRB-LXA^$cy%e)jMy@@2M1B%!1&2b;Wa6hO0#)7G)84WLYv4W1=YT(
z>3qwdu8CjtM^p8^a;?Y^5eL^-Vt_E9t8`4%(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C_^_NBx!
zNB%t(>VVn~fwbf(cOxSRQmqawCv0(b8O3@wYS~_$zeM&Z{t$c>qvBD(a^-0RfdKw0
z+U!lnru{AQy-kXL@~j@#M1vYb>b%^1Y7>7EefUan;#IGP)@?H<f4agJDx*vc05QA^
z9i2}iJT8rDCQ@@}O;S9>c5<o@m0<u0ruh5g;TaYA`uX_NHZ(>U_@d~NALHVrSU#hw
zpK*7?x|N1?hZ6hW4fTH_7z^+(_WBP46ZXG9u0QdoI5<S~miPbl)c!8&?_>V2s2k8f
j5B={9f4}qpGE|fN;{>$Tad7_}0NyT|TU}bDf6)H`-u$ON
new file mode 100644
index 0000000000000000000000000000000000000000..cf0fad63b542d37e264cc510dc1f272cf939606b
GIT binary patch
literal 310
zc$^FHW@Zs#U|`^2h|Ij>#Thk&u?@&O2*kV$G7Pzid6{Xc#U*-K#rb)mA)E}%Uc4cZ
z_CQ=(!Og(P@|BT+0jxc@$C0mDLBRF<oFt>ympX2R?eQ@_bYX&)l;T~9cX1b8&F}vG
z`Tp#E76w0&J&$M1laE_GpZQxrJQs(_$GQdlh8HcIZmHUIJk1E(zvS{i<v+^;VplKL
zHq|}-f_Liv9h-SS9DQax|KjaM`P&}02l}0yHG6i>%B!0$_bn}ZJGZ@$Ej-Ze!~|Ed
u_yBK4COKwY-jQGc0icT+8X7??G|#a@Jcs770B=?{h&D!sU?6=KYzP42pk&zq
--- a/testing/firefox-ui/tests/puppeteer/test_notifications.py
+++ b/testing/firefox-ui/tests/puppeteer/test_notifications.py
@@ -1,16 +1,16 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from firefox_puppeteer import PuppeteerMixin
from firefox_puppeteer.ui.browser.notifications import (
+ AddOnInstallConfirmationNotification,
AddOnInstallFailedNotification,
- AddOnInstallConfirmationNotification,
)
from marionette_driver import By
from marionette_driver.errors import TimeoutException
from marionette_harness import MarionetteTestCase
class TestNotifications(PuppeteerMixin, MarionetteTestCase):
@@ -34,17 +34,17 @@ class TestNotifications(PuppeteerMixin,
if self.browser.notification:
self.browser.notification.close(force=True)
finally:
super(TestNotifications, self).tearDown()
def test_open_close_notification(self):
"""Trigger and dismiss a notification"""
self.assertIsNone(self.browser.notification)
- self.trigger_addon_notification('restartless_addon_signed.xpi')
+ self.trigger_addon_notification('webextension-signed.xpi')
self.browser.notification.close()
self.assertIsNone(self.browser.notification)
def test_wait_for_notification_timeout(self):
"""Wait for a notification when one is not shown"""
message = 'No notification was shown'
with self.assertRaisesRegexp(TimeoutException, message):
self.browser.wait_for_notification()
@@ -53,32 +53,32 @@ class TestNotifications(PuppeteerMixin,
"""Wait for a notification when one is not shown"""
message = 'AddOnInstallFailedNotification was not shown'
with self.assertRaisesRegexp(TimeoutException, message):
self.browser.wait_for_notification(AddOnInstallFailedNotification)
def test_wait_for_no_notification_timeout(self):
"""Wait for no notification when one is shown"""
message = 'Unexpected notification shown'
- self.trigger_addon_notification('restartless_addon_signed.xpi')
+ self.trigger_addon_notification('webextension-signed.xpi')
with self.assertRaisesRegexp(TimeoutException, message):
self.browser.wait_for_notification(None)
def test_notification_with_origin(self):
"""Trigger a notification with an origin"""
- self.trigger_addon_notification('restartless_addon_signed.xpi')
+ self.trigger_addon_notification('webextension-signed.xpi')
self.assertIn(self.browser.notification.origin, self.marionette.baseurl)
self.assertIsNotNone(self.browser.notification.label)
def test_addon_install_failed_notification(self):
"""Trigger add-on blocked notification using an unsigned add-on"""
# Ensure that installing unsigned extensions will fail
self.marionette.set_pref('xpinstall.signatures.required', True)
self.trigger_addon_notification(
- 'restartless_addon_unsigned.xpi',
+ 'webextension-unsigned.xpi',
notification=AddOnInstallFailedNotification)
def trigger_addon_notification(self, addon, notification=AddOnInstallConfirmationNotification):
with self.marionette.using_context('content'):
self.marionette.navigate(self.addons_url)
self.marionette.find_element(By.LINK_TEXT, addon).click()
self.browser.wait_for_notification(notification)
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/notifications.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/notifications.py
@@ -66,41 +66,17 @@ class AddOnInstallBlockedNotification(Ba
return self.element.find_element(
By.ANON_ATTRIBUTE, {'anonid': 'button'}).find_element(
By.ANON_ATTRIBUTE, {'anonid': 'button'})
class AddOnInstallConfirmationNotification(BaseNotification):
"""Add-on install confirmation notification."""
- @property
- def addon_name(self):
- """Provide access to the add-on name.
-
- :returns: The add-on name.
- """
- label = self.element.find_element(
- By.CSS_SELECTOR, '#addon-install-confirmation-content label')
- return label.get_attribute('value')
-
- def cancel_button(self):
- """Provide access to the cancel button.
-
- :returns: The cancel button.
- """
- return self.element.find_element(
- By.ID, 'addon-install-confirmation-cancel')
-
- def install_button(self):
- """Provide access to the install button.
-
- :returns: The install button.
- """
- return self.element.find_element(
- By.ID, 'addon-install-confirmation-accept')
+ pass
class AddOnInstallCompleteNotification(BaseNotification):
"""Add-on install complete notification."""
pass
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
@@ -83,17 +83,17 @@ class BrowserWindow(BaseWindow):
return self._navbar
@property
def notification(self):
"""Provides access to the currently displayed notification."""
notifications_map = {
'addon-install-blocked-notification': AddOnInstallBlockedNotification,
- 'addon-install-confirmation-notification': AddOnInstallConfirmationNotification,
+ 'addon-webext-permissions-notification': AddOnInstallConfirmationNotification,
'addon-install-complete-notification': AddOnInstallCompleteNotification,
'addon-install-failed-notification': AddOnInstallFailedNotification,
'addon-progress-notification': AddOnProgressNotification,
}
try:
notification = self.window_element.find_element(
By.CSS_SELECTOR, '#notification-popup popupnotification')