2020-11-05 12:53:19 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
|
|
|
describe('Supplier basic data path', () => {
|
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2021-12-14 07:23:11 +00:00
|
|
|
await page.loginAndModule('financial', 'supplier');
|
2020-11-05 12:53:19 +00:00
|
|
|
await page.accessToSearchResult('1');
|
|
|
|
await page.accessToSection('supplier.card.basicData');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should edit the basic data', async() => {
|
|
|
|
await page.clearInput(selectors.supplierBasicData.alias);
|
|
|
|
await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL');
|
2020-11-18 10:47:23 +00:00
|
|
|
await page.waitToClick(selectors.supplierBasicData.isSerious);
|
2020-11-05 12:53:19 +00:00
|
|
|
await page.waitToClick(selectors.supplierBasicData.isActive);
|
2021-11-10 07:43:25 +00:00
|
|
|
await page.waitToClick(selectors.supplierBasicData.isPayMethodChecked);
|
2020-11-05 12:53:19 +00:00
|
|
|
await page.write(selectors.supplierBasicData.notes, 'Some notes');
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.supplierBasicData.saveButton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-11-05 12:53:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should reload the section', async() => {
|
|
|
|
await page.reloadSection('supplier.card.basicData');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the alias was edited', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.supplierBasicData.alias, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('Plants Nick SL');
|
|
|
|
});
|
|
|
|
|
2020-11-18 10:47:23 +00:00
|
|
|
it('should check the isSerious checkbox is now unchecked', async() => {
|
|
|
|
const result = await page.checkboxState(selectors.supplierBasicData.isSerious);
|
2020-11-05 12:53:19 +00:00
|
|
|
|
|
|
|
expect(result).toBe('unchecked');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the isActive checkbox is now unchecked', async() => {
|
|
|
|
const result = await page.checkboxState(selectors.supplierBasicData.isActive);
|
|
|
|
|
|
|
|
expect(result).toBe('unchecked');
|
|
|
|
});
|
|
|
|
|
2021-11-10 07:43:25 +00:00
|
|
|
it('should check the isPayMethodChecked checkbox is now unchecked', async() => {
|
|
|
|
const result = await page.checkboxState(selectors.supplierBasicData.isPayMethodChecked);
|
|
|
|
|
|
|
|
expect(result).toBe('unchecked');
|
|
|
|
});
|
|
|
|
|
2020-11-05 12:53:19 +00:00
|
|
|
it('should check the notes were edited', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.supplierBasicData.notes, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('Some notes');
|
|
|
|
});
|
2020-11-05 13:18:48 +00:00
|
|
|
|
|
|
|
it('should navigate to the log section', async() => {
|
|
|
|
await page.accessToSection('supplier.card.log');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the changes have been recorded', async() => {
|
2022-12-05 14:30:41 +00:00
|
|
|
const result = await page.waitToGetProperty('vn-tr table tr:nth-child(3) td.after', 'innerText');
|
2020-11-05 13:18:48 +00:00
|
|
|
|
2022-12-05 14:30:41 +00:00
|
|
|
expect(result).toEqual('Some notes');
|
2020-11-05 13:18:48 +00:00
|
|
|
});
|
2020-11-05 12:53:19 +00:00
|
|
|
});
|