Skip to content

Commit df4c0be

Browse files
Merge branch 'main' into philimon/autofill_refactor
2 parents bf00c0f + 3c78026 commit df4c0be

File tree

8 files changed

+58
-58
lines changed

8 files changed

+58
-58
lines changed

.github/workflows/check-beta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check new beta version
22

33
on:
44
schedule:
5-
- cron: "12 */1 * * *"
5+
- cron: "25 */1 * * *"
66
env:
77
LATEST: ""
88
permissions:

modules/page_object_about_pages.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,17 @@ def check_logins_present(
179179
else:
180180
assert expected_logins == actual_logins
181181

182-
def remove_password_csv(self, home_folder):
183-
# Delete password.csv, if there is one in test location
184-
if self.sys_platform == "Linux":
185-
downloads_folder = os.getcwd()
186-
else:
187-
downloads_folder = os.path.join(home_folder, "Downloads")
188-
passwords_csv = os.path.join(downloads_folder, "passwords.csv")
189-
for file in os.listdir(downloads_folder):
182+
def get_documents_dir(self) -> str:
183+
# Return full path to Documents directory
184+
home = os.path.expanduser("~")
185+
export_dir = os.path.join(home, "Documents")
186+
return export_dir
187+
188+
def remove_password_csv(self):
189+
# Delete password.csv, if there is one in the export location
190+
documents_dir = self.get_documents_dir()
191+
passwords_csv = os.path.join(documents_dir, "passwords.csv")
192+
for file in os.listdir(documents_dir):
190193
delete_files_regex = re.compile(r"\bpasswords.csv\b")
191194
if delete_files_regex.match(file):
192195
os.remove(passwords_csv)

modules/page_object_generics.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,29 @@ def add_image(self, image_path: str, sys_platform: str) -> BasePage:
7777
"""Add an image to a pdf file"""
7878
self.get_element("toolbar-add-image").click()
7979
self.get_element("toolbar-add-image-confirm").click()
80-
sleep(3)
80+
sleep(1.5)
8181
from pynput.keyboard import Controller, Key
8282

8383
keyboard = Controller()
8484
if sys_platform == "Darwin" or sys_platform == "Linux":
8585
keyboard.type("/")
86-
sleep(3)
86+
sleep(1.5)
8787
keyboard.type(image_path.lstrip("/"))
8888
else:
89-
sleep(2)
89+
sleep(1.5)
9090
keyboard.type(image_path)
9191
sleep(1)
9292
keyboard.press(Key.enter)
9393
keyboard.release(Key.enter)
94-
sleep(2)
94+
sleep(1)
9595
keyboard.press(Key.enter)
9696
keyboard.release(Key.enter)
97-
sleep(2)
97+
sleep(1.5)
9898
for _ in range(3):
9999
keyboard.tap(Key.tab)
100+
sleep(0.5)
100101
keyboard.tap(Key.enter)
102+
sleep(1)
101103
return self
102104

103105
def fill_element(self, element: str, data: str) -> BasePage:

tests/address_bar_and_search/test_preferences_all_toggles_enabled.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ def test_case():
1414
return "1618400"
1515

1616

17-
@pytest.mark.skipif(
18-
sys.platform.lower().startswith("linux"),
19-
reason="Test unstable in CI on Linux. see bug https://bugzilla.mozilla.org/show_bug.cgi?id=1951672",
20-
)
2117
def test_preferences_all_toggles_enabled(driver: Firefox):
2218
"""
2319
C1618400: Preferences - All toggles buttons Enabled

tests/password_manager/test_password_csv_correctness.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,39 @@ def test_case():
2020

2121

2222
@pytest.mark.headed
23-
@pytest.mark.skipif(MAC_GHA, reason="Test unstable in MacOS Github Actions")
24-
@pytest.mark.skipif(
25-
sys.platform.lower().startswith("linux"),
26-
reason="Test unstable in CI on Linux. see bug https://bugzilla.mozilla.org/show_bug.cgi?id=1951666",
27-
)
2823
def test_password_csv_correctness(driver_and_saved_logins, home_folder, sys_platform):
2924
"""
30-
C2241522: Check that password.csv displays the correct information
25+
C2241522: Verify than an exported password.csv file displays the correct information
3126
"""
3227
# Initializing objects
3328
(driver, usernames, logins) = driver_and_saved_logins
3429
about_logins = AboutLogins(driver)
3530
keyboard = Controller()
3631

37-
# Ensure the Downloads folder doesn't contain a passwords.csv file
38-
about_logins.remove_password_csv(home_folder)
32+
# Ensure the export target folder doesn't contain a passwords.csv file
33+
about_logins.remove_password_csv()
3934

4035
# Click on buttons to export passwords
4136
about_logins.open()
4237
about_logins.click_on("menu-button")
4338
about_logins.click_on("export-passwords-button")
4439
about_logins.click_on("continue-export-button")
4540

46-
# Download the password file
41+
# Export the password file
4742
time.sleep(5)
4843
keyboard.tap(Key.enter)
4944

50-
# Verify that the file exists
51-
if sys_platform == "Linux":
52-
downloads_folder = os.getcwd()
53-
else:
54-
downloads_folder = os.path.join(home_folder, "Downloads")
55-
passwords_csv = os.path.join(downloads_folder, "passwords.csv")
56-
about_logins.wait.until(lambda _: os.path.exists(passwords_csv))
45+
# Verify the exported csv file is present in the target folder
46+
documents_directory = about_logins.get_documents_dir()
47+
csv_file = os.path.join(documents_directory, "passwords.csv")
48+
about_logins.wait.until(lambda _: os.path.exists(csv_file))
5749

58-
# Verify the results
50+
# Verify the contents of the exported csv file
5951
guid_pattern = re.compile(
6052
r"{[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}}"
6153
)
6254
time_pattern = re.compile(r"[0-9]{10}")
63-
with open(passwords_csv) as pw:
55+
with open(csv_file) as pw:
6456
reader = csv.DictReader(pw)
6557
actual_logins = {}
6658
for row in reader:
@@ -74,4 +66,4 @@ def test_password_csv_correctness(driver_and_saved_logins, home_folder, sys_plat
7466
about_logins.check_logins_present(actual_logins, logins)
7567

7668
# Delete the password.csv created
77-
about_logins.remove_password_csv(home_folder)
69+
about_logins.remove_password_csv()

tests/password_manager/test_password_csv_export.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,34 @@ def test_case():
1818

1919

2020
@pytest.mark.headed
21-
@pytest.mark.skipif(MAC_GHA, reason="Test unstable in MacOS Github Actions")
22-
@pytest.mark.skipif(
23-
sys.platform.lower().startswith("linux"),
24-
reason="Test unstable in CI on Linux. see bug https://bugzilla.mozilla.org/show_bug.cgi?id=1951666",
25-
)
2621
def test_password_csv_export(
2722
driver_and_saved_logins, home_folder, sys_platform, opt_ci
2823
):
2924
"""
30-
C2241521: Check that password.csv can be downloaded from about:logins
25+
C2241521: Verify that a password.csv file can be exported from about:logins
3126
"""
3227
# Initializing objects
3328
(driver, usernames, logins) = driver_and_saved_logins
3429
about_logins = AboutLogins(driver)
3530
keyboard = Controller()
3631

37-
# Ensure the Downloads folder doesn't contain a passwords.csv file
38-
about_logins.remove_password_csv(home_folder)
32+
# Ensure the export target folder doesn't contain a passwords.csv file
33+
about_logins.remove_password_csv()
3934

4035
# Click on buttons to export passwords
4136
about_logins.open()
4237
about_logins.click_on("menu-button")
4338
about_logins.click_on("export-passwords-button")
4439
about_logins.click_on("continue-export-button")
4540

46-
# Download the password file
41+
# Export the password file
4742
time.sleep(5)
4843
keyboard.tap(Key.enter)
4944

50-
# Verify that the file exists
51-
if sys_platform == "Linux":
52-
downloads_folder = os.getcwd()
53-
else:
54-
downloads_folder = os.path.join(home_folder, "Downloads")
55-
passwords_csv = os.path.join(downloads_folder, "passwords.csv")
56-
about_logins.wait.until(lambda _: os.path.exists(passwords_csv))
45+
# Verify the exported csv file is present in the target folder
46+
documents_directory = about_logins.get_documents_dir()
47+
csv_file = os.path.join(documents_directory, "passwords.csv")
48+
about_logins.wait.until(lambda _: os.path.exists(csv_file))
5749

5850
# Delete the password.csv created
59-
about_logins.remove_password_csv(home_folder)
51+
about_logins.remove_password_csv()

tests/pdf_viewer/test_add_image_pdf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import os
21
from pathlib import Path
2+
from time import sleep
33

44
import pytest
55
from selenium.webdriver import Firefox
@@ -27,6 +27,7 @@ def test_case():
2727
def add_to_prefs_list():
2828
return [
2929
("browser.ml.enable", True),
30+
("pdfjs.enableAltText", False),
3031
("pdfjs.enableUpdatedAddImage", True),
3132
]
3233

@@ -38,14 +39,14 @@ def test_add_image_pdf(driver: Firefox, sys_platform, pdf_viewer: GenericPdf):
3839
3940
Arguments:
4041
sys_platform: Current System Platform Type
41-
pdf_viewer: instance of GenericPdf with correct path.
42+
pdf_viewer: Instance of GenericPdf with correct path.
4243
"""
4344
context_menu = ContextMenu(driver)
4445
image_path = Path("data") / IMAGE_FILE_NAME
4546
pdf_viewer.add_image(str(image_path.absolute()), sys_platform)
4647

47-
pdf_viewer.element_exists(ADDED_IMAGE_ELEMENT)
4848
pdf_viewer.element_visible(ADDED_IMAGE_ELEMENT)
49+
sleep(0.5)
4950

5051
pdf_viewer.context_click(ADDED_IMAGE_ELEMENT)
5152
context_menu.click_and_hide_menu(DELETE_MENU_OPTION)

tests/tabs/test_mute_tabs.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,26 @@
33
import pytest
44
from selenium.webdriver import Firefox
55
from selenium.webdriver.common.by import By
6+
from selenium.webdriver.support import expected_conditions as EC
67

78
from modules.browser_object import TabBar
89

10+
PLAY_BUTTON_SELECTOR = ".ytp-play-button"
11+
COOKIE_CONSENT_SELECTOR = (
12+
"button[aria-label^='Accept all'], button[aria-label^='Accept the use']"
13+
)
14+
915

1016
@pytest.fixture()
1117
def test_case():
1218
return "134719"
1319

1420

21+
@pytest.fixture()
22+
def add_to_prefs_list():
23+
return [("network.cookie.cookieBehavior", "2")]
24+
25+
1526
GHA = environ.get("GITHUB_ACTIONS") == "true"
1627

1728

@@ -21,8 +32,11 @@ def test_mute_unmute_tab(screenshot, driver: Firefox, video_url: str):
2132
"""C134719, test that tabs can be muted and unmuted"""
2233
tabs = TabBar(driver)
2334
driver.get(video_url)
24-
play_button = driver.find_element(By.CSS_SELECTOR, ".ytp-play-button")
35+
tabs.expect(EC.title_contains("Top 10"))
36+
37+
play_button = driver.find_element(By.CSS_SELECTOR, PLAY_BUTTON_SELECTOR)
2538
play_button.click()
39+
2640
with driver.context(driver.CONTEXT_CHROME):
2741
tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.PLAYING)
2842
tabs.click_tab_mute_button(1)

0 commit comments

Comments
 (0)