Skip to content

Fix brittle error checking #43

@ankur22

Description

@ankur22

Is this always the error message thrown when you call inputValue() over a locator that doesn't point to an input element? 🤔

Originally posted by @joanlopez in #41 (comment)

What

In the retryable assertion toBeEmpty, it currently waits for a specific error message before it tries another strategy to work out whether the element is empty.

The preference would be to move this logic into k6 browser and allow it to deal with the internals of elements and their types.

I would be cautious how we add this to k6 browser. Currently there is no isEmpty API in k6 or Playwright, where we have taken a lot of inspiration from. If we implement isEmpty now, and PW create their own API called the same but it behaves differently, then how do we deal with such a situation? Do we export it as a new API that users can use in k6 browser or do we obfuscate it by calling it something like _isEmpty and not document the API, allowing us to break it if we need to and relying it only for the assertion library.

Why

The error message that is returned could accidentally be changed which would result in the tests correctly identifying whether an element is empty or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Sub-task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions