import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';

// #2221 Local MySQL8 crashes when rest method Items/getBalance is called
xdescribe('Ticket diary path', () => {
    let page;

    beforeAll(async() => {
        page = (await getBrowser()).page;
        await page.loginAndModule('employee', 'ticket');
    });

    afterAll(async() => {
        await page.browser().close();
    });

    it(`should navigate to item diary from ticket sale and check the lines`, async() => {
        await page.accessToSearchResult('1');
        await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
        await page.waitToClick(selectors.ticketSummary.popoverDiaryButton);
        await page.waitForState('item.card.diary');

        const secondIdClass = await page.getClassName(selectors.itemDiary.secondTicketId);
        const fourthBalanceClass = await page.getClassName(selectors.itemDiary.fourthBalance);
        const firstBalanceClass = await page.getClassName(selectors.itemDiary.firstBalance);

        expect(secondIdClass).toContain('message');
        expect(fourthBalanceClass).toContain('message');
        expect(firstBalanceClass).toContain('balance');
    });
});