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

Add queryElement (singular) API in addition to queryElements #1403

Closed
zcorpan opened this issue May 14, 2020 · 1 comment
Closed

Add queryElement (singular) API in addition to queryElements #1403

zcorpan opened this issue May 14, 2020 · 1 comment
Labels
regression-testing Related to AVA regression tests of example pages or AVA framework implementation within repo

Comments

@zcorpan
Copy link
Member

zcorpan commented May 14, 2020

In #1343 we added queryElements as a wrapper for WebDriver findElements, which would fail the test if no element was found.

In #1017 we tried to adopt this in the test for that PR, but there were multiple cases where it used findElement to get the first element. Using queryElements makes the test slightly slower (in theory) and the code more convoluted since it needs to get the first element of the resulting array.

  await (await t.context.queryElements(t, ex.buttonSelector))[0].sendKeys(Key.ENTER);

vs (proposed)

  await (await t.context.queryElement(t, ex.buttonSelector)).sendKeys(Key.ENTER);

cc @smhigley @jongund @nschonni

@zcorpan zcorpan added the regression-testing Related to AVA regression tests of example pages or AVA framework implementation within repo label May 14, 2020
@smhigley
Copy link
Contributor

Is this primarily for author convenience, so both functions have the same naming convention? I think we could just alias queryElement to findElement.

michael-n-cooper pushed a commit that referenced this issue Aug 21, 2020
Infrastructure: Add util queryElement function to regression test utils (pull #1486)

Fixes #1403 by adding a `queryElement` helper in /test/util.
This commit also replaces all the calls to `queryElements` with `queryElement` when only the first element is needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-testing Related to AVA regression tests of example pages or AVA framework implementation within repo
Projects
None yet
Development

No branches or pull requests

2 participants