Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,3 @@
# 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/.

View file

@ -0,0 +1,7 @@
[parent:../manifest.ini]
[test_a11y_calendar_month_view_wheel.py]
[test_a11y_calendar_month_view_select_day.py]
[test_a11y_calendar_month_view_select_event.py]
[test_a11y_calendar_settings_view.py]
[test_a11y_calendar_views_visibility.py]

View file

@ -0,0 +1,47 @@
# 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 marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class TestCalendarDayViewAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.calendar = Calendar(self.marionette)
self.calendar.launch()
self.event_title = 'title'
self.calendar.a11y_create_event(self.event_title)
def test_a11y_calendar_day_view(self):
self.calendar.a11y_click_day_display_button()
# Click on the all day section to create an event.
element = Wait(self.marionette).until(
expected.element_present(*self.calendar._day_view_all_day_button))
Wait(self.marionette).until(expected.element_displayed(element))
self.accessibility.click(element)
# wait for new event
new_event = self.calendar.wait_for_new_event()
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.calendar._modify_event_view_locator)))
# close new event
new_event.a11y_click_close_button()
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.calendar._day_view_locator)))
# open existing event detail
event_detail = self.calendar.a11y_click_day_view_event()
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.calendar._event_view_locator)))
# Make sure that the title and the location correspond to the selected event.
self.assertEquals(event_detail.title, self.event_title)

View file

@ -0,0 +1,36 @@
# 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/.
import datetime
from gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class TestCalendarMonthViewSelectDayAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.today = datetime.date.today()
self.previous_day = self.today - datetime.timedelta(days=1)
self.next_day = self.today + datetime.timedelta(days=1)
self.calendar = Calendar(self.marionette)
self.calendar.launch()
def test_a11y_calendar_month_view_select_day(self):
WEEKDAY_MONTH_DAY_PATTERN = '%A, %b %-d'
# By default current date event list should be rendered.
self.assertEquals(self.today.strftime(WEEKDAY_MONTH_DAY_PATTERN).upper(),
self.calendar.event_list_date)
# Click on another day in the grid.
other_day = self.calendar.a11y_click_other_day(self.next_day, self.previous_day)
# Other day date's event list should be rendered.
self.assertEquals(other_day.strftime(WEEKDAY_MONTH_DAY_PATTERN).upper(),
self.calendar.event_list_date)

View file

@ -0,0 +1,44 @@
# 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 marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class TestCalendarMonthViewSelectEventAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.event_title = 'title'
self.event_location = 'location'
self.calendar = Calendar(self.marionette)
self.calendar.launch()
new_event = self.calendar.a11y_click_add_event_button()
# create a new event
new_event.a11y_fill_event_title(self.event_title)
new_event.a11y_fill_event_location(self.event_location)
new_event.a11y_click_save_event()
self.calendar.wait_for_events(1)
def test_a11y_calendar_month_view_select_event(self):
event = self.calendar.event(self.event_title)
# Make sure that the title and the location are correct
self.assertEquals(event.title, self.event_title)
self.assertEquals(event.location, self.event_location)
event_detail = event.a11y_click()
# Make sure that the title and the location correspond to the selected event.
# Note: title and location are populated asynchronously
Wait(self.marionette).until(lambda m: self.event_title == event_detail.title)
Wait(self.marionette).until(lambda m: self.event_location == event_detail.location)

View file

@ -0,0 +1,38 @@
# 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/.
import datetime
from gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class TestCalendarMonthViewWheelAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.today = datetime.date.today()
# Determine the name and the year of the next month
self.next_month_year = self.today.replace(day=1) + datetime.timedelta(days=32)
self.calendar = Calendar(self.marionette)
self.calendar.launch()
def test_a11y_calendar_month_view_wheel(self):
MONTH_YEAR_PATTERN = '%b %Y'
# Swipe left with 2 fingers.
self.calendar.a11y_wheel_to_next_month()
# Check that the grid updated to the next month.
self.assertEquals(self.next_month_year.strftime(MONTH_YEAR_PATTERN),
self.calendar.current_month_year)
# Swipe right with 2 fingers.
self.calendar.a11y_wheel_to_previous_month()
# Check that we moved back to the current month.
self.assertEquals(self.today.strftime(MONTH_YEAR_PATTERN), self.calendar.current_month_year)

View file

@ -0,0 +1,33 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class TestCalendarSettingsViewAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.calendar = Calendar(self.marionette)
self.calendar.launch()
self.calendar.a11y_click_settings()
def test_a11y_calendar_settings_view(self):
settings = self.calendar.settings
# Check that the local calencar is checked
self.assertTrue(self.marionette.find_element(
*settings._calendar_local_checkbox_locator).get_attribute('checked'))
self.assertTrue(self.marionette.find_element(
*settings._calendar_local_locator).get_attribute('aria-selected') == 'true')
# Uncheck the local calendar
self.accessibility.click(self.marionette.find_element(*settings._calendar_local_locator))
# Check that the local calendar is unchecked
settings.wait_for_calendar_unchecked()
settings.wait_for_a11y_calendar_unchecked()

View file

@ -0,0 +1,109 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class TestCalendarViewsVisibilityAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.calendar = Calendar(self.marionette)
self.calendar.launch()
self.views = {
'time_views': self.marionette.find_element(*self.calendar._time_views_locator),
'current_day': self.marionette.find_element(
*self.calendar._current_month_day_agenda_locator),
'month': self.marionette.find_element(
*self.calendar._current_monthly_calendar_locator),
'day': self.marionette.find_element(*self.calendar._day_view_locator),
'week': self.marionette.find_element(*self.calendar._week_view_locator),
'settings': self.marionette.find_element(*self.calendar._settings_locator),
'advanced_settings': self.marionette.find_element(
*self.calendar._advanced_settings_view_locator),
'modify_event': self.marionette.find_element(*self.calendar._modify_event_view_locator),
'event': self.marionette.find_element(*self.calendar._event_view_locator),
'create_account': self.marionette.find_element(
*self.calendar._create_account_view_locator),
'modify_account': self.marionette.find_element(
*self.calendar._modify_account_view_locator)
}
self.event_title = 'title'
self.calendar.a11y_create_event(self.event_title)
def test_a11y_calendar_views_visibility(self):
def test_a11y_visible(*visible):
for key, view in self.views.iteritems():
if key in visible:
self.assertTrue(self.accessibility.is_visible(view))
else:
self.assertTrue(self.accessibility.is_hidden(view))
# Default
test_a11y_visible('time_views', 'current_day', 'month')
# Settings
self.calendar.a11y_click_settings()
test_a11y_visible('settings')
# Advanced settings
self.accessibility.click(self.marionette.find_element(
*self.calendar.settings._advanced_settings_button_locator))
test_a11y_visible('advanced_settings')
# Create account
self.accessibility.click(self.marionette.find_element(
*self.calendar._create_account_button_locator))
test_a11y_visible('create_account')
# Modify account
self.accessibility.click(self.calendar.account('caldav'))
test_a11y_visible('modify_account')
# Create account
self.calendar.a11y_click_modify_account_back()
test_a11y_visible('create_account')
# Advanced settings
self.calendar.a11y_click_create_account_back()
test_a11y_visible('advanced_settings')
# Settings
self.accessibility.click(self.marionette.find_element(
*self.calendar._advanced_settings_done_button_locator))
test_a11y_visible('settings')
# Default
self.calendar.a11y_click_close_settings()
test_a11y_visible('time_views', 'current_day', 'month')
# Week
self.calendar.a11y_click_week_display_button()
test_a11y_visible('time_views', 'week')
# Day
self.calendar.a11y_click_day_display_button()
test_a11y_visible('time_views', 'day')
# Month
self.calendar.a11y_click_month_display_button()
test_a11y_visible('time_views', 'current_day', 'month')
# New event
new_event = self.calendar.a11y_click_add_event_button()
test_a11y_visible('modify_event')
# Month
new_event.a11y_click_close_button()
test_a11y_visible('time_views', 'current_day', 'month')
# View event
event = self.calendar.event(self.event_title)
event.a11y_click()
test_a11y_visible('event')

View file

@ -0,0 +1,5 @@
[parent:../manifest.ini]
[test_a11y_email_cards_visibility.py]
[test_a11y_email_settings_view.py]
external = true

View file

@ -0,0 +1,31 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.email.app import Email
from marionette_driver import Wait
class TestEmailCardsVisibilityAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.email = Email(self.marionette)
self.email.launch()
def test_a11y_email_cards_visibility(self):
# Setup account info is visible
Wait(self.marionette).until(lambda m: self.accessibility.is_visible(m.find_element(
*self.email._setup_account_info)))
# start setting up account and enter manual setup
self.email.a11y_navigate_to_manual_setup('test_name', 'test@email.com')
# Setup account info is now hidden
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.email._setup_account_info)))
# Manual setup is now visible
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._setup_manual_config)))

View file

@ -0,0 +1,79 @@
# 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 marionette import SkipTest
from gaiatest import GaiaTestCase
from gaiatest import GaiaTestEnvironment
from gaiatest.apps.email.app import Email
class TestEmailSettingsViewAccessibility(GaiaTestCase):
def setUp(self):
if not GaiaTestEnvironment(self.testvars).email.get('gmail'):
raise SkipTest('Gmail account details not present in test variables.')
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.email = Email(self.marionette)
self.email.launch()
# setup basic gmail account
self.email.basic_setup_email('Gmail account',
self.environment.email['gmail']['email'],
self.environment.email['gmail']['password'])
def test_a11y_email_settings_view(self):
# Make sure message list screen is accessible.
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._message_list_locator)))
# Open folders menu.
toolbar = self.email.header.a11y_click_menu()
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.email._message_list_locator)))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._folder_picker_locator)))
# Open settings
settings = toolbar.a11y_click_settings()
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.email._folder_picker_locator)))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._settings_main_locator)))
# Click add account
self.accessibility.click(self.marionette.find_element(*settings._account_add_locator))
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.email._settings_main_locator)))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._setup_account_info)))
# Back to settings
self.accessibility.click(self.marionette.find_element(*self.email._back_button_locator))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._settings_main_locator)))
# Open account settings
account_settings = settings.email_accounts[0].a11y_click()
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.email._settings_main_locator)))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._settings_account_locator)))
# Delete account
delete_confirmation = account_settings.a11y_click_delete()
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.email._settings_account_locator)))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._confirm_dialog_locator)))
delete_confirmation.a11y_click_delete()
# Back to setup account
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.email._confirm_dialog_locator)))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.email._setup_account_info)))

View file

@ -0,0 +1,12 @@
[parent:../manifest.ini]
[DEFAULT]
wifi = true
carrier = true
online = true
[test_a11y_ftu.py]
skip-if = device == "desktop"
[test_a11y_ftu_desktopb2g.py]
skip-if = device != "desktop"

View file

@ -0,0 +1,98 @@
# 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 marionette_driver import By, Wait
from marionette_driver.errors import StaleElementException
from gaiatest import GaiaTestCase
from gaiatest.apps.ftu.app import Ftu
from gaiatest.apps.homescreen.app import Homescreen
class TestFtuAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.data_layer.set_setting('devtools.pseudolocalization.enabled', True)
self.ftu = Ftu(self.marionette)
self.ftu.launch()
Wait(self.marionette).until(lambda m: self.data_layer.is_wifi_enabled)
def test_a11y_ftu(self):
ssid = self.testvars['wifi']['ssid']
psk = self.testvars['wifi'].get('psk')
keymanagement = self.testvars['wifi'].get('keyManagement')
self.wait_for_condition(lambda m: self.ftu.languages_list > 0,
message='No languages listed on screen')
# Select different languages
self.assertEqual(self.ftu.selected_language, 'en-US')
self.ftu.a11y_click_language('fr-x-psaccent')
self.assertEqual(self.ftu.selected_language, 'fr-x-psaccent')
self.ftu.a11y_click_language('ar-x-psbidi')
self.assertEqual(self.ftu.selected_language, 'ar-x-psbidi')
self.ftu.a11y_click_language('en-US')
self.assertEqual(self.ftu.selected_language, 'en-US')
self.ftu.a11y_click_next_to_cell_data_section()
# Enable data
# TODO: this needs to be enabled when bug 1014887 lands.
# self.ftu.a11y_enable_data()
# self.wait_for_condition(
# lambda m: self.data_layer.is_cell_data_connected,
# message='Cell data was not connected by FTU app')
self.ftu.a11y_click_next_to_wifi_section()
# Wait for networks
self.ftu.wait_for_networks_available()
# Connect to Wifi
self.ftu.a11y_connect_to_wifi(ssid, psk, keymanagement)
Wait(self.marionette, timeout=60, ignored_exceptions=StaleElementException).until(
lambda m: 'connected' in m.find_element(
By.CSS_SELECTOR,
'#networks-list li[data-ssid="%s"] aside' %
self.testvars['wifi']['ssid']).get_attribute('class'))
self.assertTrue(self.data_layer.is_wifi_connected(self.testvars['wifi']),
'WiFi was not connected via FTU app')
self.apps.switch_to_displayed_app()
self.ftu.a11y_click_next_to_timezone_section()
# Select time zone.
self.ftu.a11y_set_timezone_continent('Asia')
self.ftu.a11y_set_timezone_city('Almaty')
self.assertEqual(self.ftu.timezone_title, 'UTC+06:00 Asia/Almaty')
self.ftu.a11y_click_next_to_geolocation_section()
# Disable geolocation
# TODO: this needs to be enabled when bug 1014887 lands.
# self.ftu.a11y_disable_geolocation()
# self.wait_for_condition(lambda m: not self.data_layer.get_setting('geolocation.enabled'),
# message='Geolocation was not disabled by the FTU app')
self.ftu.a11y_click_next_to_import_contacts_section()
self.ftu.a11y_click_next_to_firefox_accounts_section()
self.ftu.a11y_click_next_to_welcome_browser_section()
# Tap the statistics box and check that it sets a setting
self.ftu.a11y_click_statistics_checkbox()
self.wait_for_condition(
lambda m: self.data_layer.get_setting('debug.performance_data.shared'),
message='Share performance data was not set')
self.ftu.a11y_click_statistics_checkbox()
self.wait_for_condition(
lambda m: not self.data_layer.get_setting('debug.performance_data.shared'),
message='Share performance data was not unset')
self.ftu.a11y_click_next_to_privacy_browser_section()
self.ftu.a11y_click_next_to_finish_section()
# Skip the tour
self.ftu.a11y_click_skip_tour()
# Switch back to top level now that FTU app is gone
self.wait_for_condition(lambda m: self.apps.displayed_app.name == Homescreen.name)

