question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`find` and `findAll` should allow for finding elements outside the root

See original GitHub issue

When dealing with addons like ember-pikaday or ember-wormhole, it can be useful to allow for locating an element outside the root element of the test.

My proposal would be to allow a second parameter, like qunit-dom, that allows you to override the “root element” to search.

If this is something you’d be interested in supporting, I’m happy to make a PR for it!

Note: I’m not suggesting we add the root-override behavior to all helpers; it’s easy enough to, for example, compose two together if you need to click something outside the root:

const button = await find('.some-button', document.body);
await click(button);

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
rwjbluecommented, Oct 9, 2018

Hmm, why is a change needed here? What would adding a context parameter provide that “using the platform” doesn’t?

const button = document.querySelector('.some-button');
await click(button);
1reaction
cibernoxcommented, Oct 12, 2018

Although this was closed I’d like to provide a reason why by default the test helpers should be scoped to the testing container, is that QUnit is working in parallel execution: https://twitter.com/trentmwillis/status/1050519960689115136

Having test selectors scoped to the testing containers puts us on a good position to have several test containers running different tests at the same time, each one triggering events and performing assertions on their own app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use lxml to find an element by text? - Stack Overflow
Right. find / findAll are simplified methods which do not allow all kinds of XPath. With the current version of lxml, xpath accepts ......
Read more >
Finding web elements - Selenium
One solution is to locate an element with a unique attribute that is an ancestor of the desired element and not an ancestor...
Read more >
xml.etree.ElementTree — The ElementTree XML API ...
Therefore, the example first collects all matching elements with root.findall() , and only then iterates over the list of matches. Our XML now...
Read more >
find | Cypress Documentation
Get the descendent DOM elements of a specific selector. The querying behavior of this command matches exactly how .find() works in jQuery. Syntax...
Read more >
How To Find HTML Elements Using Cypress Locators
In this Cypress tutorial, we will learn to use Cypress locators to access WebElements in the DOM for realizing Cypress automation tests.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found