Skip to content

Commit ee1e276

Browse files
committed
firefox home launch for now
1 parent 8600804 commit ee1e276

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

modules/browser_object_tabbar.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ def new_tab_by_keys(self, sys_platform: str) -> BasePage:
5353
).perform()
5454
return self
5555

56+
def new_window_by_keys(self, sys_platform: str) -> BasePage:
57+
"""Use keyboard shortcut to open a new tab"""
58+
if sys_platform == "Darwin":
59+
self.actions.key_down(Keys.COMMAND).send_keys("n").key_up(
60+
Keys.COMMAND
61+
).perform()
62+
else:
63+
self.actions.key_down(Keys.CONTROL).send_keys("n").key_up(
64+
Keys.CONTROL
65+
).perform()
66+
return self
67+
5668
def click_tab_by_title(self, title: str) -> BasePage:
5769
"""Given a full page title, click the corresponding tab"""
5870
with self.driver.context(self.driver.CONTEXT_CHROME):

modules/data/about_prefs.components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@
216216
"groups": []
217217
},
218218

219+
"home-new-window-dropdown": {
220+
"selectorData": "homeMode",
221+
"strategy": "id",
222+
"groups": []
223+
},
224+
219225
"home-new-tabs-dropdown-option-default": {
220226
"selectorData": "menuitem[data-l10n-id=\"home-mode-choice-default-fx\"]",
221227
"strategy": "css",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from time import sleep
2+
3+
import pytest
4+
from selenium.webdriver import Firefox
5+
6+
from modules.browser_object import TabBar
7+
8+
# from modules.page_object import AboutNewtab, AboutPrefs
9+
from modules.page_object import AboutPrefs
10+
11+
12+
@pytest.fixture()
13+
def set_prefs():
14+
"""Set prefs"""
15+
return [
16+
("browser.startup.homepage", "about:home"),
17+
("browser.startup.blankWindow", "false"),
18+
]
19+
20+
21+
def test_firefox_home_on_launch(driver: Firefox, sys_platform: str):
22+
"""
23+
C143543: setting the default new window to be Firefox Home
24+
"""
25+
# instantiate objs
26+
# tabs = TabBar(driver)
27+
about_prefs = AboutPrefs(driver, category="home").open()
28+
29+
# click the dropdown
30+
drop_down = about_prefs.get_element("home-new-window-dropdown")
31+
dropdown = about_prefs.Dropdown(page=about_prefs, root=drop_down)
32+
dropdown.select_option("Firefox Home (Default)")
33+
34+
# make sure that the option was selected correctly
35+
assert drop_down.get_attribute("label") == "Firefox Home (Default)"
36+
sleep(3)
37+
driver.switch_to.new_window("window")
38+
sleep(3)
39+
# # wait for the number of tabs and switch
40+
# tabs.wait_for_num_tabs(2)
41+
# driver.switch_to.window(driver.window_handles[-1])
42+
# sleep(10)
43+
# # make sure we are on the correct new tab page
44+
# assert about_prefs.get_element("body-logo") is not None

0 commit comments

Comments
 (0)