clients path refactor, intermitent errors should be fixed pending tests on windows environment.
This commit is contained in:
parent
700be7c5a6
commit
e68c05d9f1
|
@ -1,7 +1,6 @@
|
||||||
import config from './config.js';
|
import config from './config.js';
|
||||||
import Nightmare from 'nightmare';
|
import Nightmare from 'nightmare';
|
||||||
import selectors from './selectors.js';
|
import selectors from './selectors.js';
|
||||||
const components = selectors.components;
|
|
||||||
|
|
||||||
function child(selector, childNumber) {
|
function child(selector, childNumber) {
|
||||||
let aux = selector.split(' ');
|
let aux = selector.split(' ');
|
||||||
|
@ -11,10 +10,9 @@ function child(selector, childNumber) {
|
||||||
Nightmare.action('login', function(done) {
|
Nightmare.action('login', function(done) {
|
||||||
try {
|
try {
|
||||||
this.goto(`${config.url}auth/?apiKey=salix`)
|
this.goto(`${config.url}auth/?apiKey=salix`)
|
||||||
.wait(`${components.textFieldInput}`)
|
.write(`${child(selectors.login.textFieldInput, 1)}`, 'nightmare')
|
||||||
.write(`${child(components.textFieldInput, 1)}`, 'nightmare')
|
.write(`${child(selectors.login.textFieldInput, 2)}`, 'nightmarePassword')
|
||||||
.write(`${child(components.textFieldInput, 2)}`, 'nithmarePassword')
|
.click(selectors.login.submitButton)
|
||||||
.click(components.submitButton)
|
|
||||||
.then(done);
|
.then(done);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
@ -40,7 +38,7 @@ Nightmare.action('clearInput', function(selector, done) {
|
||||||
|
|
||||||
Nightmare.action('write', function(selector, text, done) {
|
Nightmare.action('write', function(selector, text, done) {
|
||||||
this.wait(selector)
|
this.wait(selector)
|
||||||
.insert(selector, text)
|
.type(selector, text)
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,27 @@
|
||||||
// eslint max-len: ["error", 500]
|
// eslint max-len: ["error", 500]
|
||||||
// eslint key-spacing: ["error", 500]
|
// eslint key-spacing: ["error", 500]
|
||||||
export default {
|
export default {
|
||||||
components: {
|
login: {
|
||||||
textFieldInput: 'vn-textfield > div > input',
|
textFieldInput: 'vn-textfield > div > input',
|
||||||
topBar: 'vn-topbar',
|
|
||||||
submitButton: 'vn-submit > input[type="submit"]'
|
submitButton: 'vn-submit > input[type="submit"]'
|
||||||
|
},
|
||||||
|
globalItems: {
|
||||||
|
topBar: 'vn-topbar',
|
||||||
|
snackbar: 'body > vn-app > vn-vertical > vn-snackbar > div > div'
|
||||||
|
},
|
||||||
|
moduleAccessView: {
|
||||||
|
clientsSectionButton: 'body > vn-app > vn-vertical > vn-vertical > vn-home > vn-vertical > vn-module-container > a:nth-child(1)'
|
||||||
|
},
|
||||||
|
clientsView: {
|
||||||
|
createClientButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > a > vn-float-button > button'
|
||||||
|
},
|
||||||
|
createClientView: {
|
||||||
|
name: 'body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-textfield:nth-child(1) > div > input',
|
||||||
|
taxNumber: 'body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-textfield:nth-child(2) > div > input',
|
||||||
|
BusinessName: 'body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-textfield:nth-child(3) > div > input',
|
||||||
|
UserName: 'body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-textfield:nth-child(4) > div > input',
|
||||||
|
email: 'body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-textfield:nth-child(5) > div > input',
|
||||||
|
createButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-button-bar > vn-button > button'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
import config from '../helpers/config.js';
|
import config from '../helpers/config.js';
|
||||||
import createNightmare from '../helpers/nightmare';
|
import createNightmare from '../helpers/nightmare';
|
||||||
import selectors from '../helpers/selectors.js';
|
import selectors from '../helpers/selectors.js';
|
||||||
let components = selectors.components;
|
import {catchErrors} from '../../services/utils/jasmineHelpers';
|
||||||
|
|
||||||
const nightmare = createNightmare();
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
|
||||||
|
|
||||||
describe('Clients path', () => {
|
describe('Clients path', () => {
|
||||||
it('should log in', done => {
|
it('should log in', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.login()
|
.login()
|
||||||
.wait(2000)
|
.wait(200)
|
||||||
|
.wait(selectors.globalItems.topBar)
|
||||||
.url()
|
.url()
|
||||||
.then(url => {
|
.then(url => {
|
||||||
expect(url).toBe(config.url + '#!/');
|
expect(url).toBe(config.url + '#!/');
|
||||||
done();
|
done();
|
||||||
});
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
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('body > vn-app > vn-vertical > vn-vertical > vn-home > vn-vertical > vn-module-container > a:nth-child(1)')
|
.click(selectors.moduleAccessView.clientsSectionButton)
|
||||||
.wait(1000)
|
.wait(selectors.clientsView.createClientButton)
|
||||||
.url()
|
.url()
|
||||||
.then(url => {
|
.then(url => {
|
||||||
expect(url).toBe(config.url + '#!/clients');
|
expect(url).toBe(config.url + '#!/clients');
|
||||||
done();
|
done();
|
||||||
});
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should access to the create client by clicking the create-client button', done => {
|
it('should access to the create client view by clicking the create-client floating button', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.click('body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > a')
|
.click(selectors.clientsView.createClientButton)
|
||||||
.wait(1000)
|
.wait()
|
||||||
.url()
|
.url()
|
||||||
.then(url => {
|
.then(url => {
|
||||||
expect(url).toBe(config.url + '#!/create');
|
expect(url).toBe(config.url + '#!/create');
|
||||||
|
@ -43,9 +43,9 @@ 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('body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-button-bar > vn-button > button')
|
.click(selectors.createClientView.createButton)
|
||||||
.wait('body > vn-app > vn-vertical > vn-snackbar > div > div')
|
.wait(selectors.globalItems.snackbar)
|
||||||
.getInnerText('body > vn-app > vn-vertical > vn-snackbar > div > div')
|
.getInnerText(selectors.globalItems.snackbar)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
expect(result).toBe('No hay cambios que guardar');
|
expect(result).toBe('No hay cambios que guardar');
|
||||||
done();
|
done();
|
||||||
|
|
Loading…
Reference in New Issue