e2e path for client invoices #111

This commit is contained in:
Carlos Jimenez 2018-03-02 14:45:54 +01:00
parent ab84f490e3
commit 6f0d9c31bb
1 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,58 @@
import selectors from '../../helpers/selectors.js';
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)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});
});
it('should search for the user Petter Parker', () => {
return nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
it(`should click on the search result to access to the client invoices`, () => {
return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientInvoices.invoicesButton)
.waitForURL('invoices')
.parsedUrl()
.then(url => {
expect(url.hash).toContain('invoices');
});
});
it('should confirm the client has an invoice', () => {
return nightmare
.wait(selectors.clientInvoices.firstInvoiceText)
.getInnerText(selectors.clientInvoices.firstInvoiceText)
.then(value => {
expect(value).toContain('V1800001');
expect(value).toContain('02/03/2018');
expect(value).toContain('350.50');
});
});
});