showtime
Test framework.
Interact with your app as a user would.
prevent undefined layout due responsive
browser
.driver
.manage()
.window()
.setSize(1280, 1024)
simplify promises
ExpectedConditions API
no sleeps!
waitUntilReady() {
return browser.wait(
ExpectedConditions
.visibilityOf(element(by.css(this.readyElement))),
15000
)
}
readyElement = '[data-hook="ready"]'
title = '[data-hook="title"]'
mobileData = '[data-hook="mobiledata"]'
readyElement = '.left-content thor-button'
title = 'thor-tariff-landing h1'
mobileData = '.tariff-info .overview-list li:first-child strong'
before
after
by.addLocator('dataHook', (hook, optParentElement, optRootSelector) => {
const using = optParentElement ||
document.querySelector(optRootSelector) ||
document;
return using.querySelector('[data-hook=\'' + hook + '\']');
});
// ...
readyElement = 'readyElement'
element(by.dataHook(this.readyElement))
run specific set of specs
paralelize!
ng e2e --suite=tariffdetail
protractor protractor.conf.js --suite tariffdetail
// protractor.conf.js
{
...
suites: {
regresion: ['e2e/regresion/**/*.e2e-spec.ts'],
slow: ['e2e/slow/**/*.e2e-spec.ts'],
main: ['e2e/main/**/*.e2e-spec.ts'],
...
tariffs: ['e2e/tariffs/**/*.e2e-spec.ts'],
checkout: ['e2e/checkout/**/*.e2e-spec.ts'],
checkoutv2: ['e2e/checkoutv2/**/*.e2e-spec.ts'],
},
...
}
run specific set of specs
regex filter
protractor protractor.conf.js --grep #sanity
describe('For any test suite', () => {
it(
'you can filter with grep by #several #tags #names'
, () => {}
)
})
anthanh@etereo.io