-
Notifications
You must be signed in to change notification settings - Fork 675
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
Visibility check should incorporate visibility of parent element(s) #3495
Comments
Thank you for the detailed description. I've reproduce the problem. |
For team: index.html <html>
<body>
<div>
<span data-test="checkbox">
<div style="display:none">
<svg viewBox="0 0 300 100" stroke="red" fill="grey">
<circle cx="50" cy="50" r="40" />
<circle cx="150" cy="50" r="4" />
</svg>
</div>
</span>
</div>
</body>
</html> test.js import { Selector } from 'testcafe';
fixture `Fixture`
.page('http://localhost:8080/index.html');
test('test', async t => {
const svg = Selector('[data-test=checkbox]').find('svg');
await t
.expect(svg.exists).ok()
.expect(svg.visible).notOk();
}); |
Hello was wondering if there's an update on this/should I expect a fix any time soon? |
Hello @adlantz , There are no updates yet. Once we have any news, we will post it here. |
In the meantime I've found a workaround that works for me. The code
will filter out any invisible elements selected by your selector. Then you could do something like
Ain't the prettiest solution but it does the deed. |
Hello @adlantz, Thank you for sharing your workaround. |
…hould incorporate visibility of parent SVG element(s)
…hould incorporate visibility of parent SVG element(s)
…hould incorporate visibility of parent SVG element(s)
Looking at the following example:
If I perform a visibility check on the svg my test fails.
.expect(Selector('[data-test="checkbox"]).find('svg').visible).notOk()
AssertionError: expected true to be falsy
I suspect this happens because the svg element itself does not have
display:none
or a width and height of 0. But the parent of the svg is invisible, therefore from a DOM perspective (and user perspective), the child elements of the div are also invisible.I would like to see that the visibility check incorporates the visibility of the parent element(s) of the tested element.
The text was updated successfully, but these errors were encountered: