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:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/__init__.py
Executable file
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/__init__.py
Executable file
37
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/app.py
Executable file
37
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/app.py
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
# 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.apps.base import Base
|
||||
|
||||
|
||||
class Clock(Base):
|
||||
name = 'Clock'
|
||||
_visible_clock_locator = (By.CSS_SELECTOR, '#clock-view .visible')
|
||||
_clock_views = {"stopwatch": "stopwatch-tab", "alarm": "alarm-tab", "timer": "timer-tab"}
|
||||
|
||||
def launch(self):
|
||||
Base.launch(self)
|
||||
Wait(self.marionette).until(expected.element_displayed(
|
||||
Wait(self.marionette).until(expected.element_present(
|
||||
*self._visible_clock_locator))))
|
||||
|
||||
def switch_view(self, view_name):
|
||||
Wait(self.marionette).until(
|
||||
expected.element_present(*(By.ID, self._clock_views.get(view_name)))).tap()
|
||||
if view_name == 'stopwatch':
|
||||
from gaiatest.apps.clock.regions.stopwatch import StopWatch
|
||||
return StopWatch(self.marionette)
|
||||
elif view_name == 'timer':
|
||||
from gaiatest.apps.clock.regions.timer import Timer
|
||||
return Timer(self.marionette)
|
||||
elif view_name == 'alarm':
|
||||
from gaiatest.apps.clock.regions.alarm import Alarm
|
||||
return Alarm(self.marionette)
|
||||
else:
|
||||
raise AttributeError('{} is not a view that you can switch to'.format(view_name))
|
||||
|
||||
|
||||
|
||||
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/__init__.py
Executable file
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/__init__.py
Executable file
82
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/alarm.py
Executable file
82
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/alarm.py
Executable file
|
|
@ -0,0 +1,82 @@
|
|||
# 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.apps.base import PageRegion
|
||||
|
||||
|
||||
class Alarm(PageRegion):
|
||||
_alarm_create_new_locator = (By.ID, 'alarm-new')
|
||||
_alarm_view_locator = (By.ID, 'alarm-tab')
|
||||
_edit_alarm_view_locator = (By.ID, 'edit-alarm')
|
||||
_all_alarm_items_locator = (By.CSS_SELECTOR, '#alarms li')
|
||||
_banner_countdown_notification_locator = (By.ID, 'banner-countdown')
|
||||
_visible_clock_locator = (By.CSS_SELECTOR, '#clock-view .visible')
|
||||
|
||||
def __init__(self, marionette):
|
||||
PageRegion.__init__(self, marionette,self._alarm_view_locator)
|
||||
view = self.marionette.find_element(*self._alarm_view_locator)
|
||||
Wait(self.marionette).until(lambda m: view.location['x'] == 0 and view.is_displayed())
|
||||
Wait(self.marionette).until(expected.element_displayed(
|
||||
Wait(self.marionette).until(expected.element_present(
|
||||
*self._alarm_create_new_locator))))
|
||||
|
||||
@property
|
||||
def alarm_items(self):
|
||||
return [self.AlarmItem(self.marionette, alarm_item) for alarm_item in
|
||||
self.marionette.find_elements(*self._all_alarm_items_locator)]
|
||||
|
||||
def tap_new_alarm(self):
|
||||
new_alarm = Wait(self.marionette).until(
|
||||
expected.element_present(*self._alarm_create_new_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(new_alarm))
|
||||
new_alarm.tap()
|
||||
from gaiatest.apps.clock.regions.new_alarm import NewAlarm
|
||||
return NewAlarm(self.marionette)
|
||||
|
||||
@property
|
||||
def banner_notification(self):
|
||||
banner = Wait(self.marionette).until(
|
||||
expected.element_present(*self._banner_countdown_notification_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(banner))
|
||||
return banner.text
|
||||
|
||||
def dismiss_banner(self):
|
||||
banner = Wait(self.marionette).until(
|
||||
expected.element_present(*self._banner_countdown_notification_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(banner))
|
||||
# We can't tap to clear the banner as sometimes it taps the underlying alarm changing the UI
|
||||
Wait(self.marionette).until(expected.element_not_displayed(banner))
|
||||
|
||||
class AlarmItem(PageRegion):
|
||||
|
||||
_label_locator = (By.CSS_SELECTOR, '.label')
|
||||
_check_box_locator = (By.CSS_SELECTOR, '.input-enable')
|
||||
_enable_button_locator = (By.CSS_SELECTOR, '.alarmList.alarmEnable')
|
||||
_time_locator = (By.CSS_SELECTOR, '.time')
|
||||
|
||||
@property
|
||||
def time(self):
|
||||
return self.root_element.find_element(*self._time_locator).text
|
||||
|
||||
@property
|
||||
def label(self):
|
||||
return self.root_element.find_element(*self._label_locator).text
|
||||
|
||||
@property
|
||||
def is_alarm_active(self):
|
||||
return self.root_element.find_element(*self._check_box_locator).is_selected()
|
||||
|
||||
def tap_checkbox(self):
|
||||
self.root_element.find_element(*self._enable_button_locator).tap()
|
||||
|
||||
def wait_for_checkbox_to_change_state(self, value):
|
||||
checkbox = self.marionette.find_element(*self._check_box_locator)
|
||||
Wait(self.marionette).until(lambda m: checkbox.is_selected() == value)
|
||||
|
||||
def tap(self):
|
||||
self.root_element.tap()
|
||||
from gaiatest.apps.clock.regions.new_alarm import EditAlarm
|
||||
return EditAlarm(self.marionette)
|
||||
32
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/alarm_alert.py
Executable file
32
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/alarm_alert.py
Executable 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 marionette_driver import expected, By, Wait
|
||||
|
||||
from gaiatest.apps.base import Base
|
||||
|
||||
|
||||
class AlarmAlertScreen(Base):
|
||||
_alarm_frame_locator = (By.CSS_SELECTOR, 'iframe[mozapp*="clock"]:nth-child(1)')
|
||||
_stop_button_locator = (By.ID, 'ring-button-stop')
|
||||
_alarm_label_locator = (By.ID, 'ring-label')
|
||||
|
||||
def wait_for_alarm_to_trigger(self):
|
||||
alarm_frame = Wait(self.marionette, timeout=60, interval=5).until(
|
||||
expected.element_present(*self._alarm_frame_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(alarm_frame))
|
||||
self.marionette.switch_to_frame(alarm_frame)
|
||||
|
||||
def tap_stop_alarm(self):
|
||||
stop_alarm_button = Wait(self.marionette).until(
|
||||
expected.element_present(*self._stop_button_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(stop_alarm_button))
|
||||
self.tap_element_from_system_app(stop_alarm_button)
|
||||
|
||||
@property
|
||||
def alarm_label(self):
|
||||
alarm_label = Wait(self.marionette).until(
|
||||
expected.element_present(*self._alarm_label_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(alarm_label))
|
||||
return alarm_label.text
|
||||
77
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/new_alarm.py
Executable file
77
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/new_alarm.py
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
# 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 expected, By, Wait
|
||||
|
||||
from gaiatest.apps.clock.app import Clock
|
||||
|
||||
|
||||
class NewAlarm(Clock):
|
||||
|
||||
_alarm_name_locator = (By.ID, 'alarm-name')
|
||||
_new_alarm_view_locator = (By.CSS_SELECTOR, 'section[data-panel-id="alarm_edit"]')
|
||||
_repeat_menu_locator = (By.ID, 'repeat-menu')
|
||||
_sound_menu_locator = (By.ID, 'sound-menu')
|
||||
_snooze_menu_locator = (By.ID, 'snooze-menu')
|
||||
_done_locator = (By.ID, 'alarm-done')
|
||||
_time_button_locator = (By.XPATH, "//li[input[@id='time-select']]")
|
||||
|
||||
def __init__(self, marionette):
|
||||
Clock.__init__(self, marionette)
|
||||
view = self.marionette.find_element(*self._new_alarm_view_locator)
|
||||
Wait(self.marionette).until(lambda m: view.location['x'] == 0 and view.is_displayed())
|
||||
# Bug 1032852 This is to bust intermittents caused by this bug that causes keyboard not to appear upon tap
|
||||
time.sleep(1.5)
|
||||
|
||||
def type_alarm_label(self, value):
|
||||
self.marionette.find_element(*self._alarm_name_locator).tap()
|
||||
self.keyboard.send(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
@property
|
||||
def alarm_label_placeholder(self):
|
||||
return self.marionette.find_element(*self._alarm_name_locator).get_attribute('placeholder')
|
||||
|
||||
@property
|
||||
def alarm_repeat(self):
|
||||
repeat = self.marionette.find_element(*self._repeat_menu_locator).get_attribute('data-l10n-id')
|
||||
return repeat if repeat is not None else self.marionette.find_element(*self._repeat_menu_locator).text
|
||||
|
||||
def select_repeat(self, value):
|
||||
self.marionette.find_element(*self._repeat_menu_locator).tap()
|
||||
self.select(value)
|
||||
|
||||
@property
|
||||
def alarm_snooze(self):
|
||||
return self.marionette.find_element(*self._snooze_menu_locator).get_attribute('data-l10n-args')
|
||||
|
||||
def select_snooze(self, value):
|
||||
self.marionette.find_element(*self._snooze_menu_locator).tap()
|
||||
self.select(value)
|
||||
|
||||
@property
|
||||
def alarm_sound(self):
|
||||
return self.marionette.find_element(*self._sound_menu_locator).get_attribute('data-l10n-id')
|
||||
|
||||
def select_sound(self, value):
|
||||
self.marionette.find_element(*self._sound_menu_locator).tap()
|
||||
self.select(value)
|
||||
|
||||
def tap_done(self):
|
||||
done = Wait(self.marionette).until(expected.element_present(*self._done_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(done))
|
||||
done.tap()
|
||||
from gaiatest.apps.clock.regions.alarm import Alarm
|
||||
return Alarm(self.marionette)
|
||||
|
||||
def tap_time(self):
|
||||
self.marionette.find_element(*self._time_button_locator).tap()
|
||||
from gaiatest.apps.system.regions.time_picker import TimePicker
|
||||
return TimePicker(self.marionette)
|
||||
|
||||
|
||||
class EditAlarm(NewAlarm):
|
||||
pass
|
||||
58
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/stopwatch.py
Executable file
58
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/stopwatch.py
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
# 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.apps.base import PageRegion
|
||||
|
||||
class StopWatch(PageRegion):
|
||||
_stopwatch_view_locator = (By.ID,'stopwatch-panel')
|
||||
_stopwatch_time_locator = (By.CSS_SELECTOR, ".stopwatch-time")
|
||||
_stopwatch_start_locator = (By.CSS_SELECTOR, '#stopwatch-controls .stopwatch-start')
|
||||
_stopwatch_pause_locator = (By.CSS_SELECTOR, '#stopwatch-controls .stopwatch-pause')
|
||||
_stopwatch_reset_locator = (By.CSS_SELECTOR, '#stopwatch-controls .stopwatch-reset')
|
||||
_stopwatch_resume_locator = (By.CSS_SELECTOR, '#stopwatch-controls .stopwatch-resume')
|
||||
_stopwatch_lap_locator = (By.CSS_SELECTOR, '#stopwatch-controls .stopwatch-lap')
|
||||
_all_laps_locator = (By.CSS_SELECTOR, '.stopwatch-laps li')
|
||||
|
||||
def __init__(self, marionette):
|
||||
PageRegion.__init__(self, marionette, self._stopwatch_view_locator)
|
||||
view = self.marionette.find_element(*self._stopwatch_view_locator)
|
||||
Wait(self.marionette).until(lambda m: view.location['x'] == 0 and view.is_displayed())
|
||||
|
||||
@property
|
||||
def current_time(self):
|
||||
current_time = Wait(self.marionette).until(expected.element_present(*self._stopwatch_time_locator))
|
||||
return current_time.text
|
||||
|
||||
@property
|
||||
def lap_items(self):
|
||||
return [self.LapItem(self.marionette, lap) for lap in self.marionette.find_elements(*self._all_laps_locator)]
|
||||
|
||||
def tap_start(self):
|
||||
Wait(self.marionette).until(expected.element_present(*self._stopwatch_start_locator)).tap()
|
||||
|
||||
def tap_pause(self):
|
||||
Wait(self.marionette).until(expected.element_present(*self._stopwatch_pause_locator)).tap()
|
||||
|
||||
def tap_reset(self):
|
||||
Wait(self.marionette).until(expected.element_present(*self._stopwatch_reset_locator)).tap()
|
||||
|
||||
def tap_resume(self):
|
||||
Wait(self.marionette).until(expected.element_present(*self._stopwatch_resume_locator)).tap()
|
||||
|
||||
def tap_lap(self):
|
||||
Wait(self.marionette).until(expected.element_present(*self._stopwatch_lap_locator)).tap()
|
||||
|
||||
class LapItem(PageRegion):
|
||||
_lap_name = (By.CSS_SELECTOR, '.lap-name')
|
||||
_lap_time = (By.CSS_SELECTOR, '.lap-duration')
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.root_element.find_element(*self._lap_name).text
|
||||
|
||||
@property
|
||||
def time(self):
|
||||
return self.root_element.find_element(*self._lap_time).text
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# 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/.
|
||||
|
||||
|
||||
16
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/timer.py
Executable file
16
gaia/tests/python/gaia-ui-tests/gaiatest/apps/clock/regions/timer.py
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from marionette_driver import By, Wait
|
||||
|
||||
from gaiatest.apps.base import PageRegion
|
||||
|
||||
|
||||
class Timer(PageRegion):
|
||||
_timer_view_locator = (By.ID, 'timer-panel')
|
||||
|
||||
def __init__(self, marionette):
|
||||
PageRegion.__init__(self, marionette, self._timer_view_locator)
|
||||
view = self.marionette.find_element(*self._timer_view_locator)
|
||||
Wait(self.marionette).until(lambda m: view.location['x'] == 0 and view.is_displayed())
|
||||
Loading…
Reference in a new issue