salix/e2e/paths/02-client/22_unpaid.spec.js

42 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Client unpaid path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'client');
await page.accessToSearchResult('Charles Xavier');
await page.accessToSection('client.card.unpaid');
await page.waitForState('client.card.unpaid');
});
afterAll(async() => {
await browser.close();
});
it('should set cliet unpaid', async() => {
await page.waitToClick(selectors.clientUnpaid.hasDataCheckBox);
await page.pickDate(selectors.clientUnpaid.dated);
await page.write(selectors.clientUnpaid.amount, '500');
});
it('should save unpaid', async() => {
await page.waitToClick(selectors.clientUnpaid.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should confirm the unpaid have been saved', async() => {
await page.reloadSection('client.card.unpaid');
const result = await page.waitToGetProperty(selectors.clientUnpaid.amount, 'value');
expect(result).toEqual('500');
});
});