now each e2e path calls it's own loging function for dev to use differente users

This commit is contained in:
Carlos Jimenez 2018-03-02 12:15:17 +01:00
parent d3e2f93816
commit 326d762cd1
21 changed files with 103 additions and 12 deletions

View File

@ -2,10 +2,10 @@ import config from './config.js';
import Nightmare from 'nightmare';
import {URL} from 'url';
Nightmare.action('login', function(done) {
Nightmare.action('login', function(userName, done) {
this.goto(`${config.url}auth/?apiKey=salix`)
.wait(`vn-login input[name=user]`)
.write(`vn-login input[name=user]`, 'developer')
.write(`vn-login input[name=user]`, userName)
.write(`vn-login input[name=password]`, 'nightmare')
.click(`vn-login input[type=submit]`)
// FIXME: Wait for dom to be ready: https://github.com/segmentio/nightmare/issues/481
@ -29,8 +29,8 @@ Nightmare.action('changeLanguageToEnglish', function(done) {
});
});
Nightmare.action('waitForLogin', function(done) {
this.login()
Nightmare.action('waitForLogin', function(userName, done) {
this.login(userName)
.waitForURL('#!/')
.url()
.changeLanguageToEnglish()

View File

@ -5,11 +5,6 @@ function myCreateNightmare() {
let nightmare = createNightmare();
nightmare.header('Accept-Language', 'en');
beforeAll(() => {
return nightmare
.waitForLogin();
});
afterAll(() => {
return nightmare
.end();

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('create client path', () => {
let nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the clients index by clicking the clients button', () => {
return nightmare
.click(selectors.moduleAccessView.clientsSectionButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Edit basicData path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -1,9 +1,14 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Edit fiscalData path', () => {
fdescribe('Edit fiscalData path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
@ -354,7 +359,7 @@ describe('Edit fiscalData path', () => {
});
});
it('should confirm Verified data checkbox is unchecked', () => {
it('should confirm Verified data checkbox is checked', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
@ -364,7 +369,7 @@ describe('Edit fiscalData path', () => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
.then(value => {
expect(value).toBeFalsy();
expect(value).toBeTruthy();
});
});

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Edit pay method path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Add address path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Add address notes path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Edit web access path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Add notes path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Add credit path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Add greuge path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('mandate path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('Item summary path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('edit item basic data path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('add item tax path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('create item tags path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('create item niche path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('create item botanical path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)

View File

@ -4,6 +4,11 @@ import createNightmare from '../../helpers/helpers';
describe('create item barcodes path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)

View File

@ -3,6 +3,12 @@ import createNightmare from '../../helpers/helpers';
describe('Item', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
describe('create path', () => {
it('should access to the items index by clicking the items button', () => {
return nightmare