Skip to content

Title a plain script's synthetic test "session" #283

Closed

Description

@vishnuv688

Part of #277

_send_default_suite names both the suite and its single test after
the entry file, so the tree reads web_form_minimal.py nested inside
web_form_minimal.py. Visible in the dashboard screenshot used in the one-pager.

Acceptance criteria

A plain script shows the file as the suite and session
as the test. pytest runs are unaffected.

Activity

  1. self-assigned this
    on Aug 12, 2026
  2. vishnuv688 commented on Aug 17, 2026

    @vishnuv688
    MemberAuthor

    Scope expanded to the whole tree

    Building a pytest example that actually exercises the tree (examples/selenium/python-test/test_login_pytest.py, mixing a class-based group with a module-level test) surfaced two more defects in the same surface. The original XS fix is correct but only covers the plain-script case, which is the less common one — a real Python suite is pytest, and the tree was wrong there in two different ways.

    Recording all of it here since it is one concern: the tree telling the truth about a Python run.


    1. Done — the original. _send_default_suite named the suite and its single test after the entry file, so the tree read login.py nested inside login.py. The file stays the suite and the test is now named session, matching how the pytest plugin names a real test (title is the test's own name, parent is the file, fullTitle joins the two). pytest runs are unaffected: _external_suites already suppresses the synthetic suite entirely.

    2. Done — a pytest class was flattened. pytest has no describe/it; a class is the grouping construct. But report.location flattens it into the name, measured on a real run:

    LOCATION=('t.py', 1, 'TestLogin.test_valid')  NODEID='t.py::TestLogin::test_valid'
    LOCATION=('t.py', 7, 'test_plain')            NODEID='t.py::test_plain'
    

    _SuiteRegistry grouped by file only, so class-based tests rendered as flat rows titled TestLogin.test_valid, while the equivalent mocha describe nests. The class is now split back out of the nodeid into a nested suite, the leaf drops the prefix pytest repeats, and state rolls up through the group to the file. Confirmed in the dashboard: TestLogin is its own node with two children, and the module-level test sits beside it.

    3. Open — selecting a test breaks the Source tab. Two producers describe the same file two different ways:

    producer form measured
    call_source() — commands, and the keys of the sources map absolute /…/test_shape.py
    pytest plugin, report.location[0] — the test's file and call_source relative test_shape.py

    _capture_source keys sources by the command's absolute callSource, while every test entry carries a relative path. The app's resolveSourceFile tries an exact key then normalizeSourcePath, which only strips a trailing :line and does not reconcile relative against absolute. So with nothing selected the panel resolves through a command's absolute path and the source renders; select a specific test and it resolves through the test's relative path and reports "Source for test_login_pytest.py was not captured in this trace."

    Invisible in a plain-script run, where the same absolute path is used throughout, which is why only the pytest example exposes it. The fix belongs in the plugin: resolve report.location[0] against pytest's rootdir so tests and commands agree on one form. Teaching the app to accept both would paper over two producers disagreeing, and would still leave the tree labelled with a path matching nothing else.


    Related, not in scope here

    • The run always reports "passed". _send_default_suite is called with a hardcoded "passed" (instrumentation.py:356) and the adapter has no failure path, so a run that raises still shows a green 1/1. Independent of the tree's shape and needs its own issue.
    • The workbench renders a half-populated state while loading — the Actions list is fully populated while the summary and tree are still empty, then snap in. Separate surface (app, not the adapter) and not yet diagnosed.
  3. linked a pull request that will close this issueVv/283 session test title #308on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingselenium-devtools-pyPython Selenium adapter for the DevTools dashboard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions