@@ -28,18 +28,27 @@ def test_download_pdf_from_context_menu(
2828):
2929 """
3030 C1756790: Verify that Telemetry is Recorded when Saving a PDF from the Context menu
31+
32+ Notes:
33+ - Firefox is launched with a new profile (also a test case precondition) that has default download settings.
34+ - This means the OS-level "Save File" dialog will appear for every download.
35+ - Selenium cannot interact with this native dialog directly, so the test
36+ must rely on fixed waits to give the OS time to render the dialog and to
37+ finish writing the file.
3138 """
3239
3340 from pynput .keyboard import Controller
3441
42+ # Initialize objects
3543 pdf = GenericPdf (driver , pdf_url = fillable_pdf_url )
36- pdf .open ()
3744 keyboard = Controller ()
38- body = pdf .get_element ("pdf-body" )
45+ context_menu = ContextMenu (driver )
46+ about_telemetry = AboutTelemetry (driver )
3947
40- # Right-click on the body of the file and select Save page as
48+ # Open the PDF file, right-click on the body of the file and select "Save page as"
49+ pdf .open ()
50+ body = pdf .get_element ("pdf-body" )
4151 pdf .context_click (body )
42- context_menu = ContextMenu (driver )
4352 context_menu .click_and_hide_menu ("context-menu-save-page-as" )
4453
4554 # Allow time for the save dialog to appear and handle prompt
@@ -51,8 +60,8 @@ def test_download_pdf_from_context_menu(
5160 sleep (3 )
5261
5362 # Open about:telemetry and go to events tab
54- about_telemetry = AboutTelemetry ( driver ) .open ()
55- about_telemetry .get_element ("events-tab" ). click ( )
63+ about_telemetry .open ()
64+ about_telemetry .click_on ("events-tab" )
5665
5766 # Verify that Telemetry is recorded
5867 pdf_telemetry_data = ["downloads" , "added" , "fileExtension" , "pdf" ]
0 commit comments