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

64 lines
2.1 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Claim edit basic data 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!');
});
});