salix/e2e/paths/05-ticket-module/11_diary.spec.js

69 lines
2.5 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
// #2026 Fallo en relocate de descriptor popover
xdescribe('Ticket diary path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'ticket');
});
afterAll(async() => {
await browser.close();
});
it('should search for a specific ticket', async() => {
await page.write(selectors.ticketsIndex.searchTicketInput, '1');
await page.waitToClick(selectors.ticketsIndex.searchButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
const result = await page.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket summary`, async() => {
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave');
await page.waitToClick(selectors.ticketsIndex.searchResult);
await page.waitForURL('/summary');
const url = await page.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
await page.waitForTransitionEnd('.vn-popover');
await page.waitToClick(selectors.ticketSummary.popoverDiaryButton);
await page.waitForURL('/diary');
const url = await page.parsedUrl();
expect(url.hash).toContain('/diary');
});
it(`should check the second line id is marked as message`, async() => {
const result = await page
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
expect(result).toContain('message');
});
it(`should check the third line balance is marked as message`, async() => {
const result = await page
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
expect(result).toContain('message');
});
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {
await page.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two');
const result = await page
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
expect(result).toContain('balance');
});
});