Skip to content

Feature request: native absence assertion (is absent / wait gone) #2236

Description

@Procopis-QG

There's currently no in-script way to assert that an element is not present. Every selector-taking primitive — including is hidden — fails with Selector did not match when the selector resolves to nothing, so is hidden can only distinguish "resolvable but hidden" from "visible", not "gone". (#1515 improved the error taxonomy around this for wait, but there's still no positive assertion for absence.)

On React Native this bites hard: RN typically unmounts hidden UI rather than hiding it, so "the modal closed", "the spinner went away", "the badge is no longer shown" are all non-existence checks — and none of them can be expressed inside a test/replay script today.

Our workaround

We lift these assertions out of the replay script and run them as separate is hidden probes between agent-device test segments, treating Selector did not match on the probe's exit as a pass (polled for the wait-style variant). It works, but it splits one logical script into several invocations and loses the single-run reporter timeline.

Suggested shapes

Either of these would remove the workaround:

  • is absent <selector> — passes when the selector resolves to nothing (or only to a hidden element), fails when a matching element is visible.
  • wait gone <selector> [timeoutMs] — polls until the selector no longer matches, symmetrical with the existing wait <selector>.

Happy to provide more detail on the RN unmount semantics or scripts that reproduce the gap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions