diff --git a/testing/firefox-ui/tests/functional/keyboard_shortcuts/test_browser_window.py b/testing/firefox-ui/tests/functional/keyboard_shortcuts/test_browser_window.py index d3f73f7468..dccd7ba7ea 100644 --- a/testing/firefox-ui/tests/functional/keyboard_shortcuts/test_browser_window.py +++ b/testing/firefox-ui/tests/functional/keyboard_shortcuts/test_browser_window.py @@ -47,7 +47,6 @@ class TestBrowserWindowShortcuts(PuppeteerMixin, MarionetteTestCase): # TODO: Check that the right input box is focused # Located below searchbar as class="textbox-input" - # Anon locator has not been released yet (bug 1080764) def has_input_selected(mn): selection_name = mn.execute_script(""" return window.document.activeElement.localName; diff --git a/testing/firefox-ui/tests/functional/manifest.ini b/testing/firefox-ui/tests/functional/manifest.ini index 791291e12d..32292c94fc 100644 --- a/testing/firefox-ui/tests/functional/manifest.ini +++ b/testing/firefox-ui/tests/functional/manifest.ini @@ -1,5 +1,4 @@ [include:keyboard_shortcuts/manifest.ini] -[include:private_browsing/manifest.ini] [include:safebrowsing/manifest.ini] [include:security/manifest.ini] [include:sessionstore/manifest.ini] diff --git a/testing/firefox-ui/tests/functional/private_browsing/manifest.ini b/testing/firefox-ui/tests/functional/private_browsing/manifest.ini deleted file mode 100644 index 34ef273653..0000000000 --- a/testing/firefox-ui/tests/functional/private_browsing/manifest.ini +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -tags = local - -[test_about_private_browsing.py] diff --git a/testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py b/testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py deleted file mode 100644 index 81d5e3df8c..0000000000 --- a/testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py +++ /dev/null @@ -1,73 +0,0 @@ -# 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 __future__ import absolute_import -from firefox_puppeteer import PuppeteerMixin -from firefox_puppeteer.ui.browser.window import BrowserWindow -from marionette_driver import By, Wait -from marionette_harness import MarionetteTestCase - - -class TestAboutPrivateBrowsingWithSearch(PuppeteerMixin, MarionetteTestCase): - - def setUp(self): - super(TestAboutPrivateBrowsingWithSearch, self).setUp() - - # Use a fake local support URL - support_url = 'about:blank?' - self.marionette.set_pref('app.support.baseURL', support_url) - self.pb_url = support_url + 'private-browsing-myths' - - def tearDown(self): - try: - self.puppeteer.windows.close_all([self.browser]) - self.browser.switch_to() - - self.marionette.clear_pref('app.support.baseURL') - finally: - super(TestAboutPrivateBrowsingWithSearch, self).tearDown() - - def testCheckAboutPrivateBrowsingWithSearch(self): - self.assertFalse(self.browser.is_private) - - with self.marionette.using_context('content'): - self.marionette.navigate('about:privatebrowsing') - - # Disabled awaiting support for Fluent strings in firefox-ui tests (bug 1534310) - # status_node = self.marionette.find_element(By.CSS_SELECTOR, 'p.showNormal') - # self.assertEqual(status_node.text, - # self.browser.localize_entity('aboutPrivateBrowsing.notPrivate'), - # 'Status text indicates we are not in private browsing mode') - - def window_opener(win): - with win.marionette.using_context('content'): - button = self.marionette.find_element(By.ID, 'startPrivateBrowsing') - button.click() - - pb_window = self.browser.open_window(callback=window_opener, - expected_window_class=BrowserWindow) - - try: - self.assertTrue(pb_window.is_private) - - # Test the search hand-off - with self.marionette.using_context('content'): - search = self.marionette.find_element(By.ID, 'search-handoff-button') - search.click() - - self.assertTrue(pb_window.navbar.locationbar.focused, 'url bar is focused') - - pb_window.navbar.locationbar.urlbar.send_keys('foo') - self.assertEqual(pb_window.navbar.locationbar.value, '@google foo', - 'url bar prepends the @search shortcut') - - # Test the private browsing myths link - with self.marionette.using_context('content'): - link = self.marionette.find_element(By.ID, 'private-browsing-myths') - link.click() - Wait(self.marionette, timeout=self.marionette.timeout.page_load).until( - lambda _: self.marionette.get_url() == self.pb_url) - - finally: - pb_window.close() diff --git a/testing/firefox-ui/tests/puppeteer/test_toolbars.py b/testing/firefox-ui/tests/puppeteer/test_toolbars.py index 689746db65..8b60af3814 100644 --- a/testing/firefox-ui/tests/puppeteer/test_toolbars.py +++ b/testing/firefox-ui/tests/puppeteer/test_toolbars.py @@ -85,27 +85,13 @@ class TestLocationBar(PuppeteerMixin, MarionetteTestCase): self.locationbar = self.browser.navbar.locationbar def test_elements(self): - self.assertEqual(self.locationbar.urlbar.get_property('localName'), 'textbox') - self.assertIn('urlbar-input', self.locationbar.urlbar_input.get_property('className')) + self.assertEqual(self.locationbar.urlbar_input.get_property('id'), 'urlbar-input') - self.assertEqual(self.locationbar.connection_icon.get_property('localName'), 'image') - self.assertEqual(self.locationbar.identity_box.get_property('localName'), 'box') - self.assertEqual(self.locationbar.identity_country_label.get_property('localName'), - 'label') - self.assertEqual(self.locationbar.identity_organization_label.get_property('localName'), - 'label') - self.assertEqual(self.locationbar.identity_icon.get_property('localName'), 'image') - self.assertEqual(self.locationbar.history_drop_marker.get_property('localName'), - 'dropmarker') self.assertEqual(self.locationbar.reload_button.get_property('localName'), 'toolbarbutton') self.assertEqual(self.locationbar.stop_button.get_property('localName'), 'toolbarbutton') - self.assertEqual(self.locationbar.contextmenu.get_property('localName'), 'menupopup') - self.assertEqual(self.locationbar.get_contextmenu_entry('paste').get_attribute('cmd'), - 'cmd_paste') - def test_reload(self): event_types = ["shortcut", "shortcut2", "button"] for event in event_types: @@ -131,83 +117,3 @@ class TestLocationBar(PuppeteerMixin, MarionetteTestCase): with self.marionette.using_context('content'): Wait(self.marionette).until(lambda mn: mn.get_url() == data_uri) - - -class TestIdentityPopup(PuppeteerMixin, MarionetteTestCase): - def setUp(self): - super(TestIdentityPopup, self).setUp() - - self.locationbar = self.browser.navbar.locationbar - self.identity_popup = self.locationbar.identity_popup - - self.url = 'https://extended-validation.badssl.com' - - with self.marionette.using_context('content'): - self.marionette.navigate(self.url) - - def tearDown(self): - try: - self.identity_popup.close(force=True) - finally: - super(TestIdentityPopup, self).tearDown() - - def test_elements(self): - self.locationbar.open_identity_popup() - - # Test main view elements - main = self.identity_popup.view.main - self.assertEqual(main.element.get_property('localName'), 'panelview') - - self.assertEqual(main.expander.get_property('localName'), 'button') - self.assertEqual(main.host.get_property('localName'), 'label') - self.assertEqual(main.insecure_connection_label.get_property('localName'), - 'description') - self.assertEqual(main.internal_connection_label.get_property('localName'), - 'description') - self.assertEqual(main.secure_connection_label.get_property('localName'), - 'description') - - self.assertEqual(main.permissions.get_property('localName'), 'vbox') - - # Test security view elements - security = self.identity_popup.view.security - self.assertEqual(security.element.get_property('localName'), 'panelview') - - self.assertEqual(security.host.get_property('localName'), 'label') - self.assertEqual(security.insecure_connection_label.get_property('localName'), - 'description') - self.assertEqual(security.secure_connection_label.get_property('localName'), - 'description') - - self.assertEqual(security.owner.get_property('localName'), 'description') - self.assertEqual(security.owner_location.get_property('localName'), 'description') - self.assertEqual(security.verifier.get_property('localName'), 'description') - - self.assertEqual(security.disable_mixed_content_blocking_button.get_property('localName'), - 'button') - self.assertEqual(security.enable_mixed_content_blocking_button.get_property('localName'), - 'button') - - self.assertEqual(security.more_info_button.get_property('localName'), 'button') - - def test_open_close(self): - with self.marionette.using_context('content'): - self.marionette.navigate(self.url) - - self.assertFalse(self.identity_popup.is_open) - - self.locationbar.open_identity_popup() - - self.identity_popup.close() - self.assertFalse(self.identity_popup.is_open) - - def test_force_close(self): - with self.marionette.using_context('content'): - self.marionette.navigate(self.url) - - self.assertFalse(self.identity_popup.is_open) - - self.locationbar.open_identity_popup() - - self.identity_popup.close(force=True) - self.assertFalse(self.identity_popup.is_open) diff --git a/testing/firefox-ui/tests/puppeteer/test_windows.py b/testing/firefox-ui/tests/puppeteer/test_windows.py index 849b7aa421..35327d2396 100644 --- a/testing/firefox-ui/tests/puppeteer/test_windows.py +++ b/testing/firefox-ui/tests/puppeteer/test_windows.py @@ -68,7 +68,7 @@ class TestWindows(PuppeteerMixin, MarionetteTestCase): def open_by_js(_): with self.marionette.using_context('chrome'): self.marionette.execute_script(""" - window.open('chrome://browser/content/safeMode.xul', '_blank', + window.open('chrome://browser/content/safeMode.xhtml', '_blank', 'chrome,centerscreen,resizable=no'); """) diff --git a/testing/marionette/capture.js b/testing/marionette/capture.js index 526ef39586..25f6a9dd63 100644 --- a/testing/marionette/capture.js +++ b/testing/marionette/capture.js @@ -41,20 +41,15 @@ capture.Format = { * * @param {Node} node * The node to take a screenshot of. - * @param {Array.=} highlights - * Optional array of nodes, around which a border will be marked to - * highlight them in the screenshot. * * @return {HTMLCanvasElement} * The canvas element where the element has been painted on. */ -capture.element = function(node, highlights = []) { +capture.element = function(node) { let win = node.ownerGlobal; let rect = node.getBoundingClientRect(); - return capture.canvas(win, rect.left, rect.top, rect.width, rect.height, { - highlights, - }); + return capture.canvas(win, rect.left, rect.top, rect.width, rect.height); }; /** @@ -64,21 +59,17 @@ capture.element = function(node, highlights = []) { * @param {DOMWindow} win * The DOM window providing the document element to capture, * and the offsets for the viewport. - * @param {Array.=} highlights - * Optional array of nodes, around which a border will be marked to - * highlight them in the screenshot. * * @return {HTMLCanvasElement} * The canvas element where the viewport has been painted on. */ -capture.viewport = function(win, highlights = []) { +capture.viewport = function(win) { return capture.canvas( win, win.pageXOffset, win.pageYOffset, win.innerWidth, - win.innerHeight, - { highlights } + win.innerHeight ); }; @@ -96,9 +87,6 @@ capture.viewport = function(win, highlights = []) { * The width dimension of the rectangle to paint. * @param {number} height * The height dimension of the rectangle to paint. - * @param {Array.=} highlights - * Optional array of nodes, around which a border will be marked to - * highlight them in the screenshot. * @param {HTMLCanvasElement=} canvas * Optional canvas to reuse for the screenshot. * @param {number=} flags @@ -115,7 +103,7 @@ capture.canvas = function( top, width, height, - { highlights = [], canvas = null, flags = null } = {} + { canvas = null, flags = null } = {} ) { const scale = win.devicePixelRatio; @@ -149,49 +137,20 @@ capture.canvas = function( let ctx = canvas.getContext(CONTEXT_2D); if (flags === null) { flags = ctx.DRAWWINDOW_DRAW_CARET; - // TODO(ato): https://bugzil.la/1377335 - // - // Disabled in bug 1243415 for webplatform-test - // failures due to out of view elements. Needs - // https://github.com/w3c/web-platform-tests/issues/4383 fixed. - /* - ctx.DRAWWINDOW_DRAW_VIEW; - */ - // Bug 1009762 - Crash in [@ mozilla::gl::ReadPixelsIntoDataSurface] - /* - ctx.DRAWWINDOW_USE_WIDGET_LAYERS; - */ + + // Enabling those flags for drawWindow by default causes + // drawing failures. Wait until drawSnapshot is used and supports + // these flags (bug 1571341) + // ctx.DRAWWINDOW_DRAW_VIEW; + // ctx.DRAWWINDOW_USE_WIDGET_LAYERS; } ctx.scale(scale, scale); ctx.drawWindow(win, left, top, width, height, BG_COLOUR, flags); - if (highlights.length) { - ctx = capture.highlight_(ctx, highlights, top, left); - } return canvas; }; -capture.highlight_ = function(context, highlights, top = 0, left = 0) { - if (typeof highlights == "undefined") { - throw new InvalidArgumentError("Missing highlights"); - } - - context.lineWidth = "2"; - context.strokeStyle = "red"; - context.save(); - - for (let el of highlights) { - let rect = el.getBoundingClientRect(); - let oy = -top; - let ox = -left; - - context.strokeRect(rect.left + ox, rect.top + oy, rect.width, rect.height); - } - - return context; -}; - /** * Encode the contents of an HTMLCanvasElement to a Base64 encoded string. * diff --git a/testing/marionette/chrome/test.xul b/testing/marionette/chrome/test.xhtml similarity index 68% rename from testing/marionette/chrome/test.xul rename to testing/marionette/chrome/test.xhtml index a81b93f1ad..e8165bc574 100644 --- a/testing/marionette/chrome/test.xul +++ b/testing/marionette/chrome/test.xhtml @@ -14,14 +14,14 @@ - - - + + + - + diff --git a/testing/web-platform/tests/paint-timing/first-paint-bg-color.html b/testing/web-platform/tests/paint-timing/first-paint-bg-color.html index 46efb9e267..21271da4ce 100644 --- a/testing/web-platform/tests/paint-timing/first-paint-bg-color.html +++ b/testing/web-platform/tests/paint-timing/first-paint-bg-color.html @@ -11,6 +11,7 @@