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-03-20 11:05:45 +00:00
|
|
|
await page.keyboard.press('Enter');
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox);
|
|
|
|
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-04-08 09:24:40 +00:00
|
|
|
expect(message.text).toBe('You cannot make a payment on account from multiple clients');
|
2020-03-20 11:05:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should uncheck the sixth ticket result and check the third which is from the same client then open the payout form', async() => {
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.thirdTicketCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.payoutButton);
|
|
|
|
|
|
|
|
await page.waitForSelector(selectors.ticketsIndex.payoutCompany);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should fill the company and bank to perform a payout', async() => {
|
|
|
|
await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash');
|
|
|
|
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-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
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');
|
2020-03-25 13:18:51 +00:00
|
|
|
await page.accessToSearchResult('101');
|
2020-03-20 11:05:45 +00:00
|
|
|
await page.accessToSection('client.card.balance.index');
|
|
|
|
await page.waitForSelector('vn-client-balance-index vn-tbody > vn-tr');
|
|
|
|
let result = await page.countElement('vn-client-balance-index vn-tbody > vn-tr');
|
|
|
|
|
|
|
|
expect(result).toEqual(4);
|
|
|
|
});
|
|
|
|
});
|