View file

@ -0,0 +1,51 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.ftu.app import Ftu
from gaiatest.apps.homescreen.app import Homescreen
class TestFtuAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.ftu = Ftu(self.marionette)
self.ftu.launch()
def test_a11y_ftu(self):
# This test runs on TBPL only (device is covered by test_a11y_ftu.py)
self.wait_for_condition(lambda m: self.ftu.languages_list > 0,
message='No languages listed on screen')
# Select different languages
self.ftu.a11y_click_language('en-US')
self.assertEqual(self.ftu.selected_language, 'en-US')
self.ftu.a11y_click_next_to_wifi_section()
self.ftu.a11y_click_next_to_timezone_section()
self.ftu.a11y_click_next_to_geolocation_section()
self.ftu.a11y_click_next_to_import_contacts_section()
self.ftu.a11y_click_next_to_firefox_accounts_section()
self.ftu.a11y_click_next_to_welcome_browser_section()
# Tap the statistics box and check that it sets a setting
self.ftu.a11y_click_statistics_checkbox()
self.wait_for_condition(
lambda m: not self.data_layer.get_setting('debug.performance_data.shared'),
message='Share performance data was not set')
self.ftu.a11y_click_statistics_checkbox()
self.wait_for_condition(
lambda m: self.data_layer.get_setting('debug.performance_data.shared'),
message='Share performance data was not unset')
self.ftu.a11y_click_next_to_privacy_browser_section()
self.ftu.a11y_click_next_to_finish_section()
# Skip the tour
self.ftu.a11y_click_skip_tour()
# Switch back to top level now that FTU app is gone
self.wait_for_condition(lambda m: self.apps.displayed_app.name == Homescreen.name)

View file

@ -0,0 +1,8 @@
[parent:../manifest.ini]
[DEFAULT]
external = false
sdcard = true
[test_gallery_frame_visibility.py]
smoketest = true

View file

@ -0,0 +1,49 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.gallery.app import Gallery
class TestGallery(GaiaTestCase):
images = 'IMG_0001.jpg'
image_count = 4
def setUp(self):
GaiaTestCase.setUp(self)
# Add photos to storage.
self.push_resource(self.images, count=self.image_count)
def test_gallery_frame_visibility(self):
gallery = Gallery(self.marionette)
gallery.launch()
gallery.wait_for_files_to_load(self.image_count)
self.assertEqual(gallery.gallery_items_number, self.image_count)
# Tap first image to open full screen view.
image = gallery.tap_first_gallery_item()
previous_frame = image.current_image_frame
# Check that initial image is visible.
self.assertTrue(self.accessibility.is_visible(previous_frame))
# Check the next flicks.
for i in range(1, gallery.gallery_items_number):
image.flick_to_next_image()
# Check that current image is visible.
self.assertTrue(self.accessibility.is_visible(image.current_image_frame))
# Check that previous image is hidden.
self.assertTrue(self.accessibility.is_hidden(previous_frame))
previous_frame = image.current_image_frame
# Check the prev flick.
for i in range(gallery.gallery_items_number, 1, -1):
image.flick_to_previous_image()
# Check that current image is visible.
self.assertTrue(self.accessibility.is_visible(image.current_image_frame))
# Check that previous image is hidden.
self.assertTrue(self.accessibility.is_hidden(previous_frame))
previous_frame = image.current_image_frame

View file

@ -0,0 +1,4 @@
[parent:../manifest.ini]
[test_a11y_keyboard_key_names.py]
[test_a11y_keyboard_word_suggestions.py]

View file

@ -0,0 +1,40 @@
# -*- coding: iso-8859-15 -*-
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.ui_tests.app import UiTests
class TestA11yKeyboardKeyNames(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# enable auto-correction of keyboard
self.data_layer.set_setting('keyboard.autocorrect', True)
def test_a11y_keyboard_key_names(self):
self.ui_tests = UiTests(self.marionette)
self.ui_tests.launch()
# go to UI/keyboard page
keyboard_page = self.ui_tests.tap_keyboard_option()
keyboard_page.switch_to_frame()
# tap the field "input type=text"
keyboard = keyboard_page.tap_text_input()
keyboard.switch_to_keyboard();
# check special 'return' key. It should have a role of pushbutton.
self.assertEqual(keyboard.a11y_enter_key_name, 'return')
self.assertEqual(keyboard.a11y_enter_key_role, 'pushbutton')
# check special 'backspace' key. It should have a role of pushbutton.
self.assertEqual(keyboard.a11y_backspace_key_name, 'delete')
self.assertEqual(keyboard.a11y_backspace_key_role, 'pushbutton')
# check 'space' key. It should have a role of key.
self.assertEqual(keyboard.a11y_space_key_name, 'space')
self.assertEqual(keyboard.a11y_space_key_role, 'key')

View file

@ -0,0 +1,57 @@
# -*- coding: iso-8859-15 -*-
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.ui_tests.app import UiTests
class TestA11yKeyboardWordSuggestions(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# enable auto-correction of keyboard
self.data_layer.set_setting('keyboard.autocorrect', True)
def test_a11y_keyboard_word_suggestions(self):
self.ui_tests = UiTests(self.marionette)
self.ui_tests.launch()
# go to UI/keyboard page
keyboard_page = self.ui_tests.tap_keyboard_option()
keyboard_page.switch_to_frame()
# tap the field "input type=text"
keyboard = keyboard_page.tap_text_input()
# type first 7 letters of the expected word
expected_word = 'keyboard'
keyboard.send(expected_word[:7])
keyboard.switch_to_keyboard()
# check that suggestions area has proper accessibility name
self.assertEqual(keyboard.a11y_candidate_panel_name, 'Word suggestions')
# check that suggestions list has proper accessibility role
self.assertEqual(keyboard.a11y_suggestions_container_role, 'listbox')
# check that word suggestion has proper accessibility role and name
self.assertEqual(
keyboard.a11y_first_predictive_word_name, expected_word.strip())
self.assertEqual(
keyboard.a11y_first_predictive_word_role, 'listbox option')
# check that suggestions dismiss has proper accessibility role and name
self.assertEqual(keyboard.a11y_dismiss_suggestions_button_name, 'Dismiss')
self.assertEqual(keyboard.a11y_dismiss_suggestions_button_role, 'pushbutton')
# check that word suggestion can be selected via accessibility API
keyboard.a11y_first_predictive_word_click()
self.apps.switch_to_displayed_app()
keyboard_page.switch_to_frame()
# check if the word in the input field is the same as the expected word
typed_word = keyboard_page.text_input
self.assertEqual(typed_word, expected_word)

View file

@ -0,0 +1,8 @@
[parent:../manifest.ini]
[test_a11y_unlock_to_homescreen.py]
disabled = Bug 1022132 Intermittent Failure on Travis
[test_a11y_unlock_to_camera.py]
skip-if = device == "desktop"
camera = true

View file

@ -0,0 +1,34 @@
# 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 marionette_driver import By
from gaiatest import GaiaTestCase
from gaiatest.apps.lockscreen.app import LockScreen
class TestLockScreenAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.apps.set_permission('Camera', 'geolocation', 'deny')
self.device.lock()
def test_a11y_unlock_to_camera(self):
lock_screen = LockScreen(self.marionette)
lockScreen_window = self.marionette.find_element(*lock_screen._lockscreen_window_locator)
camera_locator = (By.CSS_SELECTOR, '[data-manifest-name="Camera"]')
self.assertTrue(self.accessibility.is_visible(lockScreen_window))
self.assertFalse(lock_screen.is_element_present(*camera_locator))
camera = lock_screen.a11y_click_camera_button()
self.wait_for_condition(lambda m: self.apps.displayed_app.name == camera.name)
self.assertTrue(self.accessibility.is_hidden(lockScreen_window))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*camera_locator)))
self.apps.switch_to_displayed_app()
camera.wait_for_capture_ready()

View file

@ -0,0 +1,31 @@
# 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 marionette_driver import By
from gaiatest import GaiaTestCase
from gaiatest.apps.lockscreen.app import LockScreen
from gaiatest.apps.homescreen.app import Homescreen
class TestLockScreenAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.device.lock()
def test_a11y_unlock_to_homescreen(self):
lock_screen = LockScreen(self.marionette)
lockScreen_window = self.marionette.find_element(*lock_screen._lockscreen_window_locator)
homescreen_container = self.marionette.find_element(By.ID, 'homescreen')
self.wait_for_condition(lambda m: self.accessibility.is_visible(lockScreen_window))
self.wait_for_condition(lambda m: self.accessibility.is_hidden(homescreen_container))
homescreen = lock_screen.a11y_click_unlock_button()
lock_screen.wait_for_lockscreen_not_visible()
self.assertEquals(self.apps.displayed_app.name, homescreen.name)
self.assertTrue(self.accessibility.is_hidden(lockScreen_window))
self.assertTrue(self.accessibility.is_visible(homescreen_container))

View file

@ -0,0 +1,12 @@
[parent:../manifest.ini]
[include:calendar/manifest.ini]
[include:email/manifest.ini]
[include:ftu/manifest.ini]
[include:gallery/manifest.ini]
[include:keyboard/manifest.ini]
[include:lockscreen/manifest.ini]
[include:music/manifest.ini]
[include:phone/manifest.ini]
[include:settings/manifest.ini]
[include:system/manifest.ini]

View file

@ -0,0 +1,9 @@
[parent:../manifest.ini]
[DEFAULT]
external = false
sdcard = true
[test_overlay.py]
[test_a11y_music_select_album.py]

View file

@ -0,0 +1,35 @@
# 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 marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.music_oga.app import Music
class TestAccessibilityMusicSelectAlbum(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# add track to storage
self.push_resource('MUS_0001.mp3')
def test_select_album_play(self):
music_app = Music(self.marionette)
music_app.launch()
music_app.wait_for_music_tiles_displayed()
list_view = music_app.a11y_click_albums_tab()
# check that albums (at least one) are available
albums = list_view.media
self.assertGreater(len(albums), 0, 'The mp3 file could not be found')
# select an album by click
sublist_view = albums[0].a11y_click_first_album()
element = Wait(self.marionette).until(
expected.element_present(*sublist_view._play_control_locator))
Wait(self.marionette).until(expected.element_displayed(element))
self.assertTrue(self.accessibility.is_visible(element))

View file

@ -0,0 +1,20 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.music_oga.app import Music
class TestOverlay(GaiaTestCase):
def test_empty_music(self):
# Requires there to be no songs on SDCard which is the default
music_app = Music(self.marionette)
music_app.launch()
music_app.wait_for_empty_message_to_load()
# Check that view elements are hidden when the overlay is showing.
self.assertTrue(self.accessibility.is_hidden(music_app.tabs))
self.assertTrue(self.accessibility.is_hidden(music_app.views))

View file

@ -0,0 +1,19 @@
[parent:../manifest.ini]
[test_a11y_callscreen_overlay_visibility.py]
skip-if = device == "desktop"
carrier = true
[test_a11y_callscreen_visibility.py]
skip-if = device == "desktop"
carrier = true
[test_a11y_phone_call_log.py]
skip-if = device == "desktop"
carrier = true
[test_a11y_phone_keypad.py]
[test_a11y_phone_select_toolbars.py]
[test_a11y_phone_edit_contact.py]

View file

@ -0,0 +1,31 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.phone.app import Phone
class TestAccessibilityCallscreenOverlayVisibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
self.phone = Phone(self.marionette)
self.phone.launch()
def test_a11y_callscreen_overlay_visibility(self):
test_phone_number = self.contact['tel']['value']
# Make a call
self.phone.a11y_make_call(test_phone_number)
# Check that the bluetooth dialog overlay is hidden
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone.call_screen._bluetooth_menu_locator)))
# Hang up
self.phone.a11y_hang_up()

View file

@ -0,0 +1,49 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.phone.app import Phone
class TestAccessibilityCallscreenVisibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
self.phone = Phone(self.marionette)
self.phone.launch()
def test_a11y_callscreen_visibility(self):
test_phone_number = self.contact['tel']['value']
# Make a call
self.phone.a11y_make_call(test_phone_number)
# Check that the keyboard view is hidden by default
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone.call_screen._views_locator)))
# Check that the incoming container is hidden by default
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone.call_screen._incoming_container_locator)))
# Check that the handled call hangup button is hidden by default
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone.call_screen._hangup_button_locator)))
# Check that the call options footer is visible by default
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.phone.call_screen._call_options_locator)))
self.phone.call_screen.a11y_click_keypad_visibility_button()
# Check that the call options footer is now hidden
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone.call_screen._call_options_locator)))
# Hang up from keypad
self.phone.call_screen.a11y_keypad_hang_up()

View file

