client path tests catch errores and user creatin inactive test. now waiting for fixtures to enable.

This commit is contained in:
Carlos 2017-09-17 20:43:55 +02:00
parent 639c7e901e
commit 0a900fbb80
1 changed files with 44 additions and 14 deletions

View File

@ -42,7 +42,8 @@ describe('Clients path', () => {
.then(url => {
expect(url).toBe(config.url + '#!/create');
done();
});
})
.catch(catchErrors(done));
});
it('should receive an error when clicking the create button having all the form fields empty', done => {
@ -53,7 +54,8 @@ describe('Clients path', () => {
.then(result => {
expect(result).toBe('No hay cambios que guardar');
done();
});
})
.catch(catchErrors(done));
});
it('should receive an error when clicking the create button having all the form fields empty but name', done => {
@ -61,13 +63,14 @@ describe('Clients path', () => {
.wait(3000)
.type(selectors.createClientView.name, 'Bruce Wayne')
.click(selectors.createClientView.createButton)
.wait(100)
.wait(200)
.wait(selectors.globalItems.snackbar)
.getInnerText(selectors.globalItems.snackbar)
.then(result => {
expect(result).toContain(`Error:`);
done();
});
})
.catch(catchErrors(done));
});
it('should receive an error when clicking the create button having all the form fields empty but Tax Number', done => {
@ -76,13 +79,14 @@ describe('Clients path', () => {
.clearInput(selectors.createClientView.name)
.type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number')
.click(selectors.createClientView.createButton)
.wait(100)
.wait(200)
.wait(selectors.globalItems.snackbar)
.getInnerText(selectors.globalItems.snackbar)
.then(result => {
expect(result).toContain(`Error:`);
done();
});
})
.catch(catchErrors(done));
});
it('should receive an error when clicking the create button having all the form fields empty but Business Name', done => {
@ -91,13 +95,14 @@ describe('Clients path', () => {
.clearInput(selectors.createClientView.taxNumber)
.type(selectors.createClientView.businessName, 'Wayne Industries')
.click(selectors.createClientView.createButton)
.wait(100)
.wait(200)
.wait(selectors.globalItems.snackbar)
.getInnerText(selectors.globalItems.snackbar)
.then(result => {
expect(result).toContain(`Error:`);
done();
});
})
.catch(catchErrors(done));
});
it('should receive an error when clicking the create button having all the form fields empty but User Name', done => {
@ -106,13 +111,14 @@ describe('Clients path', () => {
.clearInput(selectors.createClientView.businessName)
.type(selectors.createClientView.userName, 'Batman')
.click(selectors.createClientView.createButton)
.wait(100)
.wait(200)
.wait(selectors.globalItems.snackbar)
.getInnerText(selectors.globalItems.snackbar)
.then(result => {
expect(result).toContain(`Error:`);
done();
});
})
.catch(catchErrors(done));
});
it('should receive an error when clicking the create button having all the form fields empty but email while email have incorrect format', done => {
@ -121,13 +127,14 @@ describe('Clients path', () => {
.clearInput(selectors.createClientView.userName)
.type(selectors.createClientView.email, 'I will save Gotham!')
.click(selectors.createClientView.createButton)
.wait(100)
.wait(200)
.wait(selectors.globalItems.snackbar)
.getInnerText(selectors.globalItems.snackbar)
.then(result => {
expect(result).toBe(`Algunos campos no son válidos`);
done();
});
})
.catch(catchErrors(done));
});
it('should receive an error when clicking the create button having all the form fields empty but email', done => {
@ -136,12 +143,35 @@ describe('Clients path', () => {
.clearInput(selectors.createClientView.email)
.type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham')
.click(selectors.createClientView.createButton)
.wait(100)
.wait(200)
.wait(selectors.globalItems.snackbar)
.getInnerText(selectors.globalItems.snackbar)
.then(result => {
expect(result).toContain(`Error:`);
done();
})
.catch(catchErrors(done));
});
});
// this test should remain commented until the fixtures are implemented to avoid chainned failures.
// it('should receive an error when clicking the create button having all the form fields empty but email', done => {
// nightmare
// .wait(3000)
// .clearInput(selectors.createClientView.email)
// .type(selectors.createClientView.name, 'Bruce Wayne')
// .type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number')
// .type(selectors.createClientView.businessName, 'Wayne Industries')
// .type(selectors.createClientView.userName, 'Batman')
// .type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham')
// .click(selectors.createClientView.createButton)
// .wait(6000)
// .wait(selectors.globalItems.snackbar)
// .getInnerText(selectors.globalItems.snackbar)
// .then(result => {
// expect(result).toContain(`some validation message`);
// done();
// })
// .catch(catchErrors(done));
// });
});