46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
|
import selectors from '../../helpers/selectors.js';
|
||
|
import createNightmare from '../../helpers/nightmare';
|
||
|
|
||
|
describe('Order lines', () => {
|
||
|
const nightmare = createNightmare();
|
||
|
beforeAll(() => {
|
||
|
nightmare
|
||
|
.loginAndModule('employee', 'order')
|
||
|
.accessToSearchResult('16')
|
||
|
.accessToSection('order.card.line');
|
||
|
});
|
||
|
|
||
|
it('should check the order subtotal', async() => {
|
||
|
const result = await nightmare
|
||
|
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
||
|
|
||
|
expect(result).toContain('135.60');
|
||
|
});
|
||
|
|
||
|
it('should delete the first line in the order', async() => {
|
||
|
const result = await nightmare
|
||
|
.waitToClick(selectors.orderLine.firstLineDeleteButton)
|
||
|
.waitToClick(selectors.orderLine.confirmButton)
|
||
|
.waitForLastSnackbar();
|
||
|
|
||
|
expect(result).toEqual('Data saved!');
|
||
|
});
|
||
|
|
||
|
it('should confirm the order subtotal has changed', async() => {
|
||
|
const result = await nightmare
|
||
|
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
||
|
|
||
|
expect(result).toContain('90.10');
|
||
|
});
|
||
|
|
||
|
it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => {
|
||
|
const url = await nightmare
|
||
|
.waitToClick(selectors.orderLine.confirmOrder)
|
||
|
.waitForURL('ticket/index')
|
||
|
.parsedUrl();
|
||
|
|
||
|
expect(url.hash).toContain('ticket/index');
|
||
|
expect(url.hash).toContain('clientFk');
|
||
|
});
|
||
|
});
|