Skip to content

Commit 9656e77

Browse files
fix for test_downloads_from_private_not_leaked
1 parent f9ccf56 commit 9656e77

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

modules/browser_object_navigation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ def open_tracker_panel(self) -> BasePage:
267267
self.get_element("shield-icon").click()
268268
return self
269269

270+
@BasePage.context_chrome
271+
def click_file_download_warning_panel(self) -> BasePage:
272+
""" exit file download warning panel if present """
273+
self.element_clickable("file-download-warning-button")
274+
self.click_on("file-download-warning-button")
275+
return self
270276
def wait_for_item_to_download(self, filename: str) -> BasePage:
271277
"""
272278
Check the downloads tool in the toolbar to wait for a given file to download

modules/data/navigation.components.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,18 @@
393393
"groups": []
394394
},
395395

396+
"file-download-warning-panel": {
397+
"selectorData": "downloadsPanel-privateBrowsing",
398+
"strategy": "id",
399+
"groups": []
400+
},
401+
402+
"file-download-warning-button": {
403+
"selectorData": "button[data-l10n-id='downloads-private-browsing-accept-button']",
404+
"strategy": "css",
405+
"groups": []
406+
},
407+
396408
"bookmark-in-bar": {
397409
"selectorData": "toolbarbutton.bookmark-item",
398410
"strategy": "css",

tests/security_and_privacy/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def suite_id():
1212
@pytest.fixture()
1313
def prefs_list(add_to_prefs_list: dict):
1414
"""List of prefs to send to main conftest.py driver fixture"""
15-
prefs = [("browser.urlbar.scotchBonnet.enableOverride", True)]
15+
prefs = [("browser.urlbar.scotchBonnet.enableOverride", True), ("devtools.debugger.remote-enabled", True), ("devtools.chrome.enabled", True), ("ui.popup.disable_autohide", True)]
1616
prefs.extend(add_to_prefs_list)
1717
return prefs
1818

tests/security_and_privacy/test_downloads_from_private_not_leaked.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,16 @@ def test_downloads_from_private_not_leaked(driver: Firefox, delete_files, screen
5959
and el.is_displayed()
6060
]
6161
# first link is large, skip it
62+
panel_skipped = False
6263
for link in valid_links[1 : (NUM_LINKS + 1)]:
6364
target = link.get_attribute("href")
6465
logging.info(f"Downloading target {target}:")
6566
logging.info(link.text)
6667
link.click()
68+
if not panel_skipped:
69+
# skip download warning panel once.
70+
nav.click_file_download_warning_panel()
71+
panel_skipped = True
6772
nav.wait_for_item_to_download(target.split("/")[-1])
6873

6974
# Check that everything looks good in About:Downloads

0 commit comments

Comments
 (0)