2019-02-25 10:47:28 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-06-04 09:00:05 +00:00
|
|
|
describe('Claim action path', () => {
|
2019-02-25 10:47:28 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
|
|
|
.loginAndModule('administrative', 'claim')
|
2019-08-13 05:45:12 +00:00
|
|
|
.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-04 09:00:05 +00:00
|
|
|
|
2019-06-14 10:27:41 +00:00
|
|
|
it('should check the "is paid with mana" checkbox', async() => {
|
2019-06-04 09:00:05 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.claimAction.isPaidWithManaCheckbox)
|
2019-12-18 11:48:38 +00:00
|
|
|
.waitForLastSnackbar();
|
2019-06-04 09:00:05 +00:00
|
|
|
|
|
|
|
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() => {
|
2019-06-04 09:00:05 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.reloadSection('claim.card.action')
|
|
|
|
.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);
|
|
|
|
|
|
|
|
expect(result).toBe('checked');
|
|
|
|
});
|
2019-02-25 10:47:28 +00:00
|
|
|
});
|