This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
test_browser_bookmark.py
47 lines (33 loc) · 1.67 KB
/
test_browser_bookmark.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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/.
import time
from gaiatest import GaiaTestCase
from gaiatest.apps.homescreen.app import Homescreen
from gaiatest.apps.search.app import Search
class TestBrowserBookmark(GaiaTestCase):
_bookmark_added = False
def setUp(self):
GaiaTestCase.setUp(self)
self.connect_to_network()
self.apps.set_permission('Browser', 'geolocation', 'deny')
if self.device.is_desktop_b2g or self.data_layer.is_wifi_connected():
self.test_url = self.marionette.absolute_url('mozilla.html')
else:
self.test_url = 'http://mozqa.com/data/firefox/layout/mozilla.html'
curr_time = repr(time.time()).replace('.', '')
self.bookmark_title = 'gaia%s' % curr_time[10:]
def test_browser_bookmark(self):
search = Search(self.marionette)
search.launch()
browser = search.go_to_url(self.test_url)
browser.tap_menu_button()
bookmark = browser.tap_add_to_home()
bookmark.type_bookmark_title(self.bookmark_title)
bookmark.tap_add_bookmark_to_home_screen_dialog_button()
# Switch to Home Screen to look for bookmark
self.device.touch_home_button()
homescreen = Homescreen(self.marionette)
homescreen.wait_for_app_icon_present(self.bookmark_title)
self._bookmark_added = homescreen.is_app_installed(self.bookmark_title)
self.assertTrue(self._bookmark_added, 'The bookmark %s was not found to be installed on the home screen.' % self.bookmark_title)