Skip to content

refute_has doesn't block (for async code) #586

@jonleighton

Description

@jonleighton

I wrote a test like this:

session
|> refute_has(css(".my-element"))

The element is becomes hidden via JS executing on the page.

My expectation was that if the element was present when refute_has first runs, it would wait for the async timeout and keep testing the DOM before raising an error. This turns out not to be true, which lead to flakey test failures.

We can do this instead:

session
|> assert_has(css(".my-element", count: 0))

But I find the behaviour of refute_has surprising. Is this deliberate? If not, perhaps it can be changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions