2019-02-25 10:47:28 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-02-25 10:47:28 +00:00
|
|
|
|
2020-03-17 10:00:16 +00:00
|
|
|
describe('Claim action path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('administrative', 'claim');
|
|
|
|
await page.accessToSearchResult('2');
|
|
|
|
await page.accessToSection('claim.card.action');
|
|
|
|
});
|
2019-02-25 10:47:28 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-02-25 10:47:28 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should import the claim', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimAction.importClaimButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-02-25 10:47:28 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2020-03-17 10:00:16 +00:00
|
|
|
it('should import the second importable ticket', async() => {
|
|
|
|
await page.waitFor(3000); // the animation adding the header element for the claimed total obscures somehow other elements for about 2 seconds
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimAction.importTicketButton);
|
|
|
|
await page.waitToClick(selectors.claimAction.secondImportableTicket);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-02-25 10:47:28 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-06-14 10:27:41 +00:00
|
|
|
it('should edit the second line destination field', async() => {
|
2020-02-25 15:36:29 +00:00
|
|
|
await page.waitForContentLoaded();
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno');
|
2020-02-07 06:47:11 +00:00
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-02-25 10:47:28 +00:00
|
|
|
|
2020-02-07 06:47:11 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2019-02-25 10:47:28 +00:00
|
|
|
});
|
|
|
|
|
2019-06-14 10:27:41 +00:00
|
|
|
it('should delete the first line', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimAction.firstDeleteLine);
|
2020-01-26 23:48:00 +00:00
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-02-25 10:47:28 +00:00
|
|
|
|
2020-02-25 15:36:29 +00:00
|
|
|
expect(result).toContain('Data saved!');
|
2019-02-25 10:47:28 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should refresh the view to check the remaining line is the expected one', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.reloadSection('claim.card.action');
|
2020-01-29 13:54:07 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.claimAction.firstLineDestination, 'value');
|
2019-02-25 10:47:28 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Bueno');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the current first line', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimAction.firstDeleteLine);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-02-25 10:47:28 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
2019-06-04 09:00:05 +00:00
|
|
|
|
2019-06-14 10:27:41 +00:00
|
|
|
it('should check the "is paid with mana" checkbox', async() => {
|
2020-03-17 10:00:16 +00:00
|
|
|
page.waitFor(3000); // can't use waitForNavigation here and needs more time than a single second to get the section ready...
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-06-04 09:00:05 +00:00
|
|
|
|
2020-03-23 22:57:11 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2019-06-04 09:00:05 +00:00
|
|
|
});
|
|
|
|
|
2019-06-14 10:27:41 +00:00
|
|
|
it('should confirm the "is paid with mana" checkbox is checked', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.reloadSection('claim.card.action');
|
|
|
|
const result = await page.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);
|
2019-06-04 09:00:05 +00:00
|
|
|
|
|
|
|
expect(result).toBe('checked');
|
|
|
|
});
|
2019-02-25 10:47:28 +00:00
|
|
|
});
|