import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Claim action path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('claimManager', 'claim'); await page.accessToSearchResult('2'); await page.accessToSection('claim.card.action'); }); afterAll(async() => { await browser.close(); }); it('should import the claim', async() => { await page.waitToClick(selectors.claimAction.importClaimButton); const message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); }); it('should delete the first line', async() => { await page.waitToClick(selectors.claimAction.firstDeleteLine); const message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); }); it('should refresh the view to check not have lines', async() => { await page.reloadSection('claim.card.action'); const result = await page.countElement(selectors.claimAction.anyLine); expect(result).toEqual(0); }); it('should check the "is paid with mana" checkbox', async() => { await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox); const message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); }); it('should confirm the "is paid with mana" is checked', async() => { await page.reloadSection('claim.card.action'); const isPaidWithManaCheckbox = await page.checkboxState(selectors.claimAction.isPaidWithManaCheckbox); expect(isPaidWithManaCheckbox).toBe('checked'); }); });