salix/e2e/paths/06-claim/04_claim_action.spec.js

91 lines
3.2 KiB
JavaScript
Raw Normal View History

2019-02-25 10:47:28 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2019-02-25 10:47:28 +00:00
2020-05-14 15:15:54 +00:00
describe('Claim action path', () => {
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
afterAll(async() => {
await browser.close();
2019-02-25 10:47:28 +00:00
});
it('should import the claim', async() => {
await page.waitToClick(selectors.claimAction.importClaimButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2019-02-25 10:47:28 +00:00
2020-04-08 09:24:40 +00:00
expect(message.type).toBe('success');
2019-02-25 10:47:28 +00:00
});
2020-03-17 10:00:16 +00:00
it('should import the second importable ticket', async() => {
// the animation adding the header element for the claimed total
// obscures somehow other elements for about 2 seconds
await page.waitFor(3000);
await page.waitToClick(selectors.claimAction.importTicketButton);
await page.waitToClick(selectors.claimAction.secondImportableTicket);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2019-02-25 10:47:28 +00:00
2020-04-08 09:24:40 +00:00
expect(message.type).toBe('success');
2019-02-25 10:47:28 +00:00
});
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();
await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno');
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2019-02-25 10:47:28 +00:00
2020-04-08 09:24:40 +00:00
expect(message.type).toBe('success');
2019-02-25 10:47:28 +00:00
});
2019-06-14 10:27:41 +00:00
it('should delete the first line', async() => {
await page.waitToClick(selectors.claimAction.firstDeleteLine);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2019-02-25 10:47:28 +00:00
2020-04-08 09:24:40 +00:00
expect(message.type).toBe('success');
2019-02-25 10:47:28 +00:00
});
it('should refresh the view to check the remaining line is the expected one', async() => {
await page.reloadSection('claim.card.action');
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() => {
await page.waitToClick(selectors.claimAction.firstDeleteLine);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2019-02-25 10:47:28 +00:00
2020-04-08 09:24:40 +00:00
expect(message.type).toBe('success');
2019-02-25 10:47:28 +00:00
});
2019-06-14 10:27:41 +00:00
it('should check the "is paid with mana" checkbox', async() => {
await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2020-04-08 09:24:40 +00:00
expect(message.type).toBe('success');
});
2020-05-14 12:30:43 +00:00
it('should check the "Pick up" checkbox', async() => {
await page.waitToClick(selectors.claimAction.hasToPickUpCheckbox);
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');
});
it('should confirm the "is paid with mana" and "Pick up" checkbox are checked', async() => {
await page.reloadSection('claim.card.action');
2020-05-14 12:30:43 +00:00
const isPaidWithManaCheckbox = await page.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);
const hasToPickUpCheckbox = await page.checkboxState(selectors.claimAction.hasToPickUpCheckbox);
2020-05-14 12:30:43 +00:00
expect(isPaidWithManaCheckbox).toBe('checked');
expect(hasToPickUpCheckbox).toBe('checked');
});
2019-02-25 10:47:28 +00:00
});