E2E testing - rlasjunies/kct GitHub Wiki

how to run

package.json is the reference

Protractor selectors

extract and correction from this link

$ and $$ are shortcuts provided by protractor to replace element(by.css('#some-id')) and element.all(by.css('some-tag'))

$('#some-id')                // element(by.id())
$('.some-class')             // element(by.className())
$('tag-name')                // element(by.tagName())
$('[ng-message=required]')   // remember to leave out the double quotes around the value of attribute
$('#parent #child')          // select one child inside parent
$$('ul li')                   // select all children inside parent
$$('ul li').first()           // select first of children
$$('ul li').last()            // select last of children
$$('ul li').get(index)        // select index-th of children

some other interesting selectors:

element(by.model('data'));
element(by.repeater('cat in pets'));
element(by.options('c for c in colors'))
element(by.binding('value'));           // only look through the elements with ng-binding attribute
element(by.buttonText('Save'));         // the whole of button text
element(by.partialButtonText('Save'));  // part of button text
element(by.cssContainingText('.pet', 'Dog')) // for selecting this: <li class="pet">Dog</li>
element(by.deepCss('span'))             // for selecting all level of spans <span><span>x</span></span>

links to found a way to do code coverage on E2E tests

Code coverage with E2E tests

https://medium.com/@the1mills/front-end-javascript-test-coverage-with-istanbul-selenium-4b2be44e3e98

https://github.com/ORESoftware/express-istanbul

https://github.com/gotwarlost/istanbul-middleware https://github.com/gotwarlost/istanbul/issues/132

https://github.com/mahuntington/e2e-istanbul

https://www.jujens.eu/posts/en/2015/Sep/25/code-coverage-istanbul-protractor/

https://www.npmjs.com/package/grunt-protractor-coverage https://github.com/bennyhat/protractor-istanbul-plugin

taking screenshots

http://blog.ng-book.com/taking-screenshots-with-protractor/

⚠️ **GitHub.com Fallback** ⚠️