Skip to content

test(e2e): fix session-test pollution (stop session between tests)#32

Open
hikaps wants to merge 1 commit into
developfrom
fix/appium-session-test-isolation
Open

test(e2e): fix session-test pollution (stop session between tests)#32
hikaps wants to merge 1 commit into
developfrom
fix/appium-session-test-isolation

Conversation

@hikaps

@hikaps hikaps commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Problem

test_streaming_session_calls_helper failed in the full e2e suite (TimeoutException waiting for "Start Session") but passed in isolation. Root cause is test pollution, not the viewport.

sessionRunner is a global manager that persists across tests. test_two_instances_launch clicks Start and never Stop, leaving running=true, so the Start/Stop toolbar action reads "Stop Session" — the next test's click_by_name("Start Session") times out.

Fix

  • appiumtests/conftest.py — add stop_session_if_running(driver): navigate to SessionSetup → click "Stop Session" if present → wait for "Start Session".
  • appiumtests/test_session.pyTestSessionLifecycle gets a class-scoped autouse fixture (_stop_session_after) calling it after each test.

Scoped to the session tests (where every polluter and victim lives) so the other ~43 tests pay no per-test navigation overhead. Applying it globally via clean_state worked but added ~13 min and pushed the suite past the 30-min ceiling.

Verification

Full e2e suite (rootless container): 52 tests, 0 failures, 0 errors, 5 skipped (~19 min) — previously 1 failed. Both test_two_instances_launch and test_streaming_session_calls_helper now pass.

The 3 viewport-related skips (inline streaming controls off-screen in the small headless viewport) remain — separate, smaller issue (scroll-into-view or a larger nested-kwin output).

sessionRunner is a global manager that persists across tests; a test that starts a session but never stops it (test_two_instances_launch) left the Start/Stop toolbar action on 'Stop Session', so the next test's wait for 'Start Session' timed out. test_streaming_session_calls_helper failed in-suite despite passing in isolation.

Add stop_session_if_running() (navigate to SessionSetup, click Stop if present) called from a class-scoped autouse fixture in TestSessionLifecycle. Scoped to session tests so the other ~43 tests pay no per-test navigation overhead (applying it globally pushed the suite past the 30-min ceiling).

Verified: full e2e suite now 52 tests, 0 failures (was 1 failed).
@hikaps hikaps force-pushed the fix/appium-session-test-isolation branch from c53d9a6 to 0d42285 Compare July 8, 2026 21:28
hikaps added a commit that referenced this pull request Jul 8, 2026
…ot capture)

Reliability pass over the appium suite so existing tests mean what they say:

- conftest.select_combo_option: bump popup-open wait to 0.5s and add a guarded post-selection value check. NOTE: in selenium-webdriver-at-spi the Qt ComboBox Value interface is unimplemented (get_attribute('value') raises NotImplementedError) and .text returns the label, not the selection, so the check is currently a safe no-op that activates if the driver gains Value support; it never false-fires.

- conftest.stop_session_if_running (PR #32): use DEFAULT_TIMEOUT for navigation/detection waits; the prior timeout=2 could swallow a slow-navigation TimeoutException and leak a running session into the next test.

- test_home.test_home_shows_action_cards: assert the home cards exist instead of clicking a card then waiting for its own NAME (a no-op that always passed).

- base_test.navigate_to_device_assignment: wait for spinInstanceCount (page-only) instead of the NAME 'Assign Devices' that collides with the toolbar action.

- test_devices.test_switch_device_tabs: assert each clicked tab becomes selected (was click-and-assert-nothing).

- conftest screenshot capture: write under APPIUM_ARTIFACT_OUTPUT_PATH when set (writable in the container; the baked appiumtests/screenshots is root-owned) and log capture failures instead of swallowing them.

- Remove 17 tautological is_displayed() asserts that followed wait_for_element on the same element (presence already proven; they masked wrong-state elements).

cardLayoutGrid/comboScaling kept on NAME: their objectName does not propagate to AT-SPI in the SessionSetup context (siblings do).

Verified: full e2e suite 52 tests, 0 failures, 5 skipped (~19 min).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant