2018-11-13 15:30:19 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2018-11-21 13:09:22 +00:00
|
|
|
describe('Ticket purchase request path', () => {
|
2018-11-13 15:30:19 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
2018-12-02 23:45:34 +00:00
|
|
|
.loginAndModule('salesPerson', 'ticket')
|
2019-11-10 13:13:55 +00:00
|
|
|
.accessToSearchResult('16')
|
2018-12-02 23:45:34 +00:00
|
|
|
.accessToSection('ticket.card.request.index');
|
2018-11-13 15:30:19 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should add a new request`, async() => {
|
2018-11-13 15:30:19 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketRequests.addRequestButton)
|
2019-01-23 14:33:25 +00:00
|
|
|
.write(selectors.ticketRequests.descriptionInput, 'New stuff')
|
|
|
|
.write(selectors.ticketRequests.quantityInput, 99)
|
2019-01-31 16:01:33 +00:00
|
|
|
.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick')
|
2019-01-23 14:33:25 +00:00
|
|
|
.write(selectors.ticketRequests.priceInput, 999)
|
2018-11-13 15:30:19 +00:00
|
|
|
.waitToClick(selectors.ticketRequests.saveButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should have been redirected to the request index`, async() => {
|
2018-11-21 13:09:22 +00:00
|
|
|
const url = await nightmare
|
|
|
|
.waitForURL('/request')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-11-13 15:30:19 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/request');
|
2018-11-13 15:30:19 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should confirm the new request was added`, async() => {
|
2018-11-13 15:30:19 +00:00
|
|
|
const result = await nightmare
|
2019-01-27 20:09:54 +00:00
|
|
|
.reloadSection('ticket.card.request.index')
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.ticketRequests.firstDescription, 'innerText');
|
2018-11-13 15:30:19 +00:00
|
|
|
|
2018-11-21 13:09:22 +00:00
|
|
|
expect(result).toEqual('New stuff');
|
2018-11-13 15:30:19 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should delete the added request`, async() => {
|
2018-11-13 15:30:19 +00:00
|
|
|
const result = await nightmare
|
2018-11-21 13:09:22 +00:00
|
|
|
.waitToClick(selectors.ticketRequests.firstRemoveRequestButton)
|
2018-11-13 15:30:19 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should confirm the request was deleted`, async() => {
|
2018-11-13 15:30:19 +00:00
|
|
|
const result = await nightmare
|
2019-01-27 20:09:54 +00:00
|
|
|
.reloadSection('ticket.card.request.index')
|
2018-11-21 13:09:22 +00:00
|
|
|
.wait(selectors.ticketRequests.addRequestButton)
|
|
|
|
.exists(selectors.ticketRequests.request);
|
2018-11-13 15:30:19 +00:00
|
|
|
|
2018-11-21 13:09:22 +00:00
|
|
|
expect(result).toBeFalsy();
|
2018-11-13 15:30:19 +00:00
|
|
|
});
|
|
|
|
});
|