Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to specify a Negative Context #290

Open
cowboyd opened this issue Sep 17, 2024 · 0 comments
Open

Ability to specify a Negative Context #290

cowboyd opened this issue Sep 17, 2024 · 0 comments

Comments

@cowboyd
Copy link
Member

cowboyd commented Sep 17, 2024

I ran into a situation when using interactors on a project where there were two instances of a component on screen. One that was inside a TabPane, and one that was not. Let's call the component C

The containment hierarchy was:

- Parent
  - C()
  - Tabs()
    - C()

It is possible in this scenario to To interact with C(2) unambiguously, via:

Tabs().find(C())

But it is NOT possible to interact with C(1) unambiguously because there is no context you can specify in which C(2) is not also in that context.

There are a couple of workarounds:

  1. Create a filter on the DOM order, and use it to disambiguate
  2. Create standalone filter on C() to see if it was in a tab pane, or not.

But these are not ideal because neither of these filters are stable over time.

Ideally, we'd like to have a "negative context" specifier to say that I want to interact with C not within the context of Tabs:

C().outside(Tabs()).click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant