finished the e2e path for Greuge

This commit is contained in:
Carlos Jimenez 2018-01-12 09:47:51 +01:00
parent 3302908691
commit 6b683b5713
2 changed files with 57 additions and 31 deletions

View File

@ -129,10 +129,10 @@ export default {
greugeButton: `${components.vnMenuItem}[ui-sref="clientCard.greuge.list"]`,
addGreugeFloatButton: `${components.vnFloatButton}`,
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}`,
typeSecondOption: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-auto:nth-child(2) > ul > li`,
saveButton: `${components.vnSubmit}`
// firstGreugeText: ''
saveButton: `${components.vnSubmit}`,
firstGreugeText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-greuge-list > vn-card > div > vn-vertical > vn-one > vn-horizontal'
}
};

View File

@ -102,7 +102,7 @@ describe('Add greuge path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toContain('Error');
expect(result).toContain('Some fields are invalid');
done();
})
.catch(catchErrors(done));
@ -121,32 +121,58 @@ 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
// .clearInput(selectors.greuge.amountInput)
// .type(selectors.greuge.descriptionInput, 'Bat-flying suite with anti-APCR rounds')
// .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 description on submit`, done => {
nightmare
.clearInput(selectors.greuge.amountInput)
.type(selectors.greuge.descriptionInput, 'new armor for Batman!')
.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 type on submit`, done => {
// nightmare
// .clearInput(selectors.greuge.descriptionInput)
// .waitToClick(selectors.greuge.typeInput)
// .waitToClick(selectors.greuge.typeSecondOption)
// .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 type on submit`, done => {
nightmare
.clearInput(selectors.greuge.descriptionInput)
.waitToClick(selectors.greuge.typeInput)
.waitToClick(selectors.greuge.typeSecondOption)
.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 create a new greuge with all its data`, done => {
nightmare
.type(selectors.greuge.amountInput, 999)
.type(selectors.greuge.descriptionInput, 'new armor for Batman!')
.click(selectors.greuge.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toContain('Data saved!');
done();
})
.catch(catchErrors(done));
});
it('should confirm the greuge was added on the 7th location of the list', done => {
nightmare
.waitForSnackbarReset()
.wait(selectors.greuge.firstGreugeText)
.getInnerText(selectors.greuge.firstGreugeText)
.then(value => {
expect(value).toContain(999);
done();
})
.catch(catchErrors(done));
});
});