2019-01-16 14:02:50 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-01-16 14:02:50 +00:00
|
|
|
|
|
|
|
describe('Ticket create from client path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('employee', 'client');
|
|
|
|
await page.accessToSearchResult('Petter Parker');
|
|
|
|
});
|
2019-01-16 14:02:50 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-01-16 14:02:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should click the create simple ticket on the descriptor menu', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.clientDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.clientDescriptor.simpleTicketButton);
|
|
|
|
await page.waitForURL('#!/ticket/create?clientFk=102');
|
|
|
|
const url = await page.parsedUrl();
|
2019-01-16 14:02:50 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('clientFk=102');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check if the client details are the expected ones', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const client = await page
|
2019-01-16 14:02:50 +00:00
|
|
|
.waitToGetProperty(`${selectors.createTicketView.clientAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const address = await page
|
2019-01-16 14:02:50 +00:00
|
|
|
.waitToGetProperty(`${selectors.createTicketView.addressAutocomplete} input`, 'value');
|
|
|
|
|
|
|
|
|
|
|
|
expect(client).toContain('Petter Parker');
|
|
|
|
expect(address).toContain('20 Ingram Street');
|
|
|
|
});
|
|
|
|
});
|