2020-01-14 08:20:14 +00:00
|
|
|
import selectors from '../../helpers/selectors';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-01-08 14:06:20 +00:00
|
|
|
|
2018-11-20 13:22:00 +00:00
|
|
|
describe('Client Add greuge path', () => {
|
2020-01-14 08:20:14 +00:00
|
|
|
let browser;
|
2019-12-31 11:00:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:20:14 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.loginAndModule('salesAssistant', 'client');
|
|
|
|
await page.accessToSearchResult('Petter Parker');
|
|
|
|
await page.accessToSection('client.card.greuge.index');
|
|
|
|
});
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-14 08:40:50 +00:00
|
|
|
await browser.close();
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should click on the add greuge button`, async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientGreuge.addGreugeFloatButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('client.card.greuge.create');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should receive an error if all fields are empty but date and type on submit`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.clientGreuge.type, 'Diff');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientGreuge.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Some fields are invalid');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
2023-05-08 14:30:21 +00:00
|
|
|
it(`should create a new greuge with all its data and confirm the greuge was added to the list`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.clientGreuge.amount, '999');
|
|
|
|
await page.waitForTextInField(selectors.clientGreuge.amount, '999');
|
|
|
|
await page.write(selectors.clientGreuge.description, 'new armor for Batman!');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientGreuge.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2023-05-08 14:30:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-11-20 13:22:00 +00:00
|
|
|
expect(result).toContain(999);
|
|
|
|
expect(result).toContain('new armor for Batman!');
|
|
|
|
expect(result).toContain('Diff');
|
2018-01-12 08:47:51 +00:00
|
|
|
});
|
2018-01-08 14:06:20 +00:00
|
|
|
});
|