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

79 lines
3.0 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-01-14 11:55:56 +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');
});
it('should create a new service', async() => {
const result = await nightmare
.waitToClick(selectors.ticketService.addServiceButton)
.write(selectors.ticketService.descriptionInput, 'my service')
.clearInput(selectors.ticketService.quantityInput)
.write(selectors.ticketService.quantityInput, 99)
.write(selectors.ticketService.priceInput, 999)
.autocompleteSearch(selectors.ticketService.vatTypeAutocomplete, 'Reduced VAT')
.waitToClick(selectors.ticketService.saveServiceButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the service description was created correctly', async() => {
const result = await nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton)
.wait(selectors.ticketBasicData.clientAutocomplete)
.click(selectors.ticketService.serviceButton)
.waitToGetProperty(selectors.ticketService.descriptionInput, 'value');
expect(result).toEqual('my service');
});
it('should confirm the service quantity was created correctly', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketService.quantityInput, 'value');
expect(result).toEqual('99');
});
it('should confirm the service price was created correctly', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketService.priceInput, 'value');
expect(result).toEqual('999');
});
it('should confirm the service VAT was created correctly', async() => {
const result = await nightmare
.waitToGetProperty(`${selectors.ticketService.vatTypeAutocomplete} input`, 'value');
expect(result).toEqual('Reduced VAT');
});
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-01-14 11:55:56 +00:00
.waitToClick(selectors.ticketService.saveServiceButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the service was sucessfully removed', async() => {
const result = await nightmare
2019-01-14 10:19:39 +00:00
.waitToClick(selectors.ticketBasicData.basicDataButton)
.wait(selectors.ticketBasicData.clientAutocomplete)
.click(selectors.ticketService.serviceButton)
.waitForNumberOfElements(selectors.ticketService.descriptionInput, 0)
.countElement(selectors.ticketService.descriptionInput);
expect(result).toEqual(0);
});
});