small refactor on e2e clients path
This commit is contained in:
parent
7f6e9fc617
commit
aed228e2e2
|
@ -7,7 +7,7 @@ export default {
|
||||||
},
|
},
|
||||||
globalItems: {
|
globalItems: {
|
||||||
topBar: 'vn-topbar',
|
topBar: 'vn-topbar',
|
||||||
snackbar: 'body > vn-app > vn-vertical > vn-snackbar > div > div'
|
snackbarIsActive: '.mdl-snackbar--active > .mdl-snackbar__text'
|
||||||
},
|
},
|
||||||
moduleAccessView: {
|
moduleAccessView: {
|
||||||
clientsSectionButton: 'body > vn-app > vn-vertical > vn-vertical > vn-home > vn-vertical > vn-module-container > a:nth-child(1)'
|
clientsSectionButton: 'body > vn-app > vn-vertical > vn-vertical > vn-home > vn-vertical > vn-module-container > a:nth-child(1)'
|
||||||
|
|
|
@ -4,13 +4,15 @@ import selectors from '../helpers/selectors.js';
|
||||||
import {catchErrors} from '../../services/utils/jasmineHelpers';
|
import {catchErrors} from '../../services/utils/jasmineHelpers';
|
||||||
const nightmare = createNightmare();
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
|
let longWait = 3000;
|
||||||
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
||||||
|
|
||||||
describe('Clients path', () => {
|
describe('Clients path', () => {
|
||||||
it('should log in', done => {
|
it('should log in', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.login()
|
.login()
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.wait(selectors.globalItems.topBar)
|
.wait(selectors.globalItems.topBar)
|
||||||
.url()
|
.url()
|
||||||
.then(url => {
|
.then(url => {
|
||||||
|
@ -23,7 +25,7 @@ describe('Clients path', () => {
|
||||||
it('should access to the clients index by clicking the clients button', done => {
|
it('should access to the clients index by clicking the clients button', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.click(selectors.moduleAccessView.clientsSectionButton)
|
.click(selectors.moduleAccessView.clientsSectionButton)
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.wait(selectors.clientsView.createClientButton)
|
.wait(selectors.clientsView.createClientButton)
|
||||||
.url()
|
.url()
|
||||||
.then(url => {
|
.then(url => {
|
||||||
|
@ -36,7 +38,7 @@ describe('Clients path', () => {
|
||||||
it('should access to the create client view by clicking the create-client floating button', done => {
|
it('should access to the create client view by clicking the create-client floating button', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.click(selectors.clientsView.createClientButton)
|
.click(selectors.clientsView.createClientButton)
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.wait(selectors.createClientView.createButton)
|
.wait(selectors.createClientView.createButton)
|
||||||
.url()
|
.url()
|
||||||
.then(url => {
|
.then(url => {
|
||||||
|
@ -49,8 +51,8 @@ describe('Clients path', () => {
|
||||||
it('should receive an error when clicking the create button having all the form fields empty', done => {
|
it('should receive an error when clicking the create button having all the form fields empty', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.click(selectors.createClientView.createButton)
|
.click(selectors.createClientView.createButton)
|
||||||
.wait(selectors.globalItems.snackbar)
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
.getInnerText(selectors.globalItems.snackbar)
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
expect(result).toBe('No hay cambios que guardar');
|
expect(result).toBe('No hay cambios que guardar');
|
||||||
done();
|
done();
|
||||||
|
@ -60,12 +62,11 @@ describe('Clients path', () => {
|
||||||
|
|
||||||
it('should receive an error when clicking the create button having all the form fields empty but name', done => {
|
it('should receive an error when clicking the create button having all the form fields empty but name', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.type(selectors.createClientView.name, 'Bruce Wayne')
|
.type(selectors.createClientView.name, 'Bruce Wayne')
|
||||||
.click(selectors.createClientView.createButton)
|
.click(selectors.createClientView.createButton)
|
||||||
.wait(200)
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
.wait(selectors.globalItems.snackbar)
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
.getInnerText(selectors.globalItems.snackbar)
|
|
||||||
.then(result => {
|
.then(result => {
|
||||||
expect(result).toContain(`Error:`);
|
expect(result).toContain(`Error:`);
|
||||||
done();
|
done();
|
||||||
|
@ -75,13 +76,12 @@ describe('Clients path', () => {
|
||||||
|
|
||||||
it('should receive an error when clicking the create button having all the form fields empty but Tax Number', done => {
|
it('should receive an error when clicking the create button having all the form fields empty but Tax Number', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.clearInput(selectors.createClientView.name)
|
.clearInput(selectors.createClientView.name)
|
||||||
.type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number')
|
.type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number')
|
||||||
.click(selectors.createClientView.createButton)
|
.click(selectors.createClientView.createButton)
|
||||||
.wait(200)
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
.wait(selectors.globalItems.snackbar)
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
.getInnerText(selectors.globalItems.snackbar)
|
|
||||||
.then(result => {
|
.then(result => {
|
||||||
expect(result).toContain(`Error:`);
|
expect(result).toContain(`Error:`);
|
||||||
done();
|
done();
|
||||||
|
@ -91,13 +91,12 @@ describe('Clients path', () => {
|
||||||
|
|
||||||
it('should receive an error when clicking the create button having all the form fields empty but Business Name', done => {
|
it('should receive an error when clicking the create button having all the form fields empty but Business Name', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.clearInput(selectors.createClientView.taxNumber)
|
.clearInput(selectors.createClientView.taxNumber)
|
||||||
.type(selectors.createClientView.businessName, 'Wayne Industries')
|
.type(selectors.createClientView.businessName, 'Wayne Industries')
|
||||||
.click(selectors.createClientView.createButton)
|
.click(selectors.createClientView.createButton)
|
||||||
.wait(200)
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
.wait(selectors.globalItems.snackbar)
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
.getInnerText(selectors.globalItems.snackbar)
|
|
||||||
.then(result => {
|
.then(result => {
|
||||||
expect(result).toContain(`Error:`);
|
expect(result).toContain(`Error:`);
|
||||||
done();
|
done();
|
||||||
|
@ -107,13 +106,12 @@ describe('Clients path', () => {
|
||||||
|
|
||||||
it('should receive an error when clicking the create button having all the form fields empty but User Name', done => {
|
it('should receive an error when clicking the create button having all the form fields empty but User Name', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.clearInput(selectors.createClientView.businessName)
|
.clearInput(selectors.createClientView.businessName)
|
||||||
.type(selectors.createClientView.userName, 'Batman')
|
.type(selectors.createClientView.userName, 'Batman')
|
||||||
.click(selectors.createClientView.createButton)
|
.click(selectors.createClientView.createButton)
|
||||||
.wait(200)
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
.wait(selectors.globalItems.snackbar)
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
.getInnerText(selectors.globalItems.snackbar)
|
|
||||||
.then(result => {
|
.then(result => {
|
||||||
expect(result).toContain(`Error:`);
|
expect(result).toContain(`Error:`);
|
||||||
done();
|
done();
|
||||||
|
@ -123,13 +121,12 @@ 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 => {
|
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
|
nightmare
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.clearInput(selectors.createClientView.userName)
|
.clearInput(selectors.createClientView.userName)
|
||||||
.type(selectors.createClientView.email, 'I will save Gotham!')
|
.type(selectors.createClientView.email, 'I will save Gotham!')
|
||||||
.click(selectors.createClientView.createButton)
|
.click(selectors.createClientView.createButton)
|
||||||
.wait(200)
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
.wait(selectors.globalItems.snackbar)
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
.getInnerText(selectors.globalItems.snackbar)
|
|
||||||
.then(result => {
|
.then(result => {
|
||||||
expect(result).toBe(`Algunos campos no son válidos`);
|
expect(result).toBe(`Algunos campos no son válidos`);
|
||||||
done();
|
done();
|
||||||
|
@ -139,13 +136,12 @@ describe('Clients path', () => {
|
||||||
|
|
||||||
it('should receive an error when clicking the create button having all the form fields empty but email', done => {
|
it('should receive an error when clicking the create button having all the form fields empty but email', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.wait(3000)
|
.wait(longWait)
|
||||||
.clearInput(selectors.createClientView.email)
|
.clearInput(selectors.createClientView.email)
|
||||||
.type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham')
|
.type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham')
|
||||||
.click(selectors.createClientView.createButton)
|
.click(selectors.createClientView.createButton)
|
||||||
.wait(200)
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
.wait(selectors.globalItems.snackbar)
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
.getInnerText(selectors.globalItems.snackbar)
|
|
||||||
.then(result => {
|
.then(result => {
|
||||||
expect(result).toContain(`Error:`);
|
expect(result).toContain(`Error:`);
|
||||||
done();
|
done();
|
||||||
|
@ -157,7 +153,7 @@ describe('Clients path', () => {
|
||||||
|
|
||||||
// it('should receive an error when clicking the create button having all the form fields empty but email', done => {
|
// it('should receive an error when clicking the create button having all the form fields empty but email', done => {
|
||||||
// nightmare
|
// nightmare
|
||||||
// .wait(3000)
|
// .wait(longWait)
|
||||||
// .clearInput(selectors.createClientView.email)
|
// .clearInput(selectors.createClientView.email)
|
||||||
// .type(selectors.createClientView.name, 'Bruce Wayne')
|
// .type(selectors.createClientView.name, 'Bruce Wayne')
|
||||||
// .type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number')
|
// .type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number')
|
||||||
|
@ -166,8 +162,8 @@ describe('Clients path', () => {
|
||||||
// .type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham')
|
// .type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham')
|
||||||
// .click(selectors.createClientView.createButton)
|
// .click(selectors.createClientView.createButton)
|
||||||
// .wait(6000)
|
// .wait(6000)
|
||||||
// .wait(selectors.globalItems.snackbar)
|
// .wait(selectors.globalItems.snackbarIsActive)
|
||||||
// .getInnerText(selectors.globalItems.snackbar)
|
// .getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
// .then(result => {
|
// .then(result => {
|
||||||
// expect(result).toContain(`some validation message`);
|
// expect(result).toContain(`some validation message`);
|
||||||
// done();
|
// done();
|
||||||
|
|
Loading…
Reference in New Issue