import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,9 @@
[DEFAULT]
tags = local
[test_access_locationbar.py]
disabled = Bug 1168727 - Timeout when opening auto-complete popup
[test_escape_autocomplete.py]
[test_favicon_in_autocomplete.py]
[test_suggest_bookmarks.py]

View file

@ -0,0 +1,60 @@
# 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 marionette_driver import Wait
from marionette_harness import MarionetteTestCase
class TestAccessLocationBar(PuppeteerMixin, MarionetteTestCase):
def setUp(self):
super(TestAccessLocationBar, self).setUp()
# Clear complete history so there's no interference from previous entries.
self.puppeteer.places.remove_all_history()
self.test_urls = [
'layout/mozilla_projects.html',
'layout/mozilla.html',
'layout/mozilla_mission.html'
]
self.test_urls = [self.marionette.absolute_url(t)
for t in self.test_urls]
self.locationbar = self.browser.navbar.locationbar
self.autocomplete_results = self.locationbar.autocomplete_results
self.urlbar = self.locationbar.urlbar
def test_access_locationbar_history(self):
# Open some local pages, then about:blank
def load_urls():
with self.marionette.using_context('content'):
for url in self.test_urls:
self.marionette.navigate(url)
self.puppeteer.places.wait_for_visited(self.test_urls, load_urls)
with self.marionette.using_context('content'):
self.marionette.navigate('about:blank')
# Need to blur url bar or autocomplete won't load - bug 1038614
self.marionette.execute_script("""arguments[0].blur();""", script_args=[self.urlbar])
# Clear contents of url bar to focus, then arrow down for list of visited sites
# Verify that autocomplete is open and results are displayed
self.locationbar.clear()
self.urlbar.send_keys(self.puppeteer.keys.ARROW_DOWN)
Wait(self.marionette).until(lambda _: self.autocomplete_results.is_open)
Wait(self.marionette).until(lambda _: len(self.autocomplete_results.visible_results) > 1)
# Arrow down again to select first item in list, appearing in reversed order, as loaded.
# Verify first item.
self.urlbar.send_keys(self.puppeteer.keys.ARROW_DOWN)
Wait(self.marionette).until(lambda _: self.autocomplete_results.selected_index == '0')
self.assertIn('mission', self.locationbar.value)
# Navigate to the currently selected url
# Verify it loads by comparing the page url to the test url
self.urlbar.send_keys(self.puppeteer.keys.ENTER)
self.assertEqual(self.locationbar.value, self.test_urls[-1])

View file

@ -0,0 +1,56 @@
# 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 marionette_driver import Wait
from marionette_harness import MarionetteTestCase
class TestEscapeAutocomplete(PuppeteerMixin, MarionetteTestCase):
def setUp(self):
super(TestEscapeAutocomplete, self).setUp()
# Clear complete history so there's no interference from previous entries.
self.puppeteer.places.remove_all_history()
self.test_urls = [
'layout/mozilla.html',
'layout/mozilla_community.html',
]
self.test_urls = [self.marionette.absolute_url(t)
for t in self.test_urls]
self.test_string = 'mozilla'
self.locationbar = self.browser.navbar.locationbar
self.autocomplete_results = self.locationbar.autocomplete_results
def tearDown(self):
self.autocomplete_results.close(force=True)
super(TestEscapeAutocomplete, self).tearDown()
def test_escape_autocomplete(self):
# Open some local pages
def load_urls():
with self.marionette.using_context('content'):
for url in self.test_urls:
self.marionette.navigate(url)
self.puppeteer.places.wait_for_visited(self.test_urls, load_urls)
# Clear the location bar, type the test string, check that autocomplete list opens
self.locationbar.clear()
self.locationbar.urlbar.send_keys(self.test_string)
self.assertEqual(self.locationbar.value, self.test_string)
Wait(self.marionette).until(lambda _: self.autocomplete_results.is_open)
# Press escape, check location bar value, check autocomplete list closed
self.locationbar.urlbar.send_keys(self.puppeteer.keys.ESCAPE)
self.assertEqual(self.locationbar.value, self.test_string)
Wait(self.marionette).until(lambda _: not self.autocomplete_results.is_open)
# Press escape again and check that locationbar returns to the page url
self.locationbar.urlbar.send_keys(self.puppeteer.keys.ESCAPE)
self.assertEqual(self.locationbar.value, self.test_urls[-1])

View file

