waitForSnackbarReset extension and e2e client path refactor

This commit is contained in:
Carlos 2017-09-18 13:25:48 +02:00
parent c8323a97c3
commit e31e2269f8
2 changed files with 14 additions and 7 deletions

View File

@ -114,3 +114,10 @@ Nightmare.action('waitForNumberOfElements', function(selector, count, done) {
}, selectors.clientsView.searchResult, count)
.then(done);
});
Nightmare.action('waitForSnackbarReset', function(done) {
this.wait(() => {
return document.querySelector('vn-snackbar').innerText === '';
})
.then(done);
});

View File

@ -6,7 +6,7 @@ const nightmare = createNightmare();
let longWait = 3000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
// jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
describe('Clients path', () => {
it('should log in', done => {
@ -76,7 +76,7 @@ describe('Clients path', () => {
it('should receive an error when clicking the create button having all the form fields empty but name', done => {
nightmare
.wait(longWait)
.waitForSnackbarReset()
.type(selectors.createClientView.name, 'Bruce Wayne')
.click(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbarIsActive)
@ -90,7 +90,7 @@ describe('Clients path', () => {
it('should receive an error when clicking the create button having all the form fields empty but Tax Number', done => {
nightmare
.wait(longWait)
.waitForSnackbarReset()
.clearInput(selectors.createClientView.name)
.type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number')
.click(selectors.createClientView.createButton)
@ -105,7 +105,7 @@ describe('Clients path', () => {
it('should receive an error when clicking the create button having all the form fields empty but Business Name', done => {
nightmare
.wait(longWait)
.waitForSnackbarReset()
.clearInput(selectors.createClientView.taxNumber)
.type(selectors.createClientView.businessName, 'Wayne Industries')
.click(selectors.createClientView.createButton)
@ -120,7 +120,7 @@ describe('Clients path', () => {
it('should receive an error when clicking the create button having all the form fields empty but User Name', done => {
nightmare
.wait(longWait)
.waitForSnackbarReset()
.clearInput(selectors.createClientView.businessName)
.type(selectors.createClientView.userName, 'Batman')
.click(selectors.createClientView.createButton)
@ -135,7 +135,7 @@ describe('Clients path', () => {
it('should receive an error when clicking the create button having all the form fields empty but email while email have incorrect format', done => {
nightmare
.wait(longWait)
.waitForSnackbarReset()
.clearInput(selectors.createClientView.userName)
.type(selectors.createClientView.email, 'I will save Gotham!')
.click(selectors.createClientView.createButton)
@ -150,7 +150,7 @@ describe('Clients path', () => {
it('should receive an error when clicking the create button having all the form fields empty but email', done => {
nightmare
.wait(longWait)
.waitForSnackbarReset()
.clearInput(selectors.createClientView.email)
.type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham')
.click(selectors.createClientView.createButton)