forcedotcom / LightningTestingService

Apache License 2.0
122 stars 35 forks source link

Is element visible - component.find("name").getElement() doesn't work #20

Closed rsoesemann closed 7 years ago

rsoesemann commented 7 years ago

I need to find if a

is hidden after component load and tried to use component.find("name").getElement().visiblity but failed. The root cause is described here: https://salesforce.stackexchange.com/questions/127307/component-find-getelement-not-working-after-summer-16-release

How else do I do such tests?

esalman-sfdc commented 7 years ago

This restriction is being enforced by locker service with details on why described in the linked post already.

In context of testing, I believe its actually saving us from writing brittle tests which could fail in future (maintenance cost) as the components belonging to other namespaces evolve (DOM shape is not part of API/interface). That said, I do agree that it may impact the upfront cost by having component/test author think harder about asserts.

For Example: What does your code/component do that results in component from another namespace hide an element it was rendering. May be we could focus on having the test assert on the action taken by your code.