This commit is contained in:
Ionut Budeanu 2019-05-27 17:55:50 +03:00 коммит произвёл mwobensmith
Родитель 855295ec3a
Коммит 3b84dd6553
5 изменённых файлов: 309 добавлений и 0 удалений

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.5 KiB

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Просмотреть файл

@ -0,0 +1,80 @@
# 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 targets.firefox.fx_testcase import *
class Test(FirefoxTest):
@pytest.mark.details(
description='This is a test of the sorting options from the sidebar - By Site.',
locale=['en-US'],
test_case_id='119445',
test_suite_id='2000',
profile=Profiles.BRAND_NEW
)
def run(self, firefox):
history_today_sidebar_pattern = Sidebar.HistorySidebar.Timeline.TODAY
history_sidebar_view_button_pattern = Sidebar.HistorySidebar.VIEW_BUTTON
history_sidebar_sort_by_date_pattern = Sidebar.HistorySidebar.ViewBy.VIEW_BY_DATE_CHECKED
history_sidebar_sort_by_site_pattern = Sidebar.HistorySidebar.ViewBy.VIEW_BY_SITE
history_sidebar_items_sort_by_site_pattern = Pattern('history_sidebar_items_sort_by_site.png')
# Open some pages to create some history.
navigate(LocalWeb.MOZILLA_TEST_SITE)
mozilla_test_site_loaded = exists(LocalWeb.MOZILLA_LOGO, Settings.SITE_LOAD_TIMEOUT)
assert mozilla_test_site_loaded is True, 'Mozilla page loaded successfully.'
new_tab()
navigate(LocalWeb.MOZILLA_TEST_SITE)
mozilla_test_site_loaded = exists(LocalWeb.MOZILLA_LOGO, Settings.SITE_LOAD_TIMEOUT)
assert mozilla_test_site_loaded is True, 'Mozilla page loaded successfully.'
new_tab()
navigate(LocalWeb.FIREFOX_TEST_SITE)
firefox_test_site_loaded = exists(LocalWeb.FIREFOX_LOGO, Settings.SITE_LOAD_TIMEOUT)
assert firefox_test_site_loaded is True, 'Firefox page loaded successfully.'
new_tab()
navigate(LocalWeb.FOCUS_TEST_SITE)
focus_test_site_loaded = exists(LocalWeb.FOCUS_LOGO, Settings.SITE_LOAD_TIMEOUT)
assert focus_test_site_loaded is True, 'Focus page loaded successfully.'
new_tab()
navigate(LocalWeb.POCKET_TEST_SITE)
pocket_test_site_loaded = exists(LocalWeb.POCKET_LOGO, Settings.SITE_LOAD_TIMEOUT)
assert pocket_test_site_loaded is True, 'Pocket page loaded successfully.'
# Open the History sidebar.
history_sidebar()
history_today_sidebar = exists(history_today_sidebar_pattern, Settings.FIREFOX_TIMEOUT)
assert history_today_sidebar is True, 'Expand history sidebar button displayed properly.'
click(history_today_sidebar_pattern)
# Sort by date by default.
history_sidebar_view_button = exists(history_sidebar_view_button_pattern, Settings.FIREFOX_TIMEOUT)
assert history_sidebar_view_button is True, 'View button displayed properly.'
click(history_sidebar_view_button_pattern)
history_sidebar_sort_by_date = exists(history_sidebar_sort_by_date_pattern, Settings.FIREFOX_TIMEOUT)
assert history_sidebar_sort_by_date is True, 'Default sorting option - sort by date - is selected properly.'
# Sort by site.
history_sidebar_sort_by_site = exists(history_sidebar_sort_by_site_pattern, Settings.FIREFOX_TIMEOUT)
assert history_sidebar_sort_by_site is True, 'Sort by site option is displayed properly.'
click(history_sidebar_sort_by_site_pattern)
history_sidebar_items_sort_by_site = exists(history_sidebar_items_sort_by_site_pattern,
Settings.FIREFOX_TIMEOUT)
assert history_sidebar_items_sort_by_site is True, 'History list is sorted properly by site.'

Просмотреть файл

@ -0,0 +1,70 @@
# 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 targets.firefox.fx_testcase import *
class Test(FirefoxTest):
@pytest.mark.details(
description='This is a test of the sorting options from the sidebar.',
locale=['en-US'],
test_case_id='119443',
test_suite_id='2000',
profile=Profiles.BRAND_NEW
)
def run(self, firefox):
history_today_sidebar_pattern = Sidebar.HistorySidebar.Timeline.TODAY
history_sidebar_view_button_pattern = Sidebar.HistorySidebar.VIEW_BUTTON
history_sidebar_sort_by_date_pattern = Sidebar.HistorySidebar.ViewBy.VIEW_BY_DATE_CHECKED
# Open some pages to create some history.
navigate(LocalWeb.MOZILLA_TEST_SITE)
expected_1 = exists(LocalWeb.MOZILLA_LOGO, 10)
assert expected_1 is True, 'Mozilla page loaded successfully.'
new_tab()
navigate(LocalWeb.MOZILLA_TEST_SITE)
expected_2 = exists(LocalWeb.MOZILLA_LOGO, 10)
assert expected_2 is True, 'Mozilla page loaded successfully.'
new_tab()
navigate(LocalWeb.FIREFOX_TEST_SITE)
expected_3 = exists(LocalWeb.FIREFOX_LOGO, 10)
assert expected_3 is True, 'Firefox page loaded successfully.'
new_tab()
navigate(LocalWeb.FOCUS_TEST_SITE)
expected_4 = exists(LocalWeb.FOCUS_LOGO, 10)
assert expected_4 is True, 'Focus page loaded successfully.'
new_tab()
navigate(LocalWeb.POCKET_TEST_SITE)
expected_5 = exists(LocalWeb.POCKET_LOGO, 10)
assert expected_5 is True, 'Pocket page loaded successfully.'
# Open the History sidebar.
history_sidebar()
expected_6 = exists(history_today_sidebar_pattern, 10)
assert expected_6 is True, 'Expand history sidebar button displayed properly.'
click(history_today_sidebar_pattern)
# Sort by date by default.
expected_7 = exists(history_sidebar_view_button_pattern, 10)
assert expected_7 is True, 'View button displayed properly.'
click(history_sidebar_view_button_pattern)
expected_8 = exists(history_sidebar_sort_by_date_pattern, 10)
assert expected_8 is True, 'Default sorting option - sort by date - is selected properly.'
click(history_sidebar_sort_by_date_pattern)

Просмотреть файл

@ -0,0 +1,91 @@
# 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 targets.firefox.fx_testcase import *
class Test(FirefoxTest):
@pytest.mark.details(
description='Open all the history from a history time range.',
locale=['en-US'],
test_case_id='174033',
test_suite_id='2000'
)
def run(self, firefox):
iris_tab_icon = Pattern('iris_logo_tab.png')
mozilla_tab_icon = Pattern('mozilla_logo_tab.png')
iris_bookmark_pattern = Pattern('iris_bookmark.png')
show_all_history_pattern = History.HistoryMenu.SHOW_ALL_HISTORY
history_today_pattern = Library.HISTORY_TODAY
new_tab_pattern = Pattern('new_tab.png')
privacy_url = "http://www.mozilla.org/en-US/privacy/firefox/"
firefox_privacy_logo_pattern = Pattern('firefox_privacy_logo_for_bookmarks.png')
# Open a page to create some history.
navigate(LocalWeb.MOZILLA_TEST_SITE)
expected = exists(LocalWeb.MOZILLA_LOGO, 10)
assert expected is True, 'Mozilla page loaded successfully.'
new_tab()
previous_tab()
close_tab()
navigate(privacy_url)
new_tab()
previous_tab()
close_tab()
# Open History and check if it is populated with the Iris page.
open_library_menu('History')
right_upper_corner = Screen().new_region(Screen.SCREEN_WIDTH / 2, 0, Screen.SCREEN_WIDTH / 2,
Screen.SCREEN_HEIGHT / 2)
expected = right_upper_corner.exists(iris_bookmark_pattern, 10)
assert expected is True, 'Iris page is displayed in the History menu list.'
click(show_all_history_pattern)
expected = exists(history_today_pattern, 10)
assert expected is True, 'Today history option is available.'
# Right click on History time range and select the Open All in Tabs button.
right_click(history_today_pattern)
type(text='o')
close_auxiliary_window = False
if OSHelper.is_mac() or exists(Library.TITLE, 10):
click_window_control('close')
time.sleep(Settings.DEFAULT_UI_DELAY)
else:
close_auxiliary_window = True
# Make sure that all the pages from the selected history time range are opened in the current window.
expected = exists(iris_tab_icon, 10)
assert expected is True, 'Iris local page loaded successfully.'
expected = exists(mozilla_tab_icon, 10)
assert expected is True, 'Mozilla page loaded successfully.'
expected = exists(firefox_privacy_logo_pattern, 10)
assert expected is True, 'Firefox Privacy Notice page loaded successfully.'
expected = exists(new_tab_pattern, 10)
assert expected is True, 'about:newtab page loaded successfully.'
# Close potentially existing background library window
if close_auxiliary_window:
library_toolbar_icon = Pattern('library_icon.png')
firefox_toolbar_icon = Pattern('firefox_icon.png')
click(firefox_toolbar_icon)
time.sleep(Settings.DEFAULT_UI_DELAY_LONG)
click(library_toolbar_icon)
click_window_control('close')
time.sleep(Settings.DEFAULT_UI_DELAY)
click(firefox_privacy_logo_pattern)

Просмотреть файл

@ -0,0 +1,68 @@
# 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 targets.firefox.fx_testcase import *
class Test(FirefoxTest):
@pytest.mark.details(
description='Use Open button from the contextual options.',
locale=['en-US'],
test_case_id='174038',
test_suite_id='2000',
profile=Profiles.TEN_BOOKMARKS
)
def run(self, firefox):
iris_bookmark_pattern = Pattern('iris_bookmark.png')
show_all_history_pattern = History.HistoryMenu.SHOW_ALL_HISTORY
history_today_pattern = Library.HISTORY_TODAY
library_bookmarks_mozilla_pattern = Pattern('library_bookmarks_mozilla.png')
iris_logo_tab_pattern = Pattern('iris_logo_tab.png')
# Open a page to create some today's history.
new_tab()
navigate(LocalWeb.MOZILLA_TEST_SITE)
expected_1 = exists(LocalWeb.MOZILLA_LOGO, 10)
assert expected_1 is True, 'Mozilla page loaded successfully.'
close_tab()
# Select the History option from the View History, saved bookmarks and more Menu.
open_library_menu('History')
right_upper_corner = Screen().new_region(Screen.SCREEN_WIDTH / 2, 0, Screen.SCREEN_WIDTH / 2,
Screen.SCREEN_HEIGHT / 2)
expected_2 = right_upper_corner.exists(iris_bookmark_pattern, 10)
assert expected_2 is True, 'Iris page is displayed in the History menu list.'
time.sleep(Settings.DEFAULT_UI_DELAY_SHORT)
# Click on the Show All History button.
click(show_all_history_pattern, 1)
expected_3 = exists(history_today_pattern, 10)
assert expected_3 is True, 'Today history option is available.'
expected_4 = exists(library_bookmarks_mozilla_pattern, 10)
assert expected_4 is True, 'Mozilla page is displayed successfully in the History list.'
# Open the Mozilla page using the 'Open' button from the context menu.
right_click(library_bookmarks_mozilla_pattern)
time.sleep(Settings.DEFAULT_UI_DELAY_SHORT)
type(text='o')
# Close the library.
open_library()
click_window_control('close')
time.sleep(Settings.DEFAULT_UI_DELAY_SHORT)
# Check that the Mozilla page loaded successfully in the current tab(Iris page).
expected_5 = exists(LocalWeb.MOZILLA_LOGO, 10)
assert expected_5 is True, 'Mozilla page loaded successfully.'
expected_6 = exists(iris_logo_tab_pattern, 3)
assert expected_6 is False, 'Mozilla page loaded successfully in the current tab.'