e2e tests updated for future fixtures usage

This commit is contained in:
Carlos 2017-10-26 15:24:15 +02:00
parent ac8797f24d
commit bc1fef18f2
2 changed files with 20 additions and 24 deletions

View File

@ -11,8 +11,8 @@ Nightmare.action('login', function(done) {
try {
this.goto(`${config.url}auth/?apiKey=salix`)
.wait(selectors.login.textFieldInput)
.write(`${child(selectors.login.textFieldInput, 1)}`, 'nightmare')
.write(`${child(selectors.login.textFieldInput, 2)}`, 'nightmarePassword')
.write(`${child(selectors.login.textFieldInput, 1)}`, 'JessicaJones')
.write(`${child(selectors.login.textFieldInput, 2)}`, 'nightmare')
.click(selectors.login.submitButton)
.then(done);
} catch (err) {

View File

@ -5,8 +5,6 @@ import {catchErrors} from '../../services/utils/jasmineHelpers';
const nightmare = createNightmare();
const moduleAccessViewHashURL = '#!/';
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
describe('Clients path', () => {
it('should log in', done => {
nightmare
@ -32,10 +30,10 @@ describe('Clients path', () => {
.catch(catchErrors(done));
});
it(`should search for the user Bruce Wayne to confirm it isn't created yet`, done => {
it(`should search for the user Carol Danvers to confirm it isn't created yet`, done => {
nightmare
.wait(selectors.clientsView.searchResult)
.type(selectors.clientsView.searchClientInput, 'Bruce Wayne')
.type(selectors.clientsView.searchClientInput, 'Carol Danvers')
.click(selectors.clientsView.searchButton)
.waitForNumberOfElements(selectors.clientsView.searchResult, 0)
.countSearchResults(selectors.clientsView.searchResult)
@ -73,12 +71,12 @@ describe('Clients path', () => {
it('should receive an error when clicking the create button having all the form fields empty but name', done => {
nightmare
.waitForSnackbarReset()
.type(selectors.createClientView.name, 'Bruce Wayne')
.type(selectors.createClientView.name, 'Carol Danvers')
.click(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toContain(`Error:`);
expect(result).toContain(`Error: La instancia`);
done();
})
.catch(catchErrors(done));
@ -88,12 +86,12 @@ describe('Clients path', () => {
nightmare
.waitForSnackbarReset()
.clearInput(selectors.createClientView.name)
.type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number')
.type(selectors.createClientView.taxNumber, 'Avengers Tax Number')
.click(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toContain(`Error:`);
expect(result).toContain(`Error: La instancia`);
done();
})
.catch(catchErrors(done));
@ -103,12 +101,12 @@ describe('Clients path', () => {
nightmare
.waitForSnackbarReset()
.clearInput(selectors.createClientView.taxNumber)
.type(selectors.createClientView.businessName, 'Wayne Industries')
.type(selectors.createClientView.businessName, 'Avengers team')
.click(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toContain(`Error:`);
expect(result).toContain(`Error: La instancia`);
done();
})
.catch(catchErrors(done));
@ -118,12 +116,12 @@ describe('Clients path', () => {
nightmare
.waitForSnackbarReset()
.clearInput(selectors.createClientView.businessName)
.type(selectors.createClientView.userName, 'Batman')
.type(selectors.createClientView.userName, 'CaptainMarvel')
.click(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toContain(`Error:`);
expect(result).toContain(`Error: La instancia`);
done();
})
.catch(catchErrors(done));
@ -133,7 +131,7 @@ describe('Clients path', () => {
nightmare
.waitForSnackbarReset()
.clearInput(selectors.createClientView.userName)
.type(selectors.createClientView.email, 'I will save Gotham!')
.type(selectors.createClientView.email, 'I will save the Avengers!')
.click(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
@ -148,28 +146,26 @@ describe('Clients path', () => {
nightmare
.waitForSnackbarReset()
.clearInput(selectors.createClientView.email)
.type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham')
.type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
.click(selectors.createClientView.createButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toContain(`Error:`);
expect(result).toContain(`Error: La instancia`);
done();
})
.catch(catchErrors(done));
});
// this test should remain commented until the fixtures are implemented to avoid chainned failures.
// it(`should create a new user with all it's data`, done => {
// nightmare
// .wait(longWait)
// .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')
// .type(selectors.createClientView.name, 'Carol Danvers')
// .type(selectors.createClientView.taxNumber, 'Avengers Tax Number')
// .type(selectors.createClientView.businessName, 'Avengers Team')
// .type(selectors.createClientView.userName, 'CaptainMarvel')
// .type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
// .click(selectors.createClientView.createButton)
// .wait(6000)
// .wait(selectors.globalItems.snackbarIsActive)