Skip to content

Commit

Permalink
flutter_app: refactor for stricter tests
Browse files Browse the repository at this point in the history
Closing "any focused window" proved imprecise and resulted in problems
on other variants.
  • Loading branch information
Saviq committed Dec 6, 2024
1 parent fe018cd commit 46a1375
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 20 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*** Settings ***
Resource ${KVM_RESOURCE}
Resource ${KVM_RESOURCE}

Test Teardown VIDEO.Match ${ZERO_WINDOWS}


*** Variables ***
Expand All @@ -8,8 +10,6 @@ ${T} ${CURDIR}
${ANCHOR_OPTION_TOP_LEFT} ${T}/anchor_option_top_left.png
${ANCHOR_OPTION_BOTTOM_RIGHT} ${T}/anchor_option_bottom_right.png

${BUTTON_CLOSE_FOCUSED} ${T}/button_close_focused.png

${DIALOG_CUSTOM_POSITIONER} ${T}/dialog_custom_positioner.png

${EXPECTED_SATELLITE_PLACEMENT} ${T}/expected_satellite_placement.png
Expand All @@ -30,6 +30,8 @@ ${WINDOW_SATELLITE_1} ${T}/window_satellite_1.png
${WINDOW_POPUP_1} ${T}/window_popup_1.png
${WINDOW_TIP_1} ${T}/window_tip_1.png

${ZERO_WINDOWS} ${T}/zero_windows.png


*** Test Cases ***
Reference App Opens
Expand All @@ -43,12 +45,12 @@ Regular Window Opens
Floating Regular Window Opens
Open FLOATING_REGULAR Window
VIDEO.Match ${WINDOW_FLOATING_REGULAR_0_FOCUSED}
Close Focused Toplevel Window
Close Floating Toplevel Window

Dialog Window Opens
Open DIALOG Window
VIDEO.Match ${WINDOW_DIALOG_FOCUSED}
Close Focused Toplevel Window
Close Dialog Window

Satellite Window Opens
Open REGULAR Window
Expand Down Expand Up @@ -77,7 +79,7 @@ Floating Regular Window Stays On Top
Click LEFT Button
Walk Pointer To ${WINDOW_FLOATING_REGULAR_0_NON_FOCUSED}
Click LEFT Button
Close Focused Toplevel Window
Close Floating Toplevel Window

Dialog Is Modal To Parent
Open REGULAR Window
Expand All @@ -97,7 +99,7 @@ Satellite Is Placed According To Custom Positioner
Open FLOATING_REGULAR Window
Open SATELLITE Window
VIDEO.Match ${EXPECTED_SATELLITE_PLACEMENT}
Close Focused Toplevel Window
Close Floating Toplevel Window

Child Windows Move With Parent
Open FLOATING_REGULAR Window
Expand All @@ -117,7 +119,7 @@ Child Windows Move With Parent
Release LEFT Button
VIDEO.Match ${EXPECTED_WINDOW_AFTER_MOVE}
Close Dialog Window
Close Focused Toplevel Window
Close Floating Toplevel Window

Slide Constraint Is Applied
Set Top Left Custom Positioner
Expand All @@ -129,7 +131,7 @@ Slide Constraint Is Applied
Release LEFT Button
Open POPUP Window
VIDEO.Match ${EXPECTED_POPUP_PLACEMENT_SLIDE}
Close Focused Toplevel Window
Close Floating Toplevel Window

Flip Constraint Is Applied
Set Top Left Custom Positioner
Expand Down Expand Up @@ -165,7 +167,7 @@ Flip Constraint Is Applied
Release LEFT Button
Open POPUP Window
VIDEO.Match ${EXPECTED_POPUP_PLACEMENT_FLIP}
Close Focused Toplevel Window
Close Floating Toplevel Window

Resize Constraint Is Applied
Set Top Left Custom Positioner
Expand Down Expand Up @@ -201,7 +203,7 @@ Resize Constraint Is Applied
Release LEFT Button
Open POPUP Window
VIDEO.Match ${EXPECTED_POPUP_PLACEMENT_RESIZE}
Close Focused Toplevel Window
Close Floating Toplevel Window

Flip Constraint Precedes Slide
Set Top Left Custom Positioner
Expand All @@ -227,7 +229,7 @@ Flip Constraint Precedes Slide
Release LEFT Button
Open POPUP Window
VIDEO.Match ${EXPECTED_POPUP_PLACEMENT_FLIP}
Close Focused Toplevel Window
Close Floating Toplevel Window

Slide Constraint Precedes Resize
Set Top Left Custom Positioner
Expand All @@ -253,19 +255,40 @@ Slide Constraint Precedes Resize
Release LEFT Button
Open POPUP Window
VIDEO.Match ${EXPECTED_POPUP_PLACEMENT_SLIDE}
Close Focused Toplevel Window
Close Floating Toplevel Window


*** Keywords ***
Close Focused Toplevel Window
Walk Pointer To ${BUTTON_CLOSE_FOCUSED}
Move Pointer To (0, 0)
${pos}= Move Pointer To ${WINDOW_REGULAR_0_FOCUSED}
${pos}= Displace ${pos} By (130, 0)
Move Pointer To ${pos}
Click LEFT Button
Click LEFT Button
Wait Until Keyword Succeeds 5 1
... Run Keyword And Expect Error ImageNotFoundError
... VIDEO.Match ${WINDOW_REGULAR_0_FOCUSED} 0

Close Floating Toplevel Window
Move Pointer To (0, 0)
${pos}= Move Pointer To ${WINDOW_FLOATING_REGULAR_0_FOCUSED}
${pos}= Displace ${pos} By (138, 0)
Move Pointer To ${pos}
Click LEFT Button
Wait Until Keyword Succeeds 5 1
... Run Keyword And Expect Error ImageNotFoundError
... VIDEO.Match ${WINDOW_FLOATING_REGULAR_0_FOCUSED} 0

Close Dialog Window
${pos}= Walk Pointer To ${WINDOW_DIALOG_FOCUSED}
Move Pointer To (0, 0)
${pos}= Move Pointer To ${WINDOW_DIALOG_FOCUSED}
${pos}= Displace ${pos} By (112, 0)
Walk Pointer To ${pos}
Move Pointer To ${pos}
Click LEFT Button
Wait Until Keyword Succeeds 5 1
... Run Keyword And Expect Error ImageNotFoundError
... VIDEO.Match ${WINDOW_DIALOG_FOCUSED} 0

Select ${preset} Positioner Preset
${vertical_distance_between_options}= Set Variable 48
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion mir-ci/mir_ci/tests/test_mir_flutter_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ async def test_mir_flutter_app(self, robot_log, server, app, tmp_path) -> None:

async with server_instance, server_instance.program(App(app.command[0], app.app_type)) as app:
tuple((tmp_path / k).symlink_to(v) for k, v in assets.items())
robot = server_instance.program(App(("robot", "-d", tmp_path, "--log", robot_log, tmp_path)))
robot = server_instance.program(
App(("robot", "--exitonfailure", "-d", tmp_path, "--log", robot_log, tmp_path))
)
async with robot:
await robot.wait(120)

0 comments on commit 46a1375

Please sign in to comment.