2020-03-20 11:05:45 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
2020-03-25 13:18:51 +00:00
|
|
|
describe('Ticket index payout path', () => {
|
2020-03-20 11:05:45 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate to the ticket index', async() => {
|
|
|
|
await page.loginAndModule('administrative', 'ticket');
|
2020-03-31 08:02:25 +00:00
|
|
|
await page.waitForState('ticket.index');
|
2020-03-20 11:05:45 +00:00
|
|
|
});
|
|
|
|
|
2020-08-20 07:50:22 +00:00
|
|
|
it('should check the second ticket from a client and 1 of another', async() => {
|
2020-09-30 10:24:33 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.searchButton);
|
2021-02-03 16:01:53 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.thirdTicketCheckbox);
|
2021-10-28 11:30:07 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.fifthTicketCheckbox);
|
2020-03-20 11:05:45 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.payoutButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2020-03-20 11:05:45 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('You cannot make a payment on account from multiple clients');
|
2020-03-20 11:05:45 +00:00
|
|
|
});
|
|
|
|
|
2021-02-03 16:01:53 +00:00
|
|
|
it('should search for tickets of the same client then open the payout form', async() => {
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
|
2021-06-23 11:24:23 +00:00
|
|
|
await page.write(selectors.ticketsIndex.advancedSearchClient, '1101');
|
2021-02-03 16:01:53 +00:00
|
|
|
await page.keyboard.press('Enter');
|
2021-12-01 11:49:53 +00:00
|
|
|
await page.waitForNumberOfElements(selectors.ticketsIndex.anySearchResult, 9);
|
2021-02-03 16:01:53 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.firstTicketCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
|
|
|
|
|
2020-03-20 11:05:45 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.payoutButton);
|
|
|
|
|
|
|
|
await page.waitForSelector(selectors.ticketsIndex.payoutCompany);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should fill the company and bank to perform a payout', async() => {
|
2021-02-01 08:52:16 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketsIndex.payoutCompany, 'VNL');
|
2020-03-20 11:05:45 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash');
|
2021-02-01 08:52:16 +00:00
|
|
|
await page.write(selectors.clientBalance.newPaymentAmount, '100');
|
|
|
|
await page.write(selectors.ticketsIndex.payoutDescription, 'Payment');
|
2020-03-20 11:05:45 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.submitPayout);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2020-03-20 11:05:45 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-03-20 11:05:45 +00:00
|
|
|
});
|
|
|
|
|
2020-03-25 13:18:51 +00:00
|
|
|
it('should navigate to the client balance section and check a new balance line was entered', async() => {
|
2020-03-20 11:05:45 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.homeButton);
|
|
|
|
await page.selectModule('client');
|
2021-06-23 11:24:23 +00:00
|
|
|
await page.accessToSearchResult('1101');
|
2020-03-20 11:05:45 +00:00
|
|
|
await page.accessToSection('client.card.balance.index');
|
2021-10-28 11:30:07 +00:00
|
|
|
await page.waitForSelector(selectors.clientBalance.anyBalanceLine);
|
|
|
|
const count = await page.countElement(selectors.clientBalance.anyBalanceLine);
|
|
|
|
const reference = await page.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText');
|
2020-03-20 11:05:45 +00:00
|
|
|
|
2021-10-28 11:30:07 +00:00
|
|
|
expect(count).toEqual(4);
|
|
|
|
expect(reference).toContain('Cash, Albaran: 7, 8Payment');
|
2020-03-20 11:05:45 +00:00
|
|
|
});
|
|
|
|
});
|