I'm writing Protractor tests in Angular, and I would like to check that a directive has rendered correctly, but I'm not sure of the best way to do it in Protractor syntax.
This is what my rendered HTML looks like:
<div faqs-widget="" class="ng-scope">
<h1 class="ng-binding">My FAQs</h1>
<ul>
<!-- ngRepeat: question in data -->
<li ng-repeat="question in data" class="ng-scope ng-binding">A question</li>
<!-- end ngRepeat: question in data -->
</ul>
</div>
So ideally I'd like to check at least that there is a div
with a faqs-widget
property. How can I do this?
(PS: advice on what else I should test is also welcome.)
this sounds like a unit test, but u can do it in protractor,
ptor.findElement(protractor.by.css('div[faqs-widget]').isElementPresent().then(function(v){
expect(v).toBe(true);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With