salix/e2e/paths/05-ticket-module/16_summary.spec.js

99 lines
3.4 KiB
JavaScript
Raw Normal View History

2019-06-27 13:33:15 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2019-06-27 13:33:15 +00:00
describe('Ticket Summary path', () => {
let browser;
let page;
const ticketId = '20';
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
});
afterAll(async() => {
await browser.close();
});
2019-06-27 13:33:15 +00:00
it('should navigate to the target ticket summary section', async() => {
await page.loginAndModule('employee', 'ticket');
await page.accessToSearchResult(ticketId);
await page.waitForURL('/summary');
const url = await page.parsedUrl();
2019-06-27 13:33:15 +00:00
expect(url.hash).toContain('/summary');
});
it(`should display details from the ticket and it's client on the top of the header`, async() => {
await page.waitForTextInElement(selectors.ticketSummary.header, 'Bruce Banner');
const result = await page.waitToGetProperty(selectors.ticketSummary.header, 'innerText');
2019-06-27 13:33:15 +00:00
expect(result).toContain(`Ticket #${ticketId}`);
expect(result).toContain('Bruce Banner (109)');
expect(result).toContain('Somewhere in Thailand');
});
it('should display ticket details', async() => {
let result = await page
2019-06-27 13:33:15 +00:00
.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
expect(result).toContain('Arreglar');
});
it('should display delivery details', async() => {
let result = await page
2019-06-27 13:33:15 +00:00
.waitToGetProperty(selectors.ticketSummary.route, 'innerText');
expect(result).toContain('3');
});
it('should display the ticket total', async() => {
let result = await page
2019-06-27 13:33:15 +00:00
.waitToGetProperty(selectors.ticketSummary.total, 'innerText');
expect(result).toContain('€155.54');
});
it('should display the ticket line(s)', async() => {
let result = await page
2019-06-27 13:33:15 +00:00
.waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText');
expect(result).toContain('000002');
});
2019-06-27 13:53:40 +00:00
it(`should click on the first sale ID making the item descriptor visible`, async() => {
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
await page.waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage);
const visible = await page.isVisible(selectors.ticketSummary.itemDescriptorPopover);
2019-06-27 13:53:40 +00:00
expect(visible).toBeTruthy();
});
it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => {
await page.waitForSelector(selectors.ticketSummary.itemDescriptorPopoverItemDiaryButton, {visible: true});
2019-06-27 13:53:40 +00:00
});
2019-06-27 13:33:15 +00:00
it('should log in as production then navigate to the summary of the same ticket', async() => {
await page.loginAndModule('production', 'ticket');
await page.accessToSearchResult(ticketId);
await page.waitForURL('/summary');
let url = await page.parsedUrl();
2019-06-27 13:33:15 +00:00
expect(url.hash).toContain('/summary');
});
it('should click on the SET OK button', async() => {
await page.waitToClick(selectors.ticketSummary.setOk);
let result = await page.waitForLastSnackbar();
2019-06-27 13:33:15 +00:00
expect(result).toEqual('Data saved!');
});
it('should confirm the ticket state was updated', async() => {
await page.waitForSpinnerLoad();
let result = await page.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
2019-06-27 13:33:15 +00:00
expect(result).toContain('OK');
});
});