@ -0,0 +1,62 @@
# 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 marionette_driver import Wait
from marionette_harness import MarionetteTestCase
class TestFaviconInAutocomplete(PuppeteerMixin, MarionetteTestCase):
PREF_SUGGEST_SEARCHES = 'browser.urlbar.suggest.searches'
PREF_SUGGEST_BOOKMARK = 'browser.urlbar.suggest.bookmark'
def setUp(self):
super(TestFaviconInAutocomplete, self).setUp()
# Disable suggestions for searches and bookmarks to get results only for history
self.marionette.set_pref(self.PREF_SUGGEST_SEARCHES, False)
self.marionette.set_pref(self.PREF_SUGGEST_BOOKMARK, False)
self.puppeteer.places.remove_all_history()
self.test_urls = [self.marionette.absolute_url('layout/mozilla.html')]
self.test_string = 'mozilla'
self.test_favicon = 'mozilla_favicon.ico'
self.autocomplete_results = self.browser.navbar.locationbar.autocomplete_results
def tearDown(self):
try:
self.autocomplete_results.close(force=True)
self.marionette.clear_pref(self.PREF_SUGGEST_SEARCHES)
self.marionette.clear_pref(self.PREF_SUGGEST_BOOKMARK)
finally:
super(TestFaviconInAutocomplete, self).tearDown()
def test_favicon_in_autocomplete(self):
# Open the test page
def load_urls():
with self.marionette.using_context('content'):
self.marionette.navigate(self.test_urls[0])
self.puppeteer.places.wait_for_visited(self.test_urls, load_urls)
locationbar = self.browser.navbar.locationbar
# Clear the location bar, type the test string, check that autocomplete list opens
locationbar.clear()
locationbar.urlbar.send_keys(self.test_string)
self.assertEqual(locationbar.value, self.test_string)
Wait(self.marionette).until(lambda _: self.autocomplete_results.is_complete)
result = self.autocomplete_results.visible_results[1]
result_icon = self.marionette.execute_script("""
return arguments[0].image;
""", script_args=[result])
self.assertIn(self.test_favicon, result_icon)
self.autocomplete_results.close()

View file

@ -0,0 +1,96 @@
# 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 marionette_driver import By, Wait
from marionette_harness import MarionetteTestCase
class TestStarInAutocomplete(PuppeteerMixin, MarionetteTestCase):
""" This replaces
http://hg.mozilla.org/qa/mozmill-tests/file/default/firefox/tests/functional/testAwesomeBar/testSuggestBookmarks.js
Check a star appears in autocomplete list for a bookmarked page.
"""
PREF_SUGGEST_SEARCHES = 'browser.urlbar.suggest.searches'
def setUp(self):
super(TestStarInAutocomplete, self).setUp()
self.bookmark_panel = None
self.test_urls = [self.marionette.absolute_url('layout/mozilla_grants.html')]
# Disable search suggestions to only get results for history and bookmarks
self.marionette.set_pref(self.PREF_SUGGEST_SEARCHES, False)
with self.marionette.using_context('content'):
self.marionette.navigate('about:blank')
self.puppeteer.places.remove_all_history()
def tearDown(self):
# Close the autocomplete results
try:
if self.bookmark_panel:
self.marionette.execute_script("""
arguments[0].hidePopup();
""", script_args=[self.bookmark_panel])
self.browser.navbar.locationbar.autocomplete_results.close()
self.puppeteer.places.restore_default_bookmarks()
self.marionette.clear_pref(self.PREF_SUGGEST_SEARCHES)
finally:
super(TestStarInAutocomplete, self).tearDown()
def test_star_in_autocomplete(self):
search_string = 'grants'
def visit_urls():
with self.marionette.using_context('content'):
for url in self.test_urls:
self.marionette.navigate(url)
# Navigate to all the urls specified in self.test_urls and wait for them to
# be registered as visited
self.puppeteer.places.wait_for_visited(self.test_urls, visit_urls)
# Bookmark the current page using the bookmark menu
self.browser.menubar.select_by_id('bookmarksMenu',
'menu_bookmarkThisPage')
# TODO: Replace hard-coded selector with library method when one is available
self.bookmark_panel = self.marionette.find_element(By.ID, 'editBookmarkPanel')
done_button = self.marionette.find_element(By.ID, 'editBookmarkPanelDoneButton')
Wait(self.marionette).until(
lambda mn: self.bookmark_panel.get_attribute('panelopen') == 'true')
done_button.click()
# We must open the blank page so the autocomplete result isn't "Switch to tab"
with self.marionette.using_context('content'):
self.marionette.navigate('about:blank')
self.puppeteer.places.remove_all_history()
# Focus the locationbar, delete any contents there, and type the search string
locationbar = self.browser.navbar.locationbar
locationbar.clear()
locationbar.urlbar.send_keys(search_string)
autocomplete_results = locationbar.autocomplete_results
# Wait for the search string to be present, for the autocomplete results to appear
# and for there to be exactly one autocomplete result
Wait(self.marionette).until(lambda mn: locationbar.value == search_string)
Wait(self.marionette).until(lambda mn: autocomplete_results.is_complete)
Wait(self.marionette).until(lambda mn: len(autocomplete_results.visible_results) == 2)
# Compare the highlighted text in the autocomplete result to the search string
first_result = autocomplete_results.visible_results[1]
matching_titles = autocomplete_results.get_matching_text(first_result, 'title')
for title in matching_titles:
Wait(self.marionette).until(lambda mn: title.lower() == search_string)
self.assertIn('bookmark',
first_result.get_attribute('type'),
'The auto-complete result is a bookmark')