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

67 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.topbarSearch, '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);
let url = await page.expectURL('/summary'); // use waitForState instead
expect(url).toBe(true);
});
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);
let url = await page.expectURL('/diary'); // use waitForState instead
expect(url).toBe(true);
});
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.warehouse, 'Warehouse Two');
const result = await page
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
expect(result).toContain('balance');
});
});