validations bug of add consignee fixed plus e2e greuge path tests
This commit is contained in:
parent
f6314d0c2b
commit
5f1c0a0e5a
|
@ -2,7 +2,7 @@ import {validator} from 'vendor';
|
||||||
|
|
||||||
export const validators = {
|
export const validators = {
|
||||||
presence: value => {
|
presence: value => {
|
||||||
if (validator.isEmpty(value.toString()))
|
if (validator.isEmpty(value ? String(value) : ''))
|
||||||
throw new Error(`Value can't be empty`);
|
throw new Error(`Value can't be empty`);
|
||||||
},
|
},
|
||||||
absence: value => {
|
absence: value => {
|
||||||
|
|
|
@ -4,11 +4,11 @@ import Nightmare from 'nightmare';
|
||||||
export default function createNightmare(width = 1280, height = 720) {
|
export default function createNightmare(width = 1280, height = 720) {
|
||||||
const nightmare = new Nightmare({show: true, typeInterval: 10, x: 0, y: 0}).viewport(width, height);
|
const nightmare = new Nightmare({show: true, typeInterval: 10, x: 0, y: 0}).viewport(width, height);
|
||||||
|
|
||||||
nightmare.on('page', function(type, message, error) {
|
nightmare.on('page', (type, message, error) => {
|
||||||
fail(error);
|
fail(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
nightmare.on('console', function(type, message) {
|
nightmare.on('console', (type, message) => {
|
||||||
if (type === 'error') {
|
if (type === 'error') {
|
||||||
fail(message);
|
fail(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ export default {
|
||||||
greuge: {
|
greuge: {
|
||||||
greugeButton: `${components.vnMenuItem}[ui-sref="clientCard.greuge.list"]`,
|
greugeButton: `${components.vnMenuItem}[ui-sref="clientCard.greuge.list"]`,
|
||||||
addGreugeFloatButton: `${components.vnFloatButton}`,
|
addGreugeFloatButton: `${components.vnFloatButton}`,
|
||||||
amountInput: `${components.vnTextfield}[name="Amount"]`,
|
amountInput: `${components.vnTextfield}[name="amount"]`,
|
||||||
descriptionInput: `${components.vnTextfield}[name="Description"]`,
|
descriptionInput: `${components.vnTextfield}[name="Description"]`,
|
||||||
typeInput: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > ${components.vnTextfield}`,
|
typeInput: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > ${components.vnTextfield}`,
|
||||||
typeSecondOption: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-auto:nth-child(2) > ul > li`,
|
typeSecondOption: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-auto:nth-child(2) > ul > li`,
|
||||||
|
|
|
@ -108,18 +108,18 @@ describe('Add greuge path', () => {
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
// it(`should receive an error if all fields are empty but date and amount on submit`, done => {
|
it(`should receive an error if all fields are empty but date and amount on submit`, done => {
|
||||||
// nightmare
|
nightmare
|
||||||
// .type(selectors.greuge.amountInput, 999)
|
.type(selectors.greuge.amountInput, 999)
|
||||||
// .click(selectors.credit.saveButton)
|
.click(selectors.greuge.saveButton)
|
||||||
// .wait(selectors.globalItems.snackbarIsActive)
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
// .getInnerText(selectors.globalItems.snackbarIsActive)
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
// .then(result => {
|
.then(result => {
|
||||||
// expect(result).toContain('Error');
|
expect(result).toContain('Some fields are invalid');
|
||||||
// done();
|
done();
|
||||||
// })
|
})
|
||||||
// .catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
// });
|
});
|
||||||
|
|
||||||
// it(`should receive an error if all fields are empty but date and amount on submit`, done => {
|
// it(`should receive an error if all fields are empty but date and amount on submit`, done => {
|
||||||
// nightmare
|
// nightmare
|
||||||
|
|
Loading…
Reference in New Issue