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

make THEN step for visibility ignore irrelevant invisible elements #66

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

dagroe
Copy link

@dagroe dagroe commented Aug 12, 2022

Short:
when checking that COUNT elements are in/visible do not check the count of all found element but rather the count of those that are visible or invisible. This also allows to combine providing the COUNT with using the NOT option, e.g. Then 10 elements should not be visible.

Long:
I came across a scenario where one of multiple elements would be visible, e.g.

<BsCollapse @collapsed={{true}}>
  <div data-test-my-element>
    abc123
  </div>
</BsCollapse>
<BsCollapse @collapsed={{false}}>
  <div data-test-my-element>
    abc123
  </div>
</BsCollapse>

the following steps would fail:

Then I should see 1 MyElement
Then 1 MyElement should be visible

They would fail due to the check of collection count before getting to the check for actual visibility

"Then (?:(\\d+) )?$opinionatedElement should (not |NOT )?be visible"(countRaw, [collection/* , label, selector */], no) {
    assert(`Don't use NOT and number at the same time`, !(no && countRaw));

    let count =
      no       ? 0                      :
      countRaw ? parseInt(countRaw, 10) :
                 1;

    let m = `Element count`;
    expect(collection, m).to.have.length(count);

    collection.forEach((element, i) => {
      m = `Element #${i} (zero-indexed) visibility`;
      expect(isVisible(element), m).to.be.true;
    });
  }

So I suppose one can ignore the actual collection length but rather check the count based on each element's visibility.

when checking that COUNT elements are in/visible do not check the count of all found element but rather the count of those that are visible or invisible. This also allows to combine providing the COUNT with using the NOT option, e.g. `then 10 elements should not be visible`.
@dagroe
Copy link
Author

dagroe commented Aug 26, 2022

@lolmaus @simonihmig could you review this? Should I create an issue first?

Daniel Gröger and others added 6 commits September 22, 2022 20:41
make THEN step for visibility ignore irrelevant invisible elements
Treat aria-disabled=false as enabled for power-select trigger
when checking that COUNT elements are in/visible do not check the count of all found element but rather the count of those that are visible or invisible. This also allows to combine providing the COUNT with using the NOT option, e.g. `then 10 elements should not be visible`.

(cherry picked from commit 1157405)
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

Successfully merging this pull request may close these issues.

2 participants