@ -0,0 +1,107 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.phone.app import Phone
class TestAccessibilityPhoneCallLog(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
self.phone = Phone(self.marionette)
self.phone.launch()
def test_phone_call_log(self):
# Screen reader activated call log button click.
call_log = self.phone.a11y_click_call_log_toolbar_button()
# Edit call log button is disabled for the screen reader.
self.assertTrue(self.accessibility.is_disabled(self.marionette.find_element(
*call_log._call_log_edit_button_locator)))
# Screen reader activated keypad button click.
self.phone.a11y_click_keypad_toolbar_button()
test_phone_number = self.contact['tel']['value']
# Make a call so it will appear in the call log
self.phone.a11y_make_call_and_hang_up(test_phone_number)
# Wait for fall back to phone app
self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.phone.name)
self.apps.switch_to_displayed_app()
self.phone.a11y_click_call_log_toolbar_button()
# Edit call log button is enabled for the screen reader.
self.assertFalse(self.accessibility.is_disabled(self.marionette.find_element(
*call_log._call_log_edit_button_locator)))
call_list = call_log.call_list
# Now check that one call appears in the call log
self.assertEqual(len(call_list), 1)
# Check that the call displayed is for the call we made
self.assertIn(test_phone_number, call_list[0].phone_number)
call_log_first_item = self.marionette.find_elements(
*call_log._all_calls_list_item_button_locator)[0]
# This needs to be uncommented once the screen reader can handle long press.
# Activate a first log item with the screen reader.
# self.accessibility.click(call_log_first_item)
# # Add contact action menu should be visible to the screen reader.
# self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
# *self.phone._call_group_menu_locator)))
# # Close the add contact action menu with the screen reader.
# self.accessibility.click(self.marionette.find_element(
# *self.phone._cancel_action_menu_locator))
self.accessibility.click(self.marionette.find_element(
*call_log._call_log_edit_button_locator))
call_log_edit_element = self.marionette.find_element(
*call_log._call_log_edit_dialog_locator)
delete = self.marionette.find_element(*call_log._call_log_edit_delete_button_locator)
deselect = self.marionette.find_element(
*call_log._call_log_edit_deselect_all_button_locator)
select = self.marionette.find_element(*call_log._call_log_edit_select_all_button_locator)
# Edit mode is visible to the screen reader.
self.assertTrue(self.accessibility.is_visible(call_log_edit_element))
# Delete button is disabled for the screen reader.
self.assertTrue(self.accessibility.is_disabled(delete))
# Deselect all button is disabled for the screen reader.
self.assertTrue(self.accessibility.is_disabled(deselect))
# Select all button is enabled for the screen reader.
self.assertFalse(self.accessibility.is_disabled(select))
# Activate a first log item with the screen reader.
call_log_first_item = self.marionette.find_elements(
*call_log._all_calls_list_item_checkbox_locator)[0]
self.accessibility.click(call_log_first_item)
# Delete button is now enabled for the screen reader.
self.assertFalse(self.accessibility.is_disabled(delete))
# Deselect all button is now enabled for the screen reader.
self.assertFalse(self.accessibility.is_disabled(deselect))
# Select all button is now disabled for the screen reader.
self.assertTrue(self.accessibility.is_disabled(select))
# First item in the list is selected.
self.assertTrue(call_log_first_item.get_attribute('checked'))
self.accessibility.click(call_log_first_item)
# First item in the list is unchecked.
self.assertFalse(call_log_first_item.get_attribute('checked'))
self.accessibility.click(self.marionette.find_element(
*call_log._call_log_edit_close_button_locator))
# Edit mode is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(call_log_edit_element))

View file

@ -0,0 +1,50 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.phone.app import Phone
from gaiatest.mocks.mock_contact import MockContact
class TestAccessibilityPhoneEditContact(GaiaTestCase):
def setUp(self):
# Start application in Phone App
GaiaTestCase.setUp(self)
self.phone = Phone(self.marionette)
self.phone.launch()
def test_a11y_phone_edit_contact(self):
# Add a random contact
contacts = self.phone.a11y_click_contacts()
# Add new contact
new_contact_form = contacts.a11y_click_new_contact()
# Enter data into fields
contact = MockContact()
new_contact_form.type_given_name(contact['givenName'])
# Save new contact
new_contact_form.a11y_click_done()
self.wait_for_condition(lambda m: len(contacts.contacts) == 1)
# Edit the contact
contact_item = contacts.contact(contact['givenName'])
contact_item_detail = contact_item.a11y_click()
contact_item_edit = contact_item_detail.a11y_click_edit()
self.apps.switch_to_displayed_app()
# Now check if toolbar is visible by Screen Reader
# Keypad is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._keypad_toolbar_button_locator)))
# Contacts is visible to the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._contacts_view_locator)))
# Call log is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._call_log_toolbar_button_locator)))

View file

@ -0,0 +1,43 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.phone.app import Phone
class TestAccessibilityPhoneKeypad(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
self.phone = Phone(self.marionette)
self.phone.launch()
def test_phone_keypad(self):
# Delete is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone.keypad._keypad_delete_locator)))
# Add contact button is disabled for the screen reader.
self.assertTrue(self.accessibility.is_disabled(self.marionette.find_element(
*self.phone.keypad._add_new_contact_button_locator)))
number_to_verify = self.contact['tel']['value']
# Screen reader dial number
self.phone.keypad.a11y_dial_phone_number(number_to_verify)
# Check that the number was entered correctly.
self.assertEqual(self.phone.keypad.phone_number, number_to_verify)
# Delete is visible to the screen reader.
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.phone.keypad._keypad_delete_locator)))
# Call button is enabled for the screen reader.
self.assertFalse(self.accessibility.is_disabled(self.marionette.find_element(
*self.phone.keypad._call_bar_locator)))
# Add contact button is enabled for the screen reader.
self.assertFalse(self.accessibility.is_disabled(self.marionette.find_element(
*self.phone.keypad._add_new_contact_button_locator)))

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 gaiatest import GaiaTestCase
from gaiatest.apps.phone.app import Phone
class TestAccessibilityPhoneSelectToolbars(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.phone = Phone(self.marionette)
self.phone.launch()
def test_phone_select_toolbars(self):
# Screen reader activated call log button click.
call_log = self.phone.a11y_click_call_log_toolbar_button()
# Keypad is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._keypad_toolbar_locator)))
# Contacts is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._contacts_toolbar_locator)))
# Call log is visible to the screen reader.
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.phone._call_log_toolbar_locator)))
# Screen reader activated contacts button click.
self.phone.a11y_click_contacts()
self.apps.switch_to_displayed_app()
# Keypad is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._keypad_toolbar_locator)))
# Contacts is visible to the screen reader.
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.phone._contacts_toolbar_locator)))
# Call log is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._call_log_toolbar_locator)))
# Screen reader activated keypad button click.
self.phone.a11y_click_keypad_toolbar_button()
# Keypad is visible to the screen reader.
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.phone._keypad_toolbar_locator)))
# Contacts is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._contacts_toolbar_locator)))
# Call log is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone._call_log_toolbar_locator)))

View file

@ -0,0 +1,5 @@
[parent:../manifest.ini]
[test_a11y_slider_visibility.py]
[test_a11y_color_filters.py]
[test_a11y_captions.py]

View file

@ -0,0 +1,40 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.settings.app import Settings
class TestCaptionsAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Turn off accessibility and captions
self.data_layer.set_setting('accessibility.screenreader', False)
self.data_layer.set_setting('accessibility.screenreader-captions', False)
self.settings = Settings(self.marionette)
self.settings.launch()
def test_a11y_captions(self):
accessibility_settings = self.settings.open_accessibility()
screenreader_settings = accessibility_settings.a11y_open_screenreader_settings()
# Captions should be invisible when screen reader is disabled
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*screenreader_settings._screen_reader_captions_locator)))
# Turn on screen reader
self.data_layer.set_setting('accessibility.screenreader', True)
# Captions should be visible when screen reader is on
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*screenreader_settings._screen_reader_captions_locator)))
# Turn on captions
screenreader_settings.a11y_toggle_captions()
# Captions settings should be set
self.wait_for_condition(
lambda m: self.data_layer.get_setting('accessibility.screenreader-captions'))

View file

@ -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 gaiatest import GaiaTestCase
from gaiatest.apps.settings.app import Settings
class TestColorFiltersAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# set initial state, including colors disabled
self.data_layer.set_setting('accessibility.colors.enabled', False)
self.data_layer.set_setting('accessibility.colors.invert', False)
self.data_layer.set_setting('accessibility.colors.grayscale', False)
self.data_layer.set_setting('accessibility.colors.contrast', 0.0)
self.settings = Settings(self.marionette)
self.settings.launch()
def test_a11y_color_filters(self):
accessibility_settings = self.settings.open_accessibility()
colors_settings = accessibility_settings.a11y_open_color_settings()
# make sure the actual settings are hidden
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*colors_settings._invert_switch_locator)))
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*colors_settings._grayscale_switch_locator)))
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*colors_settings._contrast_slider_locator)))
# turn on color filters
colors_settings.a11y_toggle_filters()
# the color settings should show up now
self.wait_for_condition(lambda m: colors_settings.invert_switch_visible)
self.wait_for_condition(lambda m: colors_settings.grayscale_switch_visible)
self.wait_for_condition(
lambda m: self.accessibility.is_visible(self.marionette.find_element(
*colors_settings._contrast_slider_locator)))
colors_settings.a11y_toggle_invert()
# layers invert setting should be set
self.wait_for_condition(
lambda m: self.data_layer.get_setting('layers.effect.invert'))
colors_settings.a11y_toggle_grayscale()
# layers grayscale setting should be set
self.wait_for_condition(
lambda m: self.data_layer.get_setting('layers.effect.grayscale'))
# turn off color filters
colors_settings.a11y_toggle_filters()
# layers settings should go back to default automatically
self.wait_for_condition(
lambda m: not self.data_layer.get_setting('layers.effect.invert'))
self.wait_for_condition(
lambda m: not self.data_layer.get_setting('layers.effect.grayscale'))
# make sure the actual settings are hidden
self.assertTrue(colors_settings.invert_switch_hidden)
self.assertTrue(colors_settings.grayscale_switch_hidden)
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*colors_settings._contrast_slider_locator)))

View file

@ -0,0 +1,44 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.settings.app import Settings
class TestSliderVisibilityAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.settings = Settings(self.marionette)
self.settings.launch()
def test_a11y_slider_visibility(self):
accessibility_settings = self.settings.open_accessibility()
screenreader_settings = accessibility_settings.a11y_open_screenreader_settings()
# Rate and volume settings should be invisible when screen reader is disabled
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*screenreader_settings._screen_reader_volume_slider_locator)))
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*screenreader_settings._screen_reader_rate_slider_locator)))
# Turn on screen reader
self.data_layer.set_setting('accessibility.screenreader', True)
# Both rate and volume sliders should be visible when screen reader is on
self.wait_for_condition(lambda x:
self.accessibility.is_visible(self.marionette.find_element(
*screenreader_settings._screen_reader_volume_slider_locator)))
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*screenreader_settings._screen_reader_rate_slider_locator)))
# Turn screen reader off again
self.data_layer.set_setting('accessibility.screenreader', False)
# Rate and volume settings should be invisible when screen reader is disabled
self.wait_for_condition(lambda x:
self.accessibility.is_hidden(self.marionette.find_element(
*screenreader_settings._screen_reader_volume_slider_locator)))
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*screenreader_settings._screen_reader_rate_slider_locator)))

View file

@ -0,0 +1,16 @@
[parent:../manifest.ini]
[test_a11y_cards_view.py]
[test_a11y_cards_view_status_bar_visibility.py]
[test_a11y_notification_visibility.py]
[test_a11y_software_buttons_visibility.py]
skip-if = device == "desktop"
[test_a11y_screen_manager.py]
[test_a11y_update_manager_toaster_visibility.py]
[test_a11y_utility_tray_notifications.py]
[test_a11y_utility_tray_settings.py]
[test_a11y_utility_tray_visibility.py]
[test_a11y_volume_buttons.py]
[test_a11y_volume_buttons_panel_visibility.py]

View file

@ -0,0 +1,114 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.system.regions.cards_view import CardsView
class TestCardsViewAccessibility(GaiaTestCase):
_test_apps = ['Calendar', 'Settings', 'Clock']
def setUp(self):
GaiaTestCase.setUp(self)
# Launch the test apps
for app in self._test_apps:
self.apps.launch(app, switch_to_frame=False)
# Switch to top level frame before starting the test
self.marionette.switch_to_frame()
def test_a11y_cards_view(self):
cards_view = CardsView(self.marionette)
self.assertTrue(cards_view.is_cards_view_a11y_hidden,
'Cards view should not be visible to the screen reader')
# Pull up the cards view
self.device.hold_home_button()
cards_view.wait_for_cards_view()
# Wait for first app ready
cards_view.cards[2].wait_for_centered()
# Only current card should be visible
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))
# Swipe with two fingers right and left and verify card visibility
cards_view.a11y_wheel_cards_view('right')
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))
cards_view.a11y_wheel_cards_view('right')
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))
# Swipe again even though there's nowhere to swipe to make sure the
# state does not break
cards_view.a11y_wheel_cards_view('right')
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))
cards_view.a11y_wheel_cards_view('left')
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))
cards_view.a11y_wheel_cards_view('left')
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))
# Swipe again even though there's nowhere to swipe to make sure the
# state does not break
cards_view.a11y_wheel_cards_view('left')
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))
# Assert there are 3 cards
self.assertEqual(3, len(cards_view.cards), 'Expected 3 cards')
# Remove a card by swiping with 2 fingers up
cards_view.a11y_wheel_cards_view('up')
# Assert there are 2 cards
cards = cards_view.cards
self.assertEqual(2, len(cards), 'Expected 2 cards')
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))
# Remove a card by clicking its close button
cards[1].a11y_click_close_button()
# Assert there is 1 card
cards = cards_view.cards
self.assertEqual(1, len(cards), 'Expected 1 card')
self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))
# Open an app by clicking its icon
cards[0].a11y_click_app_icon()
cards_view.wait_for_cards_view_not_displayed()
self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
# Switch to top level frame and reopen cards view
self.marionette.switch_to_frame()
self.device.hold_home_button()
cards_view.wait_for_cards_view()
cards_view.cards[0].wait_for_centered()
# Assert there is 1 card
cards = cards_view.cards
self.assertEqual(1, len(cards), 'Expected 1 card')
# Open an app by clicking its screenshot view
cards[0].a11y_click_screenshot_view()
cards_view.wait_for_cards_view_not_displayed()
self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])

