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

79 lines
2.6 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Claim action path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('administrative', 'claim')
.accessToSearchResult(2)
.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 second importable ticket', async() => {
const result = await nightmare
.waitToClick(selectors.claimAction.importTicketButton)
.waitToClick(selectors.claimAction.secondImportableTicket)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should edit the second line destination field', async() => {
const result = await nightmare
.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno')
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should delete the first line', async() => {
const result = await nightmare
.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)
.waitForLastSnackbar();
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');
});
});