import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; describe('Claim action path', () => { const nightmare = createNightmare(); beforeAll(() => { nightmare .loginAndModule('administrative', 'claim') .accessToSearchResult('4') .accessToSection('claim.card.action'); }); it('should import the claim', async() => { const result = await nightmare .waitToClick(selectors.claimAction.importClaimButton) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should import the eighth ticket', async() => { const result = await nightmare .waitToClick(selectors.claimAction.importTicketButton) .waitToClick(selectors.claimAction.secondImportableTicket) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should edit the fourth line destination field', async() => { const result = await nightmare .autocompleteSearch(selectors.claimAction.thirdLineDestination, 'Bueno') .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should delete two first lines', async() => { const result = await nightmare .waitToClick(selectors.claimAction.secondDeleteLine) .waitToClick(selectors.claimAction.firstDeleteLine) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should refresh the view to check the remaining line is the expected one', async() => { const result = await nightmare .reloadSection('claim.card.action') .waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value'); expect(result).toEqual('Bueno'); }); it('should delete the current first line', async() => { const result = await nightmare .waitToClick(selectors.claimAction.firstDeleteLine) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should check the Is paid with mana checkbox', async() => { const result = await nightmare .waitToClick(selectors.claimAction.isPaidWithManaCheckbox) .waitForSnackbar(); expect(result).toEqual(jasmine.arrayContaining(['Data saved!'])); }); it('should confirm the Is paid with mana checkbox is checked', async() => { const result = await nightmare .reloadSection('claim.card.action') .checkboxState(selectors.claimAction.isPaidWithManaCheckbox); expect(result).toBe('checked'); }); });