Skip to content

Commit 7c8998b

Browse files
vs/add test to verify .mp3 naming extension. (#1051)
1 parent 839deec commit 7c8998b

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

manifests/key.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ downloads:
387387
result: pass
388388
splits:
389389
- functional1
390+
test_download_mp3_and_check_extension:
391+
result: pass
392+
splits:
393+
- functional1
390394
test_download_pdf:
391395
result: pass
392396
splits:
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_navigation import Navigation
5+
from modules.page_object_generics import GenericPage
6+
7+
MP3_URL = "https://download.samplelib.com/mp3/sample-3s.mp3"
8+
MP3_NAME_REGEX = r".*\.mp3(\s\(\d+\))?$"
9+
10+
11+
@pytest.fixture()
12+
def test_case():
13+
return "1836832"
14+
15+
16+
@pytest.mark.headed
17+
def test_download_mp3_and_check_extension(driver: Firefox):
18+
"""
19+
1836829: Verify the mp3 filename shown in Firefox Downloads panel includes `.mp3`
20+
"""
21+
nav = Navigation(driver)
22+
23+
# Load a normal page
24+
page = GenericPage(driver, url="about:blank")
25+
page.open()
26+
27+
# Simulate downloading the file by creating and clicking an anchor element
28+
driver.execute_script(
29+
"""
30+
const a = document.createElement("a");
31+
a.href = arguments[0];
32+
a.click();
33+
""",
34+
MP3_URL,
35+
)
36+
37+
# Dismiss "harmful file" warning if present
38+
try:
39+
nav.click_file_download_warning_panel()
40+
except Exception:
41+
pass
42+
43+
# Wait for the download entry in the panel
44+
nav.element_visible("download-target-element")
45+
46+
# Reuse the verification that already worked
47+
nav.verify_download_name(MP3_NAME_REGEX)

0 commit comments

Comments
 (0)