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

79 lines
2.6 KiB
JavaScript
Raw Normal View History

2019-02-25 10:47:28 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Claim action path', () => {
2019-02-25 10:47:28 +00:00
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('administrative', 'claim')
.accessToSearchResult(2)
2019-02-25 10:47:28 +00:00
.accessToSection('claim.card.action');
});
it('should import the claim', async() => {
const result = await nightmare
.waitToClick(selectors.claimAction.importClaimButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-06-14 10:27:41 +00:00
it('should import the second importable ticket', async() => {
2019-02-25 10:47:28 +00:00
const result = await nightmare
.waitToClick(selectors.claimAction.importTicketButton)
.waitToClick(selectors.claimAction.secondImportableTicket)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-06-14 10:27:41 +00:00
it('should edit the second line destination field', async() => {
2019-02-25 10:47:28 +00:00
const result = await nightmare
2019-06-14 10:27:41 +00:00
.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno')
2019-02-25 10:47:28 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-06-14 10:27:41 +00:00
it('should delete the first line', async() => {
2019-02-25 10:47:28 +00:00
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!');
});
2019-06-14 10:27:41 +00:00
it('should check the "is paid with mana" checkbox', async() => {
const result = await nightmare
.waitToClick(selectors.claimAction.isPaidWithManaCheckbox)
.waitForSnackbar();
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
2019-06-14 10:27:41 +00:00
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');
});
2019-02-25 10:47:28 +00:00
});