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 = {
|
||||
presence: value => {
|
||||
if (validator.isEmpty(value.toString()))
|
||||
if (validator.isEmpty(value ? String(value) : ''))
|
||||
throw new Error(`Value can't be empty`);
|
||||
},
|
||||
absence: value => {
|
||||
|
|
|
@ -4,11 +4,11 @@ import Nightmare from 'nightmare';
|
|||
export default function createNightmare(width = 1280, height = 720) {
|
||||
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);
|
||||
});
|
||||
|
||||
nightmare.on('console', function(type, message) {
|
||||
nightmare.on('console', (type, message) => {
|
||||
if (type === 'error') {
|
||||
fail(message);
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ export default {
|
|||
greuge: {
|
||||
greugeButton: `${components.vnMenuItem}[ui-sref="clientCard.greuge.list"]`,
|
||||
addGreugeFloatButton: `${components.vnFloatButton}`,
|
||||
amountInput: `${components.vnTextfield}[name="Amount"]`,
|
||||
amountInput: `${components.vnTextfield}[name="amount"]`,
|
||||
descriptionInput: `${components.vnTextfield}[name="Description"]`,
|
||||
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`,
|
||||
|
|
|
@ -108,18 +108,18 @@ describe('Add greuge path', () => {
|
|||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
// it(`should receive an error if all fields are empty but date and amount on submit`, done => {
|
||||
// nightmare
|
||||
// .type(selectors.greuge.amountInput, 999)
|
||||
// .click(selectors.credit.saveButton)
|
||||
// .wait(selectors.globalItems.snackbarIsActive)
|
||||
// .getInnerText(selectors.globalItems.snackbarIsActive)
|
||||
// .then(result => {
|
||||
// expect(result).toContain('Error');
|
||||
// done();
|
||||
// })
|
||||
// .catch(catchErrors(done));
|
||||
// });
|
||||
it(`should receive an error if all fields are empty but date and amount on submit`, done => {
|
||||
nightmare
|
||||
.type(selectors.greuge.amountInput, 999)
|
||||
.click(selectors.greuge.saveButton)
|
||||
.wait(selectors.globalItems.snackbarIsActive)
|
||||
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||
.then(result => {
|
||||
expect(result).toContain('Some fields are invalid');
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
// it(`should receive an error if all fields are empty but date and amount on submit`, done => {
|
||||
// nightmare
|
||||
|
|
Loading…
Reference in New Issue