View file

@ -0,0 +1,34 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.system.regions.cards_view import CardsView
from gaiatest.apps.system.app import System
class TestCardsViewStatusbarVisibilityAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.apps.launch('Calendar')
# Switch to top level frame before starting the test
self.marionette.switch_to_frame()
def test_a11y_cards_view_status_bar_visibility(self):
cards_view = CardsView(self.marionette)
status_bar = System(self.marionette).status_bar
# Pull up the cards view
self.device.hold_home_button()
cards_view.wait_for_cards_view()
# Wait for the app card ready
cards_view.cards[0].wait_for_centered()
# Statusbar icons should be invisible to the screen reader.
self.wait_for_condition(lambda m: status_bar.is_status_bar_maximized_wrapper_a11y_hidden)
self.wait_for_condition(lambda m: status_bar.is_status_bar_minimized_wrapper_a11y_hidden)

View file

@ -0,0 +1,41 @@
# 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/.
import time
from gaiatest import GaiaTestCase
from gaiatest.apps.system.app import System
class TestNotificationVisibilityAccessibility(GaiaTestCase):
# notification data
_notification_title = 'TestNotificationBar_TITLE'
_notification_body = 'TestNotificationBar_BODY'
def setUp(self):
GaiaTestCase.setUp(self)
self.system = System(self.marionette)
def test_a11y_notification_visibility(self):
# By default notification toaster should be invisible to the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.system._notification_toaster_locator)))
# Push a notification
self.marionette.execute_script('new Notification("%s", {body: "%s"});'
% (self._notification_title, self._notification_body))
self.system.wait_for_notification_toaster_displayed()
# Now the notification toaster should be visible to the screen reader.
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.system._notification_toaster_locator)))
self.system.wait_for_notification_toaster_not_displayed()
# Again the notification toaster should be invisible to the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.system._notification_toaster_locator)))

View file

@ -0,0 +1,39 @@
# 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 marionette_driver import Wait
from marionette_driver.errors import TimeoutException
from gaiatest import GaiaTestCase
SCREEN_TIMEOUT = 15
TIMEOUT_TOLERANCE = 10
class screen_disabled(object):
def __init__(self, device, interrupt=None):
self.device = device
self.interrupt = interrupt
def __call__(self, marionette):
if self.interrupt is not None:
self.interrupt()
return not self.device.is_screen_enabled
class TestScreenManagerAccessibility(GaiaTestCase):
def modify_settings(self, settings):
settings['screen.timeout'] = SCREEN_TIMEOUT
return settings
def test_a11y_screen_manager(self):
timeout = SCREEN_TIMEOUT + TIMEOUT_TOLERANCE
self.device.turn_screen_on()
Wait(self.marionette, timeout).until(screen_disabled(self.device))
self.device.turn_screen_on()
with self.assertRaises(TimeoutException):
Wait(self.marionette, timeout).until(screen_disabled(
self.device, interrupt=self.accessibility.dispatchEvent))

View file

@ -0,0 +1,34 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.system.app import System
class TestSoftwareButtonsVisibilityAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.system = System(self.marionette)
def test_a11y_software_buttons_visibility(self):
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.system._software_home_button_locator)))
# Enable software button visibility
self.data_layer.set_setting('software-button.enabled', True)
# # Software buttons should now be visible
self.system.wait_for_software_home_button_displayed()
self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
*self.system._software_home_button_locator)))
# # Disable software button visibility
self.data_layer.set_setting('software-button.enabled', False)
# # Software buttons should now be invisible
self.system.wait_for_software_home_button_not_displayed()
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.system._software_home_button_locator)))

View file

@ -0,0 +1,18 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.system.app import System
class TestUpdateManagerToasterVisibilityAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.system = System(self.marionette)
def test_a11y_update_manager_toaster_visibility(self):
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.system._update_manager_toaster_locator)))

View file

@ -0,0 +1,29 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.system.app import System
class TestUtilityTrayNotificationsAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.system = System(self.marionette)
def test_a11y_utility_tray_notifications(self):
self.system.wait_for_status_bar_displayed()
utility_tray = self.system.open_utility_tray()
self.marionette.execute_script('new Notification("Title", {body: "Body"});')
# Assert there is one notification is listed in notifications-container
notifications = utility_tray.notifications
self.assertEqual(1, len(notifications), 'Expected one notification.')
# Clear the notification by "Clear all"
utility_tray.a11y_clear_all_notifications()
# wait for the notifications to be cleared
self.wait_for_condition(lambda m: len(utility_tray.notifications) == 0)

View file

@ -0,0 +1,24 @@
# 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 marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.system.app import System
class TestUtilityTraySettingsAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.system = System(self.marionette)
def test_a11y_utility_tray_settings(self):
self.system.wait_for_status_bar_displayed()
utility_tray = self.system.open_utility_tray()
settings = utility_tray.a11y_click_quick_settings_full_app()
# Make sure that Settings is the currently displayed app.
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == settings.name)

View file

@ -0,0 +1,36 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.system.app import System
from gaiatest.apps.system.regions.status_bar import StatusBar
from gaiatest.apps.system.regions.utility_tray import UtilityTray
class TestUtilityTrayVisibilityAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.system = System(self.marionette)
self.status_bar = self.system.status_bar
self.utility_tray = UtilityTray(self.marionette)
def test_a11y_utility_tray_visibility(self):
self.system.wait_for_status_bar_displayed()
utility_tray_container = self.marionette.find_element(*self.system._utility_tray_locator)
# Utility tray is hidden by default.
self.assertTrue(self.accessibility.is_hidden(utility_tray_container))
self.status_bar.a11y_wheel_status_bar_time()
self.utility_tray.wait_for_dropped_down()
# Utility tray should now be visible.
self.assertTrue(self.accessibility.is_visible(utility_tray_container))
self.utility_tray.a11y_wheel_utility_tray_grippy()
# Utility tray should now be hidden.
self.assertTrue(self.accessibility.is_hidden(utility_tray_container))

View file

@ -0,0 +1,46 @@
# 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/.
import time
from gaiatest import GaiaTestCase
class TestVolumeButtonsAccessibility(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
def test_a11y_volume_buttons(self):
# Screen reader is currently disabled.
self.assertFalse(self.data_layer.get_setting('accessibility.screenreader'))
self.device.press_release_volume_up_then_down_n_times(3)
time.sleep(3)
self.device.press_release_volume_up_then_down_n_times(3)
# Screen reader is now enabled.
self.assertTrue(self.data_layer.get_setting('accessibility.screenreader'))
self.device.press_release_volume_up_then_down_n_times(3)
time.sleep(3)
self.device.press_release_volume_up_then_down_n_times(3)
# Screen reader is disabled again.
self.assertFalse(self.data_layer.get_setting('accessibility.screenreader'))
# Press the volume up/down buttons 2 times, then wait for more than 0.6s
self.device.press_release_volume_up_then_down_n_times(2)
time.sleep(0.7)
self.device.press_release_volume_up_then_down_n_times(4)
# Screen reader should still be disabled.
self.assertFalse(self.data_layer.get_setting('accessibility.screenreader'))
self.device.press_release_volume_up_then_down_n_times(1)
# Wait for more than 0.6s after the initial 5 presses.
time.sleep(0.7)
self.device.press_release_volume_up_then_down_n_times(1)
# Screen reader should still be disabled.
self.assertFalse(self.data_layer.get_setting('accessibility.screenreader'))

View file

@ -0,0 +1,13 @@
# 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 marionette_driver import expected, By, Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.homescreen.app import Homescreen
class TestBrickVerification(GaiaTestCase):
def test_verify_phone_not_bricked(self):
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == Homescreen.name)

View file

@ -0,0 +1,38 @@
[parent:../manifest.ini]
[DEFAULT]
external = false
online = true
[test_browser_cell_data.py]
carrier = true
external = true
smoketest = true
skip-if = device == "desktop"
[test_browser_lan.py]
external=true
lan = true
smoketest = true
sanity = true
[test_browser_save_image.py]
sdcard = true
# Bug 1091622 - "Save image" action from browser saves file to wrong location
fail-if = device == "desktop"
[test_browser_navigation.py]
[test_browser_first_run.py]
[test_browser_play_video.py]
smoketest = true
[test_browser_clear_browsing_history.py]
[test_browser_private_navigation.py]
dogfood = true
[test_browser_launch_from_background.py]
[test_browser_launch_from_rocketbar.py]

View file

@ -0,0 +1,40 @@
# 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 marionette_driver import By, Wait, expected
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
class TestBrowserCellData(GaiaTestCase):
_page_title_locator = (By.ID, 'page-title')
def setUp(self):
GaiaTestCase.setUp(self)
self.data_layer.connect_to_cell_data()
def test_browser_cell_data(self):
"""
https://moztrap.mozilla.org/manage/case/1328/
"""
search = Search(self.marionette)
search.launch()
browser = search.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')
browser.wait_for_page_to_load(120)
browser.switch_to_content()
heading = Wait(self.marionette, timeout=120).until(
expected.element_present(*self._page_title_locator))
self.assertEqual(heading.text, 'We believe that the internet should be public, open and accessible.')
def tearDown(self):
self.marionette.switch_to_frame()
self.data_layer.disable_cell_data()
GaiaTestCase.tearDown(self)

View file

@ -0,0 +1,46 @@
# 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 marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
from gaiatest.apps.settings.app import Settings
class TestBrowserClearHistory(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.test_url = self.marionette.absolute_url('mozilla.html')
def test_browser_clear_history(self):
"""
https://moztrap.mozilla.org/manage/cases/?filter-id=3582
"""
search = Search(self.marionette)
search.launch()
browser = search.go_to_url(self.test_url)
browser.switch_to_content()
Wait(self.marionette, timeout=30).until(lambda m: m.title == 'Mozilla')
self.apps.kill(search.app)
search.launch()
search.wait_for_history_to_load(number_of_items=1)
self.assertGreater(search.history_items_count, 0)
settings = Settings(self.marionette)
settings.launch()
browsing_privacy = settings.open_browsing_privacy()
confirm_dialog = browsing_privacy.clear_browsing_history()
confirm_dialog.confirm_clear()
self.device.touch_home_button()
search.launch()
search.wait_for_history_to_load(number_of_items=0)
self.assertEqual(0, search.history_items_count)

View file

@ -0,0 +1,48 @@
# 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 marionette_driver import By, Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
from gaiatest.apps.system.regions.fullscreen_dialog import TrackingDialog
class TestBrowserFirstRun(GaiaTestCase):
def modify_settings(self, settings):
settings['privacy.trackingprotection.shown'] = False
return settings
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.test_url = self.marionette.absolute_url('mozilla.html')
self.test_url2 = 'https://people.mozilla.org/~fmarier/tracking-test/'
def test_browser_first_run(self):
search = Search(self.marionette)
search.launch()
tracking_dialog = TrackingDialog(self.marionette)
self.assertTrue(tracking_dialog.is_displayed)
browser = tracking_dialog.open_learn_more()
browser.wait_for_page_to_start_loading()
browser.wait_for_page_to_load()
self.assertFalse(tracking_dialog.is_displayed)
browser.go_to_url(self.test_url)
tracking_dialog.enable_tracking_protection()
tracking_dialog.close_tracking_protection_dialog()
browser.go_to_url(self.test_url2)
browser.wait_for_page_to_load()
browser.switch_to_content()
element = self.marionette.find_element(By.ID, 'caption')
Wait(self.marionette).until(lambda m: element.text == 'You have successfully enabled tracking protection. Please continue!')
# Check that no tracking protection dialog appears anymore
self.assertFalse(tracking_dialog.is_present)

View file

@ -0,0 +1,27 @@
# 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 marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
class TestBrowserLAN(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.test_url = 'http://mozqa.com/data/firefox/layout/mozilla.html'
def test_browser_lan(self):
"""
https://moztrap.mozilla.org/manage/case/1327/
"""
search = Search(self.marionette)
search.launch()
browser = search.go_to_url(self.test_url)
browser.switch_to_content()
Wait(self.marionette).until(lambda m: m.title == 'Mozilla')

View file

@ -0,0 +1,51 @@
# 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 gaiatest import GaiaTestCase
from marionette_driver import By, Wait
from gaiatest.apps.search.app import Search
from gaiatest.apps.search.regions.browser import Browser
from gaiatest.apps.system.regions.cards_view import CardsView
class TestLaunchViaManifest(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.test_url = self.marionette.absolute_url('mozilla.html')
def test_launch_manifest(self):
search = Search(self.marionette)
search.launch()
self.device.touch_home_button()
search.launch()
browser = search.go_to_url(self.test_url)
browser.switch_to_content()
Wait(self.marionette).until(lambda m: m.title == 'Mozilla')
self.device.touch_home_button()
# This should open the previous opened browser window
search.launch()
browser = search.go_to_url('data:text/html;charset=utf-8,<title>hello</title>')
browser.switch_to_content()
Wait(self.marionette).until(lambda m: m.title == 'hello')
browser.switch_to_chrome()
# This shouldn't do anything
search.launch()
self.device.hold_home_button()
cards_view = CardsView(self.marionette)
cards_view.wait_for_cards_view()
cards_view.cards[0].wait_for_centered()
self.assertEqual(len(cards_view.cards), 1, 'Should have 1 card to display')
self.assertTrue(cards_view.cards[0].is_displayed)
self.assertEqual(cards_view.cards[0].title, 'hello')

View file

@ -0,0 +1,22 @@
# 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 gaiatest import GaiaTestCase
from marionette_driver import Wait
from gaiatest.apps.system.app import System
class TestLaunchViaManifest(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.test_url = self.marionette.absolute_url('mozilla.html')
def test_launch_manifest(self):
search_panel = System(self.marionette).tap_search_bar()
browser = search_panel.go_to_url(self.test_url)
browser.switch_to_content()
Wait(self.marionette).until(lambda m: m.title == 'Mozilla')

View file

@ -0,0 +1,38 @@
# 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 marionette_driver import By, Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
class TestBrowserNavigation(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.test_url = self.marionette.absolute_url('mozilla.html')
def test_browser_back_button(self):
search = Search(self.marionette)
search.launch()
browser = search.go_to_url(self.test_url)
browser.switch_to_content()
Wait(self.marionette).until(lambda m: m.title == 'Mozilla')
link = self.marionette.find_element(By.CSS_SELECTOR, '#community a')
link.tap()
Wait(self.marionette).until(lambda m: m.title == 'Mozilla Community')
browser.switch_to_chrome()
browser.tap_back_button()
browser.switch_to_content()
Wait(self.marionette).until(lambda m: m.title == 'Mozilla')
browser.switch_to_chrome()
browser.tap_forward_button()
browser.switch_to_content()
Wait(self.marionette).until(lambda m: m.title == 'Mozilla Community')

View file

@ -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 marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
from gaiatest.apps.search.regions.html5_player import HTML5Player
from gaiatest.apps.homescreen.regions.permission_dialog import PermissionDialog
class TestVideo(GaiaTestCase):
acceptable_delay = 2.0
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.video_URL = self.marionette.absolute_url('VID_counter.ogg')
def test_play_video(self):
"""Confirm video playback
https://moztrap.mozilla.org/manage/case/6073/
"""
search = Search(self.marionette)
search.launch()
browser = search.go_to_url(self.video_URL)
browser.wait_for_page_to_load(180)
browser.switch_to_content()
player = HTML5Player(self.marionette)
# Check that video is playing
player.wait_for_video_loaded()
self.assertTrue(player.is_playing)
# Tap on the edge of the video to make the controls appear
player.invoke_controls()
# Pause playback
player.tap_pause()
stopped_at = player.current_timestamp
self.assertFalse(player.is_playing)
resumed_at = player.current_timestamp
# Resume playback
player.tap_play()
# Ensure that video resumes to play
# from the place where it was paused
delay = resumed_at - stopped_at
self.assertLessEqual(delay, self.acceptable_delay,
'video resumed to play not from place where it was paused, paused at %.3f, resumed at %.3f' % (stopped_at, resumed_at))
# Make sure the video is ready to play again
player.wait_for_video_loaded()
self.assertTrue(player.is_playing)
# After tapping the play button, the controls disappear, make them appear again
player.invoke_controls()
# Tap mute button
player.tap_mute()
player.tap_unmute()
player.tap_full_screen()
permission = PermissionDialog(self.marionette)
self.marionette.switch_to_default_content()
permission.wait_for_permission_dialog_displayed()
permission.tap_to_confirm_permission()
# The interaction with the permission dialog makes us
# loose connection to the player frame, so we need to reconnect
browser.switch_to_content()
player = HTML5Player(self.marionette)
Wait(self.marionette).until(lambda m: player.is_fullscreen)
# After tapping full screen, the controls disappear, make them appear again
# Normally, we would use invoke_controls(), but this seems to cause intermittent failures
# Bug 1111734 is filed to replace invoke_controls() to show_controls(), once it is possible
Wait(self.marionette).until(lambda m: player.controls_visible is False)
player.show_controls()
Wait(self.marionette).until(lambda m: player.controls_visible)
player.tap_full_screen()
Wait(self.marionette).until(lambda m: player.is_fullscreen is False)
Wait(self.marionette).until(lambda m: player.controls_visible is False)

View file

@ -0,0 +1,36 @@
# 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 marionette_driver import By, Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
from gaiatest.apps.system.regions.cards_view import CardsView
class TestBrowserPrivateNavigation(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.test_url = self.marionette.absolute_url('mozilla.html')
def test_browser_private_navigation(self):
self.device.hold_home_button()
cards_view = CardsView(self.marionette)
private_window = cards_view.open_new_private_window()
browser = private_window.go_to_url(self.test_url)
browser.switch_to_content()
Wait(self.marionette).until(lambda m: m.title == 'Mozilla')
self.device.hold_home_button()
cards_view = CardsView(self.marionette)
cards_view.wait_for_cards_view()
search = cards_view.open_new_browser()
# This is to switch the marionette context to the browser content
search.launch()
self.assertEqual(search.history_items_count, 0)

View file

@ -0,0 +1,51 @@
# 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 marionette_driver.marionette import Actions
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
from gaiatest.apps.system.regions.activities import Activities
from gaiatest.apps.system.app import System
class TestBrowserSaveImage(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
self.test_url = self.marionette.absolute_url('IMG_0001.jpg')
def test_browser_save_image(self):
"""
https://moztrap.mozilla.org/manage/case/6889/
"""
# Check that there are no images on sdcard before saving
self.assertEqual(0, len(self.data_layer.sdcard_files('.jpeg')))
search = Search(self.marionette)
search.launch()
browser = search.go_to_url(self.test_url)
browser.switch_to_content()
# Long tap on the image inside the browser content
image = self.marionette.find_element('css selector', 'img')
Actions(self.marionette).\
press(image).\
wait(3).\
release().\
wait(1).\
perform()
activities = Activities(self.marionette)
activities.tap_save_image()
system = System(self.marionette)
system.wait_for_notification_toaster_displayed()
system.wait_for_notification_toaster_not_displayed()
self.assertEqual(1, len(self.data_layer.sdcard_files('.jpeg')))

View file

@ -0,0 +1,4 @@
[parent:../manifest.ini]
[test_login.py]
[test_logout.py]

View file

@ -0,0 +1,17 @@
from gaiatest import GaiaTestCase
from gaiatest.apps.bugzillalite.app import BugzillaLite
class TestBugzillaLite(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
def test_login_BugzillaLite(self):
bugzilla_lite = BugzillaLite(self.marionette)
bugzilla_lite.launch()
bugzilla_lite.dismiss_tooltip()
bugzilla_lite.login(self.testvars['bugzilla']['user'], self.testvars['bugzilla']['password'])
self.assertTrue(bugzilla_lite.is_logged_in)

View file

@ -0,0 +1,16 @@
from gaiatest import GaiaTestCase
from gaiatest.apps.bugzillalite.app import BugzillaLite
class testBzLogout(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
def test_logout_BugzillaLite(self):
bugzilla_lite = BugzillaLite(self.marionette)
bugzilla_lite.launch()
bugzilla_lite.dismiss_tooltip()
bugzilla_lite.login(self.testvars['bugzilla']['user'], self.testvars['bugzilla']['password'])
self.assertTrue(bugzilla_lite.is_logged_in)
bugzilla_lite.logout()
self.assertTrue(bugzilla_lite.is_logged_out)

View file

@ -0,0 +1,9 @@
[parent:../manifest.ini]
[DEFAULT]
external = false
[test_calendar_new_event_appears_on_all_calendar_views.py]
smoketest = true
[test_calendar_flick_through_months.py]

View file

@ -0,0 +1,33 @@
# 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/.
import datetime
from gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class TestCalendar(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.today = datetime.date.today()
# Determine the name and the year of the next month
self.next_month_year = self.today.replace(day=1) + datetime.timedelta(days=32)
def test_calendar_flick_through_months(self):
"""https://bugzilla.mozilla.org/show_bug.cgi?id=937085"""
MONTH_YEAR_PATTERN = '%b %Y'
calendar = Calendar(self.marionette)
calendar.launch()
calendar.flick_to_next_month()
self.assertEquals(self.next_month_year.strftime(MONTH_YEAR_PATTERN),
calendar.current_month_year)
calendar.flick_to_previous_month()
self.assertEquals(self.today.strftime(MONTH_YEAR_PATTERN), calendar.current_month_year)

View file

@ -0,0 +1,46 @@
# 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 datetime import datetime, timedelta
from gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class TestCalendar(GaiaTestCase):
def test_that_new_event_appears_on_all_calendar_views(self):
"""
https://moztrap.mozilla.org/manage/case/6118/
"""
# We get the actual time of the device
_seconds_since_epoch = self.marionette.execute_script("return Date.now();")
now = datetime.fromtimestamp(_seconds_since_epoch / 1000)
event_title = 'Event Title %s' % str(now.time())
event_location = 'Event Location %s' % str(now.time())
calendar = Calendar(self.marionette)
calendar.launch()
new_event = calendar.tap_add_event_button()
# create a new event
new_event.fill_event_title(event_title)
new_event.fill_event_location(event_location)
event_start_date = new_event.tap_save_event()
# assert that the event is displayed as expected in month view
self.assertIn(event_title, calendar.displayed_events_in_month_view())
self.assertIn(event_location, calendar.displayed_events_in_month_view())
# switch to the week display
calendar.tap_week_display_button()
self.assertIn(event_title, calendar.displayed_events_in_week_view(event_start_date))
# switch to the day display
calendar.tap_day_display_button()
self.assertIn(event_title, calendar.displayed_events_in_day_view(event_start_date))
self.assertIn(event_location, calendar.displayed_events_in_day_view(event_start_date))

View file

@ -0,0 +1,37 @@
[parent:../manifest.ini]
[DEFAULT]
camera = true
external = false
sdcard = true
[test_camera_capture_photo.py]
# Bug 946375 - Unable to capture photos and videos on emulator
fail-if = device == "qemu"
skip-if = device == "desktop"
sanity = true
[test_camera_capture_video.py]
smoketest = true
# Bug 946375 - Unable to capture photos and videos on emulator
fail-if = device == "qemu"
skip-if = device == "desktop"
[test_camera_flash_modes.py]
flash = true
# Bug 964812 - Disable test_camera_flash
# No camera/flash on desktop
skip-if = device == "msm7627a" || device == "desktop"
# Bug 946375 - Unable to capture photos and videos on emulator
fail-if = device == "qemu"
[test_camera_multiple_shots.py]
smoketest = true
# Bug 946375 - Unable to capture photos and videos on emulator
fail-if = device == "qemu"
skip-if = device == "desktop"
[test_camera_delete_captured_video.py]
# Bug 946375 - Unable to capture photos and videos on emulator
fail-if = device == "qemu"
skip-if = device == "desktop"

View file

@ -0,0 +1,32 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.camera.app import Camera
class TestCamera(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Turn off geolocation prompt
self.apps.set_permission('Camera', 'geolocation', 'deny')
def test_capture_a_photo(self):
"""https://moztrap.mozilla.org/manage/case/1325/"""
self.previous_number_of_pictures = len(self.data_layer.picture_files)
self.camera = Camera(self.marionette)
self.camera.launch()
# Take a photo
self.camera.take_photo()
# Check that Filmstrip is visible
self.assertTrue(self.camera.is_thumbnail_visible)
# Check that picture saved to SD card
self.wait_for_condition(lambda m: len(self.data_layer.picture_files) == self.previous_number_of_pictures + 1, 10)
self.assertEqual(len(self.data_layer.picture_files), self.previous_number_of_pictures + 1)

View file

@ -0,0 +1,35 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.camera.app import Camera
class TestCamera(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Turn off geolocation prompt
self.apps.set_permission('Camera', 'geolocation', 'deny')
def test_capture_a_video(self):
"""
https://moztrap.mozilla.org/manage/case/2477/
"""
self.previous_number_of_videos = len(self.data_layer.video_files)
self.camera = Camera(self.marionette)
self.camera.launch()
# Switch to video mode
self.camera.tap_switch_source()
# Record 3 seconds of video
self.camera.record_video(3)
# Check that video saved to SD card
self.wait_for_condition(lambda m: len(self.data_layer.video_files) == self.previous_number_of_videos + 1, 15)
self.assertEqual(len(self.data_layer.video_files), self.previous_number_of_videos + 1)
self.assertTrue(self.data_layer.video_files[0]["size"] > 1000)

View file

@ -0,0 +1,57 @@
# 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/.
import time
from gaiatest import GaiaTestCase
from gaiatest.apps.camera.app import Camera
from gaiatest.apps.camera.app import ImagePreview
from marionette_driver import Wait
class TestPreviewDelete(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Turn off geolocation prompt
self.apps.set_permission('Camera', 'geolocation', 'deny')
def test_capture_and_delete_video(self):
"""
https://moztrap.mozilla.org/manage/case/3324/
"""
self.previous_number_of_videos = len(self.data_layer.video_files)
# launch camera app
self.camera = Camera(self.marionette)
self.camera.launch()
# Switch to video mode
self.camera.tap_switch_source()
# Record 10 seconds of video
self.camera.record_video(10)
# Check that video saved to SD card
self.assertEqual(len(self.data_layer.video_files), self.previous_number_of_videos + 1)
# Tap preview icon to see the video that's just taken
self.camera.tap_thumbnail()
self.preview = ImagePreview(self.marionette)
Wait(self.marionette).until(lambda m: self.preview.is_video_play_button_visible is True)
# Play video, then pause it
self.preview.tap_video_player_play_button()
time.sleep(5)
self.preview.tap_video_player_pause_button()
# Tape the options icon, and delete the file
self.preview.delete_file()
# Check the user is back in camera preview mode, and there is no preview icon anymore
Wait(self.marionette).until(lambda m: self.camera.is_thumbnail_visible is False)
# Verify the video is deleted now
self.assertEqual(len(self.data_layer.video_files), self.previous_number_of_videos)

View file

@ -0,0 +1,67 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.camera.app import Camera
class TestCameraFlashModes(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Turn off Geolocation prompt
self.apps.set_permission('Camera', 'geolocation', 'deny')
def test_camera_flash_modes(self):
# https://moztrap.mozilla.org/manage/case/1325/
self.previous_number_of_pictures = len(self.data_layer.picture_files)
self.camera = Camera(self.marionette)
self.camera.launch()
# Toggle flash mode to "on"
self.camera.tap_toggle_flash_button()
self.assertEqual(self.camera.current_flash_mode, 'on')
# Take a photo
self.camera.take_photo()
# Check that thumbnail is visible
self.assertTrue(self.camera.is_thumbnail_visible)
# Check that picture saved to SD card
self.wait_for_condition(lambda m: len(self.data_layer.picture_files) == self.previous_number_of_pictures + 1, 10)
self.assertEqual(len(self.data_layer.picture_files), self.previous_number_of_pictures + 1)
# Toggle flash mode to "off"
self.camera.tap_toggle_flash_button()
self.assertEqual(self.camera.current_flash_mode, 'off')
first_image_src = self.camera.current_image_src
# Take a photo
self.camera.take_photo()
self.camera.wait_for_picture_to_change(first_image_src)
# Check that Filmstrip is visible
self.assertTrue(self.camera.is_thumbnail_visible)
# Check that picture saved to SD card
self.wait_for_condition(lambda m: len(self.data_layer.picture_files) == self.previous_number_of_pictures + 2, 10)
self.assertEqual(len(self.data_layer.picture_files), self.previous_number_of_pictures + 2)
# Toggle flash mode to "auto"
self.camera.tap_toggle_flash_button()
self.assertEqual(self.camera.current_flash_mode, 'auto')
second_image_src = self.camera.current_image_src
# Take a photo
self.camera.take_photo()
self.camera.wait_for_picture_to_change(second_image_src)
# Check that Filmstrip is visible
self.assertTrue(self.camera.is_thumbnail_visible)
# Check that picture saved to SD card
self.wait_for_condition(lambda m: len(self.data_layer.picture_files) == self.previous_number_of_pictures + 3, 10)
self.assertEqual(len(self.data_layer.picture_files), self.previous_number_of_pictures + 3)

View file

@ -0,0 +1,54 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.camera.app import Camera
class TestCameraMultipleShots(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Turn off Geolocation prompt
self.apps.set_permission('Camera', 'geolocation', 'deny')
def test_capture_multiple_shots(self):
"""
https://moztrap.mozilla.org/manage/case/1325/
"""
self.previous_number_of_pictures = len(self.data_layer.picture_files)
self.camera = Camera(self.marionette)
self.camera.launch()
# Take a photo
self.camera.take_photo()
# Check that thumbnail is visible
self.assertTrue(self.camera.is_thumbnail_visible)
# Check that picture saved to SD card
self.wait_for_condition(lambda m: len(self.data_layer.picture_files) == self.previous_number_of_pictures + 1, 10)
self.assertEqual(len(self.data_layer.picture_files), self.previous_number_of_pictures + 1)
# Take a photo
self.camera.take_photo()
# Check that thumbnail is visible
self.assertTrue(self.camera.is_thumbnail_visible)
# Check that picture saved to SD card
self.wait_for_condition(lambda m: len(self.data_layer.picture_files) == self.previous_number_of_pictures + 2, 10)
self.assertEqual(len(self.data_layer.picture_files), self.previous_number_of_pictures + 2)
# Take a photo
self.camera.take_photo()
# Check that thumbnail is visible
self.assertTrue(self.camera.is_thumbnail_visible)
# Check that picture saved to SD card
self.wait_for_condition(lambda m: len(self.data_layer.picture_files) == self.previous_number_of_pictures + 3, 10)
self.assertEqual(len(self.data_layer.picture_files), self.previous_number_of_pictures + 3)

View file

@ -0,0 +1,3 @@
# 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/.

View file

@ -0,0 +1,19 @@
[parent:../manifest.ini]
[DEFAULT]
external = false
[test_clock_alarm_in_lockscreen.py]
dogfood = true
[test_clock_create_new_alarm.py]
skip-if = device == "desktop"
smoketest = true
[test_clock_set_alarm.py]
[test_clock_run_stopwatch_laps.py]
skip-if = device == "desktop"
dogfood = true
[test_clock_run_stopwatch_then_reset.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 gaiatest import PasscodeTestCase
from gaiatest.apps.lockscreen.app import LockScreen
from gaiatest.apps.clock.app import Clock
from gaiatest.apps.clock.regions.alarm_alert import AlarmAlertScreen
class TestClockAlarmInLockscreen(PasscodeTestCase):
_input_passcode = '1337'
def setUp(self):
PasscodeTestCase.setUp(self)
self.set_passcode_to_1337()
self.data_layer.set_setting('lockscreen.passcode-lock.enabled', True)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_clock_set_alarm_in_lockscreen(self):
""" Dismiss alarm in lockscreen
https://moztrap.mozilla.org/manage/cases/15805/
"""
alarm_label_text = 'Test Alarm'
# Set the time on the device so that it starts with 0 seconds
_seconds_since_epoch = self.marionette.execute_script("""
var today = new Date();
var yr = today.getFullYear();
var mth = today.getMonth();
var day = today.getDate();
return new Date(yr, mth, day, 1, 0, 0).getTime();""")
self.data_layer.set_time(_seconds_since_epoch)
alarm = self.clock.switch_view('alarm')
new_alarm = alarm.tap_new_alarm()
new_alarm.type_alarm_label(alarm_label_text)
time_picker = new_alarm.tap_time()
time_picker.add_minute()
time_picker.tap_done()
self.clock = new_alarm.tap_done()
self.clock.dismiss_banner()
self.assertTrue(alarm.alarm_items[0].is_alarm_active)
self.device.lock()
self.alarm_alert = AlarmAlertScreen(self.marionette)
self.alarm_alert.wait_for_alarm_to_trigger()
# Check that the alarm name is the one we set
self.assertEqual(self.alarm_alert.alarm_label, alarm_label_text)
self.alarm_alert.tap_stop_alarm()
self.assertTrue(self.device.is_locked)

View file

@ -0,0 +1,100 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.clock.app import Clock
from gaiatest.apps.clock.regions.alarm_alert import AlarmAlertScreen
from gaiatest.apps.homescreen.app import Homescreen
class TestClockCreateNewAlarm(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.clock = Clock(self.marionette)
self.clock.launch()
self.data_layer.set_setting('time.clock.automatic-update.enabled', False)
def test_clock_create_new_alarm(self):
""" Add an alarm and set label of the new alarm
https://moztrap.mozilla.org/manage/case/1772/
https://moztrap.mozilla.org/manage/case/1775/
"""
alarm_view = self.clock.switch_view("alarm")
_seconds_since_epoch = self.marionette.execute_script("""
var today = new Date();
var yr = today.getFullYear();
var mth = today.getMonth();
var day = today.getDate();
return new Date(yr, mth, day, 1, 0, 0).getTime();""")
alarm_label_text = "test4321"
initial_alarms_count = len(alarm_view.alarm_items)
# Set the time on the device
self.data_layer.set_time(_seconds_since_epoch)
# create a new alarm with the default values that are available
new_alarm = alarm_view.tap_new_alarm()
# Ensure label has the default placeholder and text
self.assertEquals(new_alarm.alarm_label_placeholder, 'Alarm name')
# set label
new_alarm.type_alarm_label(alarm_label_text)
alarm_view = new_alarm.tap_done()
# verify the banner-countdown message appears
alarm_msg = alarm_view.banner_notification
self.assertTrue('The alarm is set for' in alarm_msg, 'Actual banner message was: "' + alarm_msg + '"')
alarm_view.dismiss_banner()
# ensure the new alarm has been added and it is displayed
self.assertTrue(initial_alarms_count < len(alarm_view.alarm_items),
'Alarms count did not increment')
# verify the label of alarm
self.assertEqual(len(alarm_view.alarm_items), 1)
self.assertEqual(alarm_view.alarm_items[0].label, alarm_label_text)
alarm_time = alarm_view.alarm_items[0].time
# tap to Edit alarm
edit_alarm = alarm_view.alarm_items[0].tap()
# Set the alarm time to 1 min more than the current time
time_picker = edit_alarm.tap_time()
time_picker.add_minute()
time_picker.tap_done()
edit_alarm.tap_done()
alarm_view.dismiss_banner()
self.assertNotEqual(alarm_view.alarm_items[0].time, alarm_time)
# turn off the alarm
alarm_view.alarm_items[0].tap_checkbox()
alarm_view.alarm_items[0].wait_for_checkbox_to_change_state(False)
self.assertFalse(alarm_view.alarm_items[0].is_alarm_active, 'user should be able to turn on the alarm.')
# turn on the alarm
alarm_view.alarm_items[0].tap_checkbox()
alarm_view.alarm_items[0].wait_for_checkbox_to_change_state(True)
alarm_view.dismiss_banner()
self.assertTrue(alarm_view.alarm_items[0].is_alarm_active, 'user should be able to turn off the alarm.')
self.device.touch_home_button()
self.marionette.switch_to_frame()
self.alarm_alert = AlarmAlertScreen(self.marionette)
self.alarm_alert.wait_for_alarm_to_trigger()
# Check that the alarm name is the one we set
self.assertEqual(self.alarm_alert.alarm_label, alarm_label_text)
self.alarm_alert.tap_stop_alarm()
# Switch back to top level now that Clock app is gone
Homescreen(self.marionette).wait_to_be_displayed()

View file

@ -0,0 +1,49 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.clock.app import Clock
import time
class TestClockRunStopWatch(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_click_run_stopwatch_laps(self):
stopwatch_view = self.clock.switch_view("stopwatch")
self.assertEqual(stopwatch_view.current_time, '00:00.00')
stopwatch_view.tap_start()
time.sleep(0.2)
self.assertNotEqual(stopwatch_view.current_time, '00:00.00')
stopwatch_view.tap_lap()
time.sleep(0.2)
self.assertEqual(len(stopwatch_view.lap_items), 2)
self.assertNotEqual(stopwatch_view.lap_items[0].time, '00:00.00')
self.assertNotEqual(stopwatch_view.lap_items[1].time, '00:00.00')
self.assertNotEqual(stopwatch_view.lap_items[0].time, stopwatch_view.lap_items[1].time)
stopwatch_view.tap_pause()
recorded_time = stopwatch_view.current_time
stopwatch_view.tap_resume()
time.sleep(0.2)
self.assertNotEqual(stopwatch_view.current_time, recorded_time)
stopwatch_view.tap_pause()
stopwatch_view.tap_reset()
self.assertEqual(len(stopwatch_view.lap_items), 0)
self.assertEqual(stopwatch_view.current_time, '00:00.00')

View file

@ -0,0 +1,36 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.clock.app import Clock
import time
class TestClockRunStopWatch(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_click_run_stopwatch_then_reset(self):
stopwatch_view = self.clock.switch_view("stopwatch")
self.assertEqual(stopwatch_view.current_time, '00:00.00')
stopwatch_view.tap_start()
time.sleep(0.2)
self.assertNotEqual(stopwatch_view.current_time, '00:00.00')
stopwatch_view.tap_pause()
first_time = stopwatch_view.current_time
stopwatch_view.tap_resume()
time.sleep(0.2)
self.assertNotEqual(stopwatch_view.current_time, '00:00.00')
self.assertNotEqual(first_time, stopwatch_view.current_time)
stopwatch_view.tap_pause()
stopwatch_view.tap_reset()
self.assertEqual(stopwatch_view.current_time, '00:00.00')

View file

@ -0,0 +1,67 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.clock.app import Clock
class TestClockSetAlarm(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_clock_set_alarm(self):
# Added a view switching method to app.py for getting a Clock object.
alarm = self.clock.switch_view('alarm')
new_alarm = alarm.tap_new_alarm()
self.assertEquals(new_alarm.alarm_repeat, 'never')
# Set label
new_alarm.type_alarm_label("TestSetAlarmRepeat")
# Loop the options and select the ones in match list
for option in ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']:
new_alarm.select_repeat(option)
self.assertEqual(new_alarm.alarm_repeat, 'weekdays')
new_alarm.select_repeat('Sunday')
# In this locale, Sunday is the first day of the week; it appears first.
self.assertEqual(new_alarm.alarm_repeat, 'Sun, Mon, Tue, Wed, Thu, Fri')
new_alarm.select_repeat('Sunday')
self.assertEqual(new_alarm.alarm_repeat, 'weekdays')
# Ensure sound has the default value
self.assertEquals(new_alarm.alarm_sound, 'ac_awake_opus')
# Set sound
new_alarm.select_sound('Digicloud')
self.assertEqual(new_alarm.alarm_sound, 'ac_digicloud_opus')
# Ensure snooze has the default value
self.assertIn('10', new_alarm.alarm_snooze)
# Set snooze
new_alarm.select_snooze('15 minutes')
self.assertIn('15', new_alarm.alarm_snooze)
# Save the alarm
alarm_view = new_alarm.tap_done()
alarm_view.dismiss_banner()
# Tap to Edit alarm
edit_alarm = alarm_view.alarm_items[0].tap()
# Verify selected options
self.assertEqual(edit_alarm.alarm_repeat, 'weekdays')
self.assertEqual(new_alarm.alarm_sound, 'ac_digicloud_opus')
self.assertIn('15', new_alarm.alarm_snooze)
edit_alarm.tap_done()
alarm_view.dismiss_banner()

View file

@ -0,0 +1,60 @@
[parent:../manifest.ini]
[DEFAULT]
external = false
[test_add_new_contact.py]
smoketest = true
[test_call_contact.py]
skip-if = device == "desktop"
carrier = true
[test_edit_contact.py]
smoketest = true
[test_sms_contact.py]
skip-if = device == "desktop"
carrier = true
smoketest = true
[test_add_photo_to_contact.py]
sdcard = true
smoketest = true
[test_sort_contacts.py]
[test_delete_contact.py]
[test_add_contact_to_favorites.py]
[test_import_contacts_from_sim.py]
skip-if = device == "desktop"
carrier = true
[test_export_contacts_to_sdcard.py]
sdcard = true
[test_import_contacts_from_sdcard.py]
sdcard = true
[test_import_contacts_from_gmail.py]
external = true
online = true
[test_import_edit_export_contact.py]
external = true
carrier = true
skip-if = device == "desktop"
disabled = Bug 1196830 - Failure in test_import_edit_export_contact.py
[test_import_contacts_menu_no_network.py]
external = true
online = true
[test_import_gmail_no_network.py]
external = true
online = true
[test_add_and_call_ice_contact.py]
carrier = true

View file

@ -0,0 +1,45 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.contacts.app import Contacts
class TestAddAndCallIceContact(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact(tel={
'type': 'Mobile',
'value': "%s" % self.testvars['remote_phone_number']})
self.data_layer.insert_contact(self.contact)
def test_add_and_call_ice_contact(self):
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_app.wait_for_contacts()
contacts_settings = contacts_app.tap_settings()
ice_contact_menu = contacts_settings.tap_set_ice_contact()
ice_contact_select = ice_contact_menu.enable_set_ice_contact()
contacts_app = ice_contact_select.select_ice_contact()
contacts_app.wait_for_contacts(1)
contact_selected = contacts_app.contacts[0].tap(return_class='SetIceContacts')
settings = contact_selected.go_back()
contact_list = settings.tap_done()
self.assertTrue(contact_list.is_ice_list_icon_displayed)
self.assertEqual(len(contact_list.contacts), 1)
self.assertEqual(contact_list.contacts[0].full_name, (self.contact['givenName'] + ' ' + self.contact['familyName']))
ice_contact = contact_list.open_ice_contact_list()
ice_contact.wait_for_ice_contact_shown()
ice_contact_details = contacts_app.contact(self.contact['givenName']).tap()
call_screen = ice_contact_details.tap_phone_number()
call_screen.wait_for_outgoing_call()
call_screen.hang_up()

View file

@ -0,0 +1,32 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.contacts.app import Contacts
class TestAddContactToFavorite(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
self.data_layer.insert_contact(self.contact)
def test_add_contact_to_favorite(self):
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_app.wait_for_contacts()
contact_details = contacts_app.contact(self.contact['givenName']).tap()
contact_details.tap_add_remove_favorite()
self.assertEqual(contact_details.add_remove_text, 'Remove as Favorite')
contact_details.tap_back()
self.assertTrue(contacts_app.is_favorites_list_displayed)
# Test that the contact is displayed twice: once under Favorites and once under Contacts.
self.assertEqual(len(contacts_app.contacts), 2)
self.assertEqual(contacts_app.contacts[0].full_name, contacts_app.contacts[1].full_name)

View file

@ -0,0 +1,40 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.contacts.app import Contacts
class TestContacts(GaiaTestCase):
def test_add_new_contact(self):
"""
https://moztrap.mozilla.org/manage/case/1309/
"""
self.contact = MockContact()
contacts_app = Contacts(self.marionette)
contacts_app.launch()
new_contact_form = contacts_app.tap_new_contact()
# Enter data into fields
new_contact_form.type_given_name(self.contact['givenName'])
new_contact_form.type_family_name(self.contact['familyName'])
new_contact_form.type_phone(self.contact['tel']['value'])
new_contact_form.type_email(self.contact['email']['value'])
new_contact_form.type_street(self.contact['adr']['streetAddress'])
new_contact_form.type_zip_code(self.contact['adr']['postalCode'])
new_contact_form.type_city(self.contact['adr']['locality'])
new_contact_form.type_country(self.contact['adr']['countryName'])
new_contact_form.type_comment(self.contact['note'])
new_contact_form.tap_done()
self.wait_for_condition(lambda m: len(contacts_app.contacts) == 1)
self.assertEqual(contacts_app.contacts[0].name, self.contact['givenName'])

View file

@ -0,0 +1,64 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.contacts.app import Contacts
class TestContacts(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
self.data_layer.insert_contact(self.contact)
# add photo to storage
self.push_resource('IMG_0001.jpg')
def test_add_photo_from_gallery_to_contact(self):
"""
https://moztrap.mozilla.org/manage/case/1309/
"""
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_app.wait_for_contacts()
contact_details = contacts_app.contact(self.contact['givenName']).tap()
full_name = ' '.join([self.contact['givenName'], self.contact['familyName']])
self.assertEqual(full_name, contact_details.full_name)
saved_contact_image_style = contact_details.image_style
edit_contact = contact_details.tap_edit()
saved_picture_style = edit_contact.picture_style
activities_list = edit_contact.tap_picture()
# choose the source as gallery app
gallery = activities_list.tap_gallery()
gallery.wait_for_thumbnails_to_load()
self.assertGreater(gallery.gallery_items_number, 0, 'No photos were found in the gallery.')
image = gallery.tap_first_gallery_item()
image.tap_crop_done()
edit_contact.wait_for_image_to_load()
new_picture_style = edit_contact.picture_style
self.assertNotEqual(new_picture_style, saved_picture_style,
'The picture associated with the contact was not changed.')
contact_details = edit_contact.tap_update()
self.assertEqual(full_name, contact_details.full_name)
self.assertNotEqual(contact_details.image_style, saved_contact_image_style,
'The picture associated with the contact was not changed.')

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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.contacts.app import Contacts
class TestContacts(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Seed the contact with the remote phone number so we don't call random people
self.contact = MockContact(tel={
'type': 'Mobile',
'value': "%s" % self.testvars['remote_phone_number']})
self.data_layer.insert_contact(self.contact)
def test_call_contact(self):
"""NB This is not a listed smoke test
Call phone from a contact
https://moztrap.mozilla.org/manage/case/5679/
"""
contacts = Contacts(self.marionette)
contacts.launch()
contacts.wait_for_contacts()
# tap on the created contact
contact_details = contacts.contact(self.contact['givenName']).tap()
# tap the phone number and switch to call screen frame
call_screen = contact_details.tap_phone_number()
call_screen.wait_for_outgoing_call()
# Check the number displayed is the one we dialed
self.assertIn(self.contact['tel']['value'],
call_screen.calling_contact_information)
self.assertIn(self.contact['givenName'],
call_screen.outgoing_calling_contact)
call_screen.hang_up()
# Switch back to main frame before Marionette loses track bug #840931
self.marionette.switch_to_frame()
def tearDown(self):
# In case the assertion fails this will still kill the call
# An open call creates problems for future tests
self.data_layer.kill_active_call()
GaiaTestCase.tearDown(self)

View file

@ -0,0 +1,40 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.contacts.app import Contacts
class TestContacts(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# insert contact
self.contact = MockContact()
self.data_layer.insert_contact(self.contact)
def test_delete_contact(self):
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_app.wait_for_contacts()
pre_contacts_count = len(contacts_app.contacts)
self.assertEqual(pre_contacts_count, 1,
'Should insert one contact before running this test')
contact_item = contacts_app.contact(self.contact['givenName'])
contact_item_detail = contact_item.tap()
contact_item_edit = contact_item_detail.tap_edit()
contact_item_edit.tap_delete()
contact_item_edit.tap_confirm_delete()
self.wait_for_condition(
lambda m: len(self.data_layer.all_contacts) == 0,
message='Should have no contacts after running this test')
post_contacts_count = len(contacts_app.contacts)
self.assertEqual(post_contacts_count, 0,
'Should have no contacts after running this test')

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/.
import time
from gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.contacts.app import Contacts
class TestContacts(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
self.data_layer.insert_contact(self.contact)
def test_edit_contact(self):
"""
https://moztrap.mozilla.org/manage/case/1310/
"""
# First insert a new contact to edit
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_app.wait_for_contacts()
contact_details = contacts_app.contact(self.contact['givenName']).tap()
edit_contact = contact_details.tap_edit()
# Now we'll update the mock contact and then insert the new values into the UI
self.contact['givenName'] = 'gaia%s' % repr(time.time()).replace('.', '')[10:]
self.contact['familyName'] = "testedit"
self.contact['tel']['value'] = "02011111111"
edit_contact.type_given_name(self.contact['givenName'])
edit_contact.type_family_name(self.contact['familyName'])
edit_contact.type_phone(self.contact['tel']['value'])
contact_details = edit_contact.tap_update()
contact_details.tap_back()
self.assertEqual(len(contacts_app.contacts), 1)
self.assertEqual(contacts_app.contacts[0].name, self.contact['givenName'])
contact_details = contacts_app.contact(self.contact['givenName']).tap()
# Now assert that the values have updated
full_name = self.contact['givenName'] + " " + self.contact['familyName']
self.assertEqual(contact_details.full_name,
full_name)
self.assertEqual(contact_details.phone_number,
self.contact['tel']['value'])

View file

@ -0,0 +1,36 @@
from gaiatest import GaiaTestCase
from gaiatest.apps.contacts.app import Contacts
from gaiatest.mocks.mock_contact import MockContact
class TestExportContactsToSDCard(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# insert contact
self.contact = MockContact()
self.data_layer.insert_contact(self.contact)
# remove vcf files from sdcard
for file in self.data_layer.sdcard_files('.vcf'):
self.device.file_manager.remove(file.name)
def test_export_contacts_to_sdcard(self):
""" Export contacts to an SD card """
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_app.wait_for_contacts()
contacts_settings = contacts_app.tap_settings()
contacts_settings.tap_export_contacts()
contacts_settings.tap_export_to_sd()
contacts_app.tap_select_all()
contacts_app.tap_export()
self.assertIn('1/1 contacts exported', contacts_app.status_message)
vcf_files = self.data_layer.sdcard_files('.vcf')
self.assertEqual(1, len(vcf_files))

View file

@ -0,0 +1,49 @@
# 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 marionette import SkipTest
from gaiatest import GaiaTestCase
from gaiatest import GaiaTestEnvironment
from gaiatest.apps.contacts.app import Contacts
class TestImportContactsFromGmail(GaiaTestCase):
def setUp(self):
if not GaiaTestEnvironment(self.testvars).email.get('gmail'):
raise SkipTest('Gmail account details not present in test variables.')
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
def test_import_contacts_from_gmail(self):
email = self.environment.email['gmail']['email']
password = self.environment.email['gmail']['password']
contacts_app = Contacts(self.marionette)
contacts_app.launch()
# Go on Contacts Settings page
contacts_settings = contacts_app.tap_settings()
# Tap Import Contacts
contacts_settings.tap_import_contacts()
# Check there are no gmail contacts imported
self.assertEqual(contacts_settings.gmail_imported_contacts, u'Not imported')
gmail = contacts_settings.tap_import_from_gmail()
# Login to gmail account
gmail.switch_to_gmail_login_frame()
gmail.gmail_login(email, password)
contact_import_picker = gmail.tap_grant_access()
# Import all contacts
contact_import_picker.tap_select_all()
contacts_settings = contact_import_picker.tap_import_button()
contacts_settings.tap_back_from_import_contacts()
contacts_settings.tap_done()
self.assertGreater(len(contacts_app.contacts), 1)

View file

@ -0,0 +1,34 @@
from gaiatest import GaiaTestCase
from gaiatest.apps.contacts.app import Contacts
class TestImportContactsFromSDCard(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# remove existing vcf files from sdcard
for file in self.data_layer.sdcard_files('.vcf'):
self.device.file_manager.remove(file.name)
# add .vcf file to SD card
self.push_resource('gaia061281_test.vcf')
def test_import_contacts_from_sdcard(self):
""" Insert a .vcf file to SD card(containing a contact) and import the contact
https://bugzilla.mozilla.org/show_bug.cgi?id=927348 - Write a test to import from VCF file on SD card
"""
contacts_app = Contacts(self.marionette)
contacts_app.launch()
# import contacts from SIM
contacts_settings = contacts_app.tap_settings()
contacts_settings.tap_import_contacts()
contacts_settings.tap_import_from_sdcard()
contacts_settings.tap_back_from_import_contacts()
contacts_settings.tap_done()
# check that the contact name matches the expected, one from the .vcf file
self.assertEqual(contacts_app.contacts[0].full_name, 'gaia061281 test')

View file

@ -0,0 +1,34 @@
from gaiatest import GaiaTestCase
from gaiatest.apps.contacts.app import Contacts
from gaiatest.mocks.mock_contact import MockContact
class TestImportContactsFromSIM(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
if len(self.data_layer.sim_contacts) == 0:
contact = MockContact()
self.data_layer.insert_sim_contact(contact)
def test_import_contacts_from_SIM(self):
""" Insert a new prepaid SIM card (some contacts) in device and import the contacts
https://moztrap.mozilla.org/manage/case/5880/
"""
contacts_app = Contacts(self.marionette)
contacts_app.launch()
# import contacts from SIM
contacts_settings = contacts_app.tap_settings()
contacts_settings.tap_import_contacts()
contacts_settings.tap_import_from_sim()
contacts_settings.tap_back_from_import_contacts()
contacts_settings.tap_done()
# all the contacts in the SIM should be imported
self.assertEqual(len(contacts_app.contacts), len(self.data_layer.sim_contacts))

View file

@ -0,0 +1,45 @@
# -*- coding: iso-8859-15 -*-
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.contacts.app import Contacts
class TestImportContactsMenuNoNetwork(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
def test_import_contacts_menu_no_network(self):
'''
https://moztrap.mozilla.org/manage/case/15183/
'''
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_settings = contacts_app.tap_settings()
contacts_settings.tap_import_contacts()
self.assertFalse(contacts_settings.is_gmail_import_service_in_error)
self.assertTrue(contacts_settings.is_gmail_import_enabled)
self.assertFalse(contacts_settings.is_outlook_import_service_in_error)
self.assertTrue(contacts_settings.is_outlook_import_enabled)
self.assertFalse(contacts_settings.is_error_message_displayed)
self.disable_all_network_connections()
self.apps.switch_to_displayed_app()
self.assertTrue(contacts_settings.is_gmail_import_service_in_error)
self.assertFalse(contacts_settings.is_gmail_import_enabled)
self.assertTrue(contacts_settings.is_outlook_import_service_in_error)
self.assertFalse(contacts_settings.is_outlook_import_enabled)
self.assertTrue(contacts_settings.is_error_message_displayed)

View file

@ -0,0 +1,75 @@
import time
from gaiatest import GaiaTestCase
from gaiatest.apps.contacts.app import Contacts
from gaiatest.mocks.mock_contact import MockContact
class TestImportEditExportContact(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
curr_time = repr(time.time()).replace('.', '')
self.contact = MockContact(familyName='')
self.sim_contact = self.data_layer.insert_sim_contact(self.contact)
def test_import_edit_export_contact(self):
"""
https://moztrap.mozilla.org/manage/case/14115/
"""
contacts_app = Contacts(self.marionette)
contacts_app.launch()
sim_contacts_number_before_import = len(self.data_layer.sim_contacts)
self.apps.switch_to_displayed_app()
# import contacts from SIM
contacts_settings = contacts_app.tap_settings()
contacts_settings.tap_import_contacts()
contacts_settings.tap_import_from_sim()
contacts_settings.tap_back_from_import_contacts()
contacts_settings.tap_done()
contact_first_name = self.sim_contact['name'][0].split()[0]
contact_details = contacts_app.contact(contact_first_name).tap()
edit_contact = contact_details.tap_edit()
contact_new_family_name = 'New'
edit_contact.type_family_name(contact_new_family_name)
contact_details = edit_contact.tap_update()
contact_details.tap_back()
contacts_settings = contacts_app.tap_settings()
contacts_settings.tap_export_contacts()
contacts_settings.tap_export_to_sim()
contacts_app.contact(contact_first_name).tap(return_class='SelectContact')
contacts_app.tap_export()
self.assertIn('contacts exported', contacts_app.status_message)
sim_contacts = self.data_layer.sim_contacts
self.assertEqual(len(sim_contacts), sim_contacts_number_before_import)
for contact in sim_contacts:
if contact['tel'][0]['value'] == self.sim_contact['tel'][0]['value']:
self.sim_contact = contact
break
self.assertEqual(self.sim_contact['name'][0], '%s %s' % (contact_first_name, contact_new_family_name))
self.assertEqual(self.sim_contact['tel'][0]['value'], self.contact.tel['value'])
def tearDown(self):
for contact in self.data_layer.sim_contacts:
if contact['name'][0].startswith(self.contact['name'].split()[0]):
self.data_layer.delete_sim_contact(contact['id'])
GaiaTestCase.tearDown(self)

View file

@ -0,0 +1,55 @@
# -*- coding: iso-8859-15 -*-
# 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 marionette import SkipTest
from gaiatest import GaiaTestCase
from gaiatest import GaiaTestEnvironment
from gaiatest.apps.contacts.app import Contacts
from gaiatest.apps.contacts.regions.settings_form import ConfirmationView
class TestImportGMailNoNetwork(GaiaTestCase):
def setUp(self):
if not GaiaTestEnvironment(self.testvars).email.get('gmail'):
raise SkipTest('Gmail account details not present in test variables.')
GaiaTestCase.setUp(self)
self.connect_to_local_area_network()
def test_import_gmail_no_network(self):
'''
https://moztrap.mozilla.org/manage/case/8986/
'''
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_settings = contacts_app.tap_settings()
contacts_settings.tap_import_contacts()
self.assertEqual(contacts_settings.gmail_imported_contacts, u'Not imported')
gmail = contacts_settings.tap_import_from_gmail()
# Login to gmail account
gmail.switch_to_gmail_login_frame()
email = self.environment.email['gmail']['email']
password = self.environment.email['gmail']['password']
gmail.gmail_login(email, password)
contact_import_picker = gmail.tap_grant_access()
# Import all contacts
contact_import_picker.tap_select_all()
contact_import_picker.tap_import_button(wait_for_import=False)
self.disable_all_network_connections()
self.apps.switch_to_displayed_app()
confirmation_view = ConfirmationView(self.marionette)
self.assertEqual(confirmation_view.error_message,
u'Friends\u2019 photos will not be added to your contacts. Continue anyway?')

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/.
import time
from marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.contacts.app import Contacts
from gaiatest.mocks.mock_contact import MockContact
class TestContacts(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact(tel={
'value': self.environment.phone_numbers[0]})
self.data_layer.insert_contact(self.contact)
def test_sms_contact(self):
"""
https://moztrap.mozilla.org/manage/case/1314/
"""
# Setup a text message from a contact.
text_message_content = "Automated Test %s" % str(time.time())
contacts = Contacts(self.marionette)
contacts.launch()
contacts.wait_for_contacts()
# Tap on the created contact.
contact_details = contacts.contact(self.contact['givenName']).tap()
new_message = contact_details.tap_send_sms()
new_message.wait_for_recipients_displayed()
expected_name = self.contact['givenName'] + " " + self.contact['familyName']
expected_tel = self.contact['tel']['value']
# Now check the first listed is from contacts app.
# Name and phone number have been passed in correctly.
self.assertEqual(new_message.first_recipient_name, expected_name)
self.assertEqual(new_message.first_recipient_number_attribute, expected_tel)
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: new_message.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
new_message.type_message(text_message_content)
message_thread = new_message.tap_send()
message_thread.wait_for_received_messages()
# Get the most recent received text message
last_received_message = message_thread.received_messages[-1]
# Check the most recent received message has the same text content
self.assertEqual(text_message_content, last_received_message.text)

View file

@ -0,0 +1,48 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.mocks.mock_contact import MockContact
from gaiatest.apps.contacts.app import Contacts
class TestContacts(GaiaTestCase):
_contacts_name_list = [('GG', 'E'), ('AA', 'Z'), ('XX', 'C'), ('CC', 'X'), ('EE', 'G'), ('FF', 'F'), ('HH', 'D'), ('BB', 'Y'), ('YY', 'B'), ('ZZ', 'A'), ('DD', 'H')]
def setUp(self):
GaiaTestCase.setUp(self)
for contact_name in self._contacts_name_list:
contact = MockContact(givenName=contact_name[0], familyName=contact_name[1])
self.data_layer.insert_contact(contact)
# prepare the sorted-by-first-name and sorted-by-last-name lists
self.sorted_contacts_name_by_first = sorted(self._contacts_name_list, key=lambda name: name[0])
self.sorted_contacts_name_by_last = sorted(self._contacts_name_list, key=lambda name: name[1])
def test_sort_contacts(self):
contacts_app = Contacts(self.marionette)
contacts_app.launch()
contacts_app.wait_for_contacts(number_to_wait_for=len(self._contacts_name_list))
# sort by first name, compare with sorted-by-first-name list
contact_items = contacts_app.contacts
for idx in range(len(self._contacts_name_list)):
name_tuple = self.sorted_contacts_name_by_first[idx]
self.assertEqual(contact_items[idx].full_name, name_tuple[0] + " " + name_tuple[1], "Should order by first name.")
contacts_settings = contacts_app.tap_settings()
contacts_settings.enable_order_by_last_name()
contacts_settings.tap_done()
contacts_app.wait_for_contacts(number_to_wait_for=len(self._contacts_name_list))
contact_items = contacts_app.contacts
for idx in range(len(self._contacts_name_list)):
name_tuple = self.sorted_contacts_name_by_last[idx]
self.assertEqual(contact_items[idx].full_name, name_tuple[0] + " " + name_tuple[1], "Should order by last name.")
contacts_settings = contacts_app.tap_settings()
contacts_settings.disable_order_by_last_name()
contacts_settings.tap_done()

View file

@ -0,0 +1,20 @@
[parent:../manifest.ini]
[DEFAULT]
carrier = true
online = true
wifi = true
[test_cost_control_ftu.py]
skip-if = device == "desktop"
external = false
online = false
wifi = false
[test_cost_control_data_alert_mobile.py]
skip-if = device == "desktop"
smoketest = true
wifi = false
[test_cost_control_reset_wifi.py]
skip-if = device == "desktop"

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 marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.search.app import Search
from gaiatest.apps.cost_control.app import CostControl
from gaiatest.apps.system.app import System
class TestCostControlDataAlertMobile(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.data_layer.set_bool_pref('privacy.trackingprotection.enabled', False)
self.data_layer.disable_wifi()
self.data_layer.connect_to_cell_data()
def test_cost_control_data_alert_mobile(self):
"""https://moztrap.mozilla.org/manage/case/8938/"""
cost_control = CostControl(self.marionette)
cost_control.launch()
cost_control.switch_to_ftu()
cost_control.run_ftu_accepting_defaults()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
self.assertFalse(cost_control.is_wifi_data_tracking_on)
settings = cost_control.tap_settings()
settings.enable_data_alert_switch()
settings.reset_mobile_usage()
settings.select_when_use_is_above_unit_and_value(u'MB', '0.1')
settings.tap_done()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
# open browser to get some data downloaded
search = Search(self.marionette)
search.launch(launch_timeout=30000)
search.go_to_url('http://mozqa.com/qa-testcase-data/Images/sample_png_02.png')
system = System(self.marionette)
# We could have waited on the page to be loaded, but the toaster can appear before
# the end of the load. That's why the timeout is expanded, the webpage loaded just above
# might take longer.
system.wait_for_notification_toaster_displayed(timeout=180)
system.wait_for_notification_toaster_not_displayed()
utility_tray = system.open_utility_tray()
cost_control_widget = utility_tray.cost_control_widget
cost_control_widget.wait_for_limit_to_be_reached()
cost_control_widget.tap()
cost_control.wait_to_be_displayed()
def tearDown(self):
self.marionette.switch_to_frame()
self.data_layer.disable_cell_data()
self.data_layer.clear_user_pref('privacy.trackingprotection.enabled')
GaiaTestCase.tearDown(self)

View file

@ -0,0 +1,32 @@
# 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 gaiatest import GaiaTestCase
from gaiatest.apps.cost_control.app import CostControl
class TestCostControlFTU(GaiaTestCase):
def test_cost_control_ftu(self):
cost_control = CostControl(self.marionette)
cost_control.launch()
# This will switch to ftu iframe
cost_control.switch_to_ftu()
from gaiatest.apps.cost_control.regions.ftu_step1 import FTUStep1
ftu_step1 = FTUStep1(self.marionette)
ftu_step2 = ftu_step1.tap_next()
ftu_step2.select_reset_report_value('Weekly')
ftu_step3 = ftu_step2.tap_next()
ftu_step3.enable_data_alert()
ftu_step3.select_when_use_is_above_unit_and_value(u'MB', '0.1')
ftu_step3.tap_lets_go()
self.apps.switch_to_displayed_app()
self.wait_for_condition(
lambda m: cost_control.is_mobile_data_tracking_on)

View file

@ -0,0 +1,53 @@
# 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/.
import time
from gaiatest import GaiaTestCase
from gaiatest.apps.cost_control.app import CostControl
from gaiatest.apps.search.app import Search
class TestCostControlReset(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
def test_cost_control_reset_wifi(self):
self.data_layer.connect_to_wifi()
cost_control = CostControl(self.marionette)
cost_control.launch()
cost_control.switch_to_ftu()
cost_control.run_ftu_accepting_defaults()
cost_control.disable_mobile_data_tracking()
cost_control.enable_wifi_data_tracking()
# If we don't kill the app manually it might get killed by the oom process.
# In that case when we re-launch the app it has a hash attached at the end of the src. - Bug 1091676
self.apps.kill(cost_control.app)
# open browser to get some data downloaded
search = Search(self.marionette)
search.launch()
search.go_to_url(self.marionette.absolute_url('mozilla.html'))
self.data_layer.disable_wifi()
time.sleep(5)
cost_control.launch()
# if we can't trigger any data usage, there must be something wrong
self.assertNotEqual(cost_control.wifi_data_usage_figure, u'0.00 B', 'No data usage shown after browsing.')
settings = cost_control.tap_settings()
settings.reset_wifi_usage()
settings.tap_done()
# wait for usage to be refreshed
self.wait_for_condition(
lambda m: cost_control.wifi_data_usage_figure == u'0.00 B',
message='Wifi usage did not reset back to 0.00 B')

Some files were not shown because too many files have changed in this diff Show more