Skip to content

Commit 343a29a

Browse files
authored
test(pd-e2e): PD E2E added applitools eyes to Mix Form in PD (#21212)
# Overview Addresses https://opentrons.atlassian.net/browse/RQA-5266 Added applitools eyes check to the Mix Step form and associated modals ## Changelog test_pd_mix_step.py - removed verifications - added applitools eyes - removed import_protocol_and_open_editor helper and dismiss_migration_modal functionm in favor of a reusable function imported from utility utility.py - renamed import_protocol_and_open_editor helper to address an old comment from a previous PR regarding the use of a leading _, and updated all affected files ## Risk assessment -Low risk
1 parent a57d1f9 commit 343a29a

File tree

6 files changed

+69
-82
lines changed

6 files changed

+69
-82
lines changed

e2e-testing/tests/pd/test_pd_drag_and_drop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from playwright.sync_api import Page
55

66
from automation.pd_pages import ProtocolEditorPage
7-
from utility import _import_protocol_and_open_editor
7+
from utility import import_protocol_and_open_editor
88

99
PROTOCOL_PATH = "fixtures/protocol/8/doItAllV8.json"
1010

@@ -14,7 +14,7 @@
1414
def test_drag_drop_steps(page: Page, pd_base_url: str) -> None:
1515
editor = ProtocolEditorPage(page)
1616

17-
_import_protocol_and_open_editor(page, PROTOCOL_PATH, migration=True)
17+
import_protocol_and_open_editor(page, PROTOCOL_PATH, migration=True)
1818

1919
## Drag Transfer Step down the Step Form, from step 3 (index 2) to step 7 (becomes index 6)
2020
editor.drag_and_drop(2, 7)
Lines changed: 60 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
"""Tests covering the Mix step workflow in Protocol Designer."""
22

33
import pytest
4-
from playwright.sync_api import Page, expect
4+
from playwright.sync_api import Page
55

6-
from automation.pd_pages import LandingPage, MixStepForm, ProtocolEditorPage
6+
from automation.pd_pages import MixStepForm, ProtocolEditorPage
7+
from eyes import Eyes
8+
from utility import import_protocol_and_open_editor
79

810
PROTOCOL_PATH = "fixtures/protocol/8/doItAllV8.json"
911
LABWARE_OPTION = "B4 Opentrons Tough 96 Well Plate 200 µL PCR Full Skirt"
@@ -12,129 +14,114 @@
1214

1315

1416
@pytest.mark.pdE2E
15-
def test_import_protocol_and_enter_edit_mode(page: Page, pd_base_url: str) -> None:
16-
"""Verify we can import a protocol and reach the editor."""
17-
18-
_import_protocol_and_open_editor(page)
19-
expect(page.get_by_role("button", name="Add Step")).to_be_visible()
20-
21-
22-
@pytest.mark.pdE2E
23-
def test_mix_step_configuration_workflow(page: Page, pd_base_url: str) -> None:
17+
def test_mix_step_configuration_workflow(page: Page, eyes: Eyes | None) -> None:
2418
"""Replicate the complete mixSettings Cypress test using Playwright."""
2519

26-
editor = _import_protocol_and_open_editor(page)
27-
28-
# Step menu parity checks
29-
editor.open_add_step_menu()
30-
editor.verify_add_step_menu_options()
31-
editor.select_step_type("Mix")
20+
import_protocol_and_open_editor(page, PROTOCOL_PATH, migration=True)
21+
protocol_editor = ProtocolEditorPage(page)
3222

3323
mix_form = MixStepForm(page)
24+
protocol_editor.add_step("Mix")
3425
# currently there is a divergence in the number of parts in the mix step form
3526
# between 8.6.2 prod (1/3) and what's in edge (1/4)
36-
# mix_form.expect_part_header("Part 1 / 3")
37-
for label in [
38-
"Mix",
39-
"Pipette",
40-
"Tiprack",
41-
"Labware",
42-
]:
43-
print(f"Expecting text: {label}")
44-
mix_form.expect_text(label)
4527

4628
mix_form.select_pipette(PIPETTE_OPTION)
4729
mix_form.select_tiprack(TIPRACK_OPTION)
4830
mix_form.select_labware(LABWARE_OPTION)
4931

50-
for label in [
51-
"Pipette nozzles and wells",
52-
"Mix volume",
53-
"Mix repetitions",
54-
]:
55-
mix_form.expect_text(label)
56-
5732
mix_form.open_nozzle_and_well_selector()
33+
if eyes is not None:
34+
eyes.check(
35+
checkpoint_name="Nozzle Selector Layout",
36+
target=eyes.Target.window().fully(),
37+
)
38+
5839
mix_form.select_nozzles()
5940
mix_form.expect_well_modal()
41+
if eyes is not None:
42+
eyes.check(
43+
checkpoint_name="Well Modal Layout",
44+
target=eyes.Target.window().fully(),
45+
)
46+
6047
mix_form.select_wells(["A1", "A2"])
6148
mix_form.enter_volume("100")
6249
mix_form.enter_mix_repetitions("5")
50+
if eyes is not None:
51+
eyes.check(
52+
checkpoint_name="Mix Step Settings Form - Part 1",
53+
target=eyes.Target.window().fully(),
54+
)
6355
mix_form.click_continue()
6456

6557
# Part 2 / 4 – liquid class settings
66-
mix_form.expect_part_header(("Part 2 / 4", "Part 2 / 3"))
67-
mix_form.expect_text("Apply liquid class settings for this mix")
6858
mix_form.click_continue()
69-
mix_form.expect_part_header(("Part 3 / 4", "Part 2 / 3"))
59+
if eyes is not None:
60+
eyes.check(
61+
checkpoint_name="Mix Settings Form Liquid Class Modal - Part 2",
62+
target=eyes.Target.window().fully(),
63+
)
7064
mix_form.open_mix_tip_modal()
71-
mix_form.expect_text("Side view")
65+
if eyes is not None:
66+
eyes.check(
67+
checkpoint_name="Mix Tip Position Modal",
68+
target=eyes.Target.window().fully(),
69+
)
7270
page.get_by_role("button", name="Swap view").click()
73-
mix_form.expect_text("Top view")
7471
mix_form.set_mix_tip_position("2", "2", "4")
72+
if eyes is not None:
73+
eyes.check(
74+
checkpoint_name="Mix Tip Position Modal with Values",
75+
target=eyes.Target.window().fully(),
76+
)
7577
mix_form.reset_settings()
7678
mix_form.set_mix_tip_position("2", "2", "5")
7779
mix_form.save_modal()
7880

7981
mix_form.toggle_checkbox()
8082
mix_form.fill_delay_seconds("5")
83+
if eyes is not None:
84+
eyes.check(
85+
checkpoint_name="Mix Step Form Aspirate Settings - Part 3",
86+
target=eyes.Target.window().fully(),
87+
)
8188

8289
# Part 3 / 4 – dispense configuration
8390
mix_form.click_dispense_tab()
8491
mix_form.set_flow_rate("dispense_flowRate", "300")
8592
mix_form.toggle_checkbox()
8693
mix_form.fill_delay_seconds("5")
87-
8894
mix_form.toggle_checkbox()
8995
mix_form.set_push_out_volume("5")
90-
9196
mix_form.toggle_checkbox()
9297
mix_form.open_blowout_location_dropdown()
93-
mix_form.expect_text("Destination well")
9498
page.get_by_text("Destination well").click()
9599
mix_form.set_flow_rate("blowout_flowRate", "300")
96100
mix_form.open_blowout_position_modal()
97101
mix_form.set_blowout_position("4")
102+
if eyes is not None:
103+
eyes.check(
104+
checkpoint_name="Mix Step Form Blowout Settings - Part 3",
105+
target=eyes.Target.window().fully(),
106+
)
98107
mix_form.reset_settings()
99108
mix_form.set_blowout_position("-3")
100109
mix_form.save_modal()
101-
mix_form.expect_text("Blowout position from top")
110+
if eyes is not None:
111+
eyes.check(
112+
checkpoint_name="Mix Step Form Dispense Settings - Part 3 cont..",
113+
target=eyes.Target.window().fully(),
114+
)
102115

103116
mix_form.click_continue()
104117

105118
# Part 4 / 4 – tip handling and rename
106-
mix_form.expect_part_header(("Part 4 / 4", "Part 3 / 3"))
107-
mix_form.expect_text("Tip management")
108119
mix_form.expect_tip_handling_options(["Always", "Once", "Per source", "Per destination", "Never"])
109120
mix_form.select_tip_handling_option("Once")
110-
111121
mix_form.rename_step("Cypress Mix Test", "This is testing cypress automation in PD")
112122
mix_form.save_step()
113-
114-
expect(page.get_by_text("Cypress Mix Test").first).to_be_visible()
115-
116-
117-
def _import_protocol_and_open_editor(page: Page) -> ProtocolEditorPage:
118-
"""Shared setup helper used by both tests."""
119-
120-
landing = LandingPage(page)
121-
landing.wait_for_page_load()
122-
landing.confirm_welcome_modal()
123-
landing.click_import_existing_protocol()
124-
landing.upload_protocol_file(PROTOCOL_PATH)
125-
126-
expect(page.get_by_text("Protocol Metadata")).to_be_visible(timeout=10000)
127-
_dismiss_migration_modal(page)
128-
129-
page.get_by_role("button", name="Edit protocol").click()
130-
expect(page.get_by_role("button", name="Add Step")).to_be_visible(timeout=5000)
131-
return ProtocolEditorPage(page)
132-
133-
134-
def _dismiss_migration_modal(page: Page) -> None:
135-
"""Dismiss the migration modal if it appears during import."""
136-
137-
overlay = page.locator('[aria-label="BackgroundOverlay_ModalShell"]')
138-
if overlay.is_visible():
139-
page.get_by_role("button", name="Import", exact=True).click()
140-
expect(overlay).not_to_be_visible()
123+
if eyes is not None:
124+
eyes.check(
125+
checkpoint_name="Mix Step Form Tip Handling Settings - Part 4",
126+
target=eyes.Target.window().fully(),
127+
)

e2e-testing/tests/pd/test_pd_move_labware.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from playwright.sync_api import Page
55

66
from automation.pd_pages import ProtocolEditorPage
7-
from utility import _import_protocol_and_open_editor
7+
from utility import import_protocol_and_open_editor
88

99
PROTOCOL_PATH = "fixtures/protocol/9/PD_Move_Lids_Setup.py"
1010

@@ -30,7 +30,7 @@ def test_move_labware_flex(page: Page, pd_base_url: str) -> None:
3030
- Made test for OT2 (only manual moves)
3131
"""
3232
# Import setup protocol and open editor
33-
_import_protocol_and_open_editor(page, PROTOCOL_PATH, migration=True)
33+
import_protocol_and_open_editor(page, PROTOCOL_PATH, migration=True)
3434

3535
editor = ProtocolEditorPage(page)
3636

e2e-testing/tests/pd/test_pd_smoke_test_flex.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from automation.pd_pages.heater_shaker_step_form_page import _add_heater_shaker_step
2020
from automation.pd_pages.tc_step_form_page import _add_thermocycler_profile_step, _add_thermocycler_state_step
2121
from automation.pd_pages.tempdeck_step_form_page import _add_temperature_module_step
22-
from utility import _import_protocol_and_open_editor
22+
from utility import import_protocol_and_open_editor
2323

2424
# Make the automation package importable in tests (same pattern as other tests)
2525
sys.path.insert(0, str(Path(__file__).parent.parent))
@@ -41,7 +41,7 @@ def test_pd_combined_smoke_flow(page: Page, pd_base_url: str) -> None:
4141
4242
If any Playwright action or assertion fails, the test will pause for debugging.
4343
"""
44-
_import_protocol_and_open_editor(page, PROTOCOL_PATH, migration=True)
44+
import_protocol_and_open_editor(page, PROTOCOL_PATH, migration=True)
4545

4646
editor = ProtocolEditorPage(page)
4747
print("✓ File uploaded, ready for module steps")

e2e-testing/tests/pd/test_pd_transfer_step.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
TransferPage,
1212
)
1313
from eyes import Eyes
14-
from utility import _import_protocol_and_open_editor
14+
from utility import import_protocol_and_open_editor
1515

1616
SOURCE_LABWARE = "Opentrons Tough 300 mL 1 Well Reservoir"
1717
DESTINATION_LABWARE = "Greiner 384 Well Plate 240 µL"
@@ -20,7 +20,7 @@
2020
@pytest.mark.pdE2E
2121
@pytest.mark.slow
2222
def test_96_channel_workflow(page: Page, eyes: Eyes | None) -> None:
23-
_import_protocol_and_open_editor(page, "fixtures/protocol/9/Liquid_Class_96_Channel_Test.py", migration=True)
23+
import_protocol_and_open_editor(page, "fixtures/protocol/9/Liquid_Class_96_Channel_Test.py", migration=True)
2424
editor = ProtocolEditorPage(page)
2525
editor.open_add_step_menu()
2626
editor.add_step()

e2e-testing/utility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def wrapper(*args, **kwargs):
5656
return wrapper
5757

5858

59-
def _import_protocol_and_open_editor(page: Page, PROTOCOL_PATH: str, migration: bool) -> None:
59+
def import_protocol_and_open_editor(page: Page, PROTOCOL_PATH: str, migration: bool) -> None:
6060
"""This test takes two inputs:
6161
1. page: The Playwright Page object.
6262
2. PROTOCOL_PATH: The file path of the protocol to import

0 commit comments

Comments
 (0)