2020-11-04 17:14:08 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
2023-05-08 07:18:22 +00:00
|
|
|
describe('Supplier fiscal data path', () => {
|
2020-11-04 17:14:08 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('administrative', 'supplier');
|
|
|
|
await page.accessToSearchResult('2');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
2023-09-22 08:59:48 +00:00
|
|
|
it('should attempt to edit the fiscal data and check data iss saved', async() => {
|
2023-04-24 10:59:56 +00:00
|
|
|
await page.accessToSection('supplier.card.fiscalData');
|
2023-05-05 06:12:38 +00:00
|
|
|
|
|
|
|
const form = 'vn-supplier-fiscal-data form';
|
|
|
|
const values = {
|
|
|
|
province: null,
|
|
|
|
country: null,
|
|
|
|
postcode: null,
|
|
|
|
city: 'Valencia',
|
|
|
|
socialName: 'Farmer King SL',
|
2023-09-22 08:59:48 +00:00
|
|
|
taxNumber: '12345678Z',
|
2023-05-05 06:12:38 +00:00
|
|
|
account: '0123456789',
|
|
|
|
sageWithholding: 'retencion estimacion objetiva',
|
|
|
|
sageTaxType: 'operaciones no sujetas'
|
|
|
|
};
|
|
|
|
|
2023-09-22 08:59:48 +00:00
|
|
|
const errorMessage = await page.sendForm(form, {
|
|
|
|
taxNumber: 'Wrong tax number'
|
2023-05-05 06:12:38 +00:00
|
|
|
});
|
2023-09-22 08:59:48 +00:00
|
|
|
const message = await page.sendForm(form, values);
|
2020-11-04 17:14:08 +00:00
|
|
|
|
|
|
|
await page.reloadSection('supplier.card.fiscalData');
|
2023-05-05 06:12:38 +00:00
|
|
|
const formValues = await page.fetchForm(form, Object.keys(values));
|
2023-04-24 10:59:56 +00:00
|
|
|
|
|
|
|
expect(errorMessage.text).toContain('Invalid Tax number');
|
2023-05-05 06:12:38 +00:00
|
|
|
expect(message.isSuccess).toBeTrue();
|
|
|
|
expect(formValues).toEqual({
|
|
|
|
province: 'Province one',
|
2023-04-24 10:59:56 +00:00
|
|
|
country: 'España',
|
|
|
|
postcode: '46000',
|
|
|
|
city: 'Valencia',
|
|
|
|
socialName: 'Farmer King SL',
|
|
|
|
taxNumber: '12345678Z',
|
|
|
|
account: '0123456789',
|
|
|
|
sageWithholding: 'RETENCION ESTIMACION OBJETIVA',
|
|
|
|
sageTaxType: 'Operaciones no sujetas'
|
|
|
|
});
|
2020-11-04 17:14:08 +00:00
|
|
|
});
|
|
|
|
});
|