salix/e2e/paths/ticket-module/13_create_ticket_services.s...

77 lines
2.9 KiB
JavaScript
Raw Normal View History

2019-01-14 10:19:39 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2019-02-07 13:33:52 +00:00
describe('Ticket services path', () => {
2019-01-14 10:19:39 +00:00
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult('id:1')
.accessToSection('ticket.card.service');
});
2019-01-15 11:28:13 +00:00
it('should edit the first service', async() => {
2019-01-14 10:19:39 +00:00
const result = await nightmare
2019-01-15 11:28:13 +00:00
.clearInput(selectors.ticketService.firstDescriptionInput)
.write(selectors.ticketService.firstDescriptionInput, 'my service')
.clearInput(selectors.ticketService.firstQuantityInput)
.write(selectors.ticketService.firstQuantityInput, 99)
.clearInput(selectors.ticketService.firstPriceInput)
.write(selectors.ticketService.firstPriceInput, 999)
2019-02-07 13:33:52 +00:00
.autocompleteSearch(selectors.ticketService.firstVatTypeAutocomplete, 'General VAT')
2019-01-14 10:19:39 +00:00
.waitToClick(selectors.ticketService.saveServiceButton)
.waitForLastSnackbar();
2019-01-24 13:03:01 +00:00
expect(result).toEqual('Data saved!');
2019-01-14 10:19:39 +00:00
});
2019-01-15 11:28:13 +00:00
it('should confirm the service description was edited correctly', async() => {
2019-01-14 10:19:39 +00:00
const result = await nightmare
.reloadSection('ticket.card.service')
2019-01-15 11:28:13 +00:00
.waitToGetProperty(selectors.ticketService.firstDescriptionInput, 'value');
2019-01-14 10:19:39 +00:00
expect(result).toEqual('my service');
});
2019-01-15 11:28:13 +00:00
it('should confirm the service quantity was edited correctly', async() => {
2019-01-14 10:19:39 +00:00
const result = await nightmare
2019-01-15 11:28:13 +00:00
.waitToGetProperty(selectors.ticketService.firstQuantityInput, 'value');
2019-01-14 10:19:39 +00:00
expect(result).toEqual('99');
});
2019-01-15 11:28:13 +00:00
it('should confirm the service price was edited correctly', async() => {
2019-01-14 10:19:39 +00:00
const result = await nightmare
2019-01-15 11:28:13 +00:00
.waitToGetProperty(selectors.ticketService.firstPriceInput, 'value');
2019-01-14 10:19:39 +00:00
expect(result).toEqual('999');
});
2019-01-15 11:28:13 +00:00
it('should confirm the service VAT was edited correctly', async() => {
2019-01-14 10:19:39 +00:00
const result = await nightmare
2019-01-15 11:28:13 +00:00
.waitToGetProperty(`${selectors.ticketService.firstVatTypeAutocomplete} input`, 'value');
2019-01-14 10:19:39 +00:00
2019-02-07 13:33:52 +00:00
expect(result).toEqual('General VAT');
2019-01-14 10:19:39 +00:00
});
2019-01-14 11:55:56 +00:00
it('should delete the service', async() => {
2019-01-14 10:19:39 +00:00
const result = await nightmare
.waitToClick(selectors.ticketService.fistDeleteServiceButton)
2019-02-07 13:33:52 +00:00
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)
2019-01-14 11:55:56 +00:00
.waitToClick(selectors.ticketService.saveServiceButton)
.waitForLastSnackbar();
2019-01-24 13:03:01 +00:00
expect(result).toEqual('Data saved!');
2019-01-14 11:55:56 +00:00
});
it('should confirm the service was sucessfully removed', async() => {
const result = await nightmare
.reloadSection('ticket.card.service')
2019-01-16 09:49:49 +00:00
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)
2019-01-15 11:28:13 +00:00
.countElement(selectors.ticketService.serviceLine);
2019-01-14 10:19:39 +00:00
2019-01-16 09:49:49 +00:00
expect(result).toEqual(0);
2019-01-14 10:19:39 +00:00
});
});