2019-06-27 13:33:15 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-06-27 13:33:15 +00:00
|
|
|
|
|
|
|
describe('Ticket Summary path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.loginAndModule('employee', 'ticket');
|
|
|
|
await page.accessToSearchResult(ticketId);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2019-06-27 13:33:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should display details from the ticket and it's client on the top of the header`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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}`);
|
2021-06-23 11:24:23 +00:00
|
|
|
expect(result).toContain('Bruce Banner (1109)');
|
2019-06-27 13:33:15 +00:00
|
|
|
expect(result).toContain('Somewhere in Thailand');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should display ticket details', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let result = await page
|
2019-06-27 13:33:15 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toContain('000002');
|
|
|
|
});
|
|
|
|
|
2020-06-30 09:15:20 +00:00
|
|
|
it(`should click on the first sale ID to make the item descriptor visible`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.loginAndModule('production', 'ticket');
|
|
|
|
await page.accessToSearchResult(ticketId);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2019-06-27 13:33:15 +00:00
|
|
|
});
|
|
|
|
|
2021-12-30 09:45:19 +00:00
|
|
|
it('should set the ticket state to OK using the top right button', async() => {
|
|
|
|
const searchValue = 'OK';
|
|
|
|
await page.waitToClick(selectors.ticketSummary.stateButton);
|
|
|
|
await page.write(selectors.ticketSummary.stateAutocomplete, searchValue);
|
|
|
|
try {
|
|
|
|
await page.waitForFunction(text => {
|
|
|
|
const element = document.querySelector('li.active');
|
|
|
|
if (element)
|
|
|
|
return element.innerText.toLowerCase().includes(text.toLowerCase());
|
|
|
|
}, {}, searchValue);
|
|
|
|
} catch (error) {
|
|
|
|
const state = await page.evaluate(() => {
|
|
|
|
const stateSelector = 'vn-ticket-summary vn-label-value:nth-child(1) > section > span';
|
|
|
|
return document.querySelector(stateSelector).value;
|
|
|
|
});
|
|
|
|
throw new Error(`${stateSelector} innerText is ${state}! ${error}`);
|
|
|
|
}
|
|
|
|
await page.keyboard.press('Enter');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-06-27 13:33:15 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-06-27 13:33:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the ticket state was updated', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitForSpinnerLoad();
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
|
2019-06-27 13:33:15 +00:00
|
|
|
|
|
|
|
expect(result).toContain('OK');
|
|
|
|
});
|
|
|
|
});
|