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.
There's currently no in-script way to assert that an element is not present. Every selector-taking primitive — including
is hidden— fails withSelector did not matchwhen the selector resolves to nothing, sois hiddencan only distinguish "resolvable but hidden" from "visible", not "gone". (#1515 improved the error taxonomy around this forwait, 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 hiddenprobes betweenagent-device testsegments, treatingSelector did not matchon 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 existingwait <selector>.Happy to provide more detail on the RN unmount semantics or scripts that reproduce the gap.