2019-06-28 12:01:43 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-06-28 12:01:43 +00:00
|
|
|
|
2020-12-31 09:30:51 +00:00
|
|
|
describe('Claim descriptor path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
const claimId = '1';
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
2019-06-28 12:01:43 +00:00
|
|
|
|
2020-01-26 23:48:00 +00:00
|
|
|
it('should now navigate to the target claim summary section', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.loginAndModule('employee', 'claim');
|
|
|
|
await page.accessToSearchResult(claimId);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('claim.card.summary');
|
2019-06-28 12:01:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should not be able to see the delete claim button of the descriptor more menu`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDescriptor.moreMenu);
|
2020-01-26 23:48:00 +00:00
|
|
|
await page.waitForSelector(selectors.claimDescriptor.moreMenuDeleteClaim, {hidden: true});
|
2019-06-28 12:01:43 +00:00
|
|
|
});
|
|
|
|
|
2020-10-26 11:16:57 +00:00
|
|
|
it(`should log in as claimManager and navigate to the target claim`, async() => {
|
|
|
|
await page.loginAndModule('claimManager', 'claim');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.accessToSearchResult(claimId);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('claim.card.summary');
|
2019-06-28 12:01:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should be able to see the delete claim button of the descriptor more menu`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDescriptor.moreMenu);
|
2020-01-26 23:48:00 +00:00
|
|
|
await page.waitForSelector(selectors.claimDescriptor.moreMenuDeleteClaim, {visible: true});
|
2019-06-28 12:01:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should delete the claim`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDescriptor.moreMenuDeleteClaim);
|
|
|
|
await page.waitToClick(selectors.claimDescriptor.acceptDeleteClaim);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-06-28 12:01:43 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Claim deleted!');
|
2019-06-28 12:01:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should have been relocated to the claim index`, async() => {
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('claim.index');
|
2019-06-28 12:01:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should search for the deleted claim to find no results`, async() => {
|
2020-03-31 16:33:48 +00:00
|
|
|
await page.doSearch(claimId);
|
|
|
|
const nResults = await page.countElement(selectors.claimsIndex.searchResult);
|
2019-06-28 12:01:43 +00:00
|
|
|
|
2020-03-31 16:33:48 +00:00
|
|
|
expect(nResults).toEqual(0);
|
2019-06-28 12:01:43 +00:00
|
|
|
});
|
|
|
|
});
|