salix/e2e/paths/13-supplier/03_fiscal_data.spec.js

57 lines
1.8 KiB
JavaScript

import getBrowser from '../../helpers/puppeteer';
describe('Supplier fiscal data path', () => {
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();
});
it('should attempt to edit the fiscal data and check data iss saved', async() => {
await page.accessToSection('supplier.card.fiscalData');
const form = 'vn-supplier-fiscal-data form';
const values = {
province: null,
country: null,
postcode: null,
city: 'Valencia',
socialName: 'FARMER KING SL',
taxNumber: '12345678Z',
account: '0123456789',
sageWithholding: 'retencion estimacion objetiva',
sageTaxType: 'operaciones no sujetas'
};
const errorMessage = await page.sendForm(form, {
taxNumber: 'Wrong tax number'
});
const message = await page.sendForm(form, values);
await page.reloadSection('supplier.card.fiscalData');
const formValues = await page.fetchForm(form, Object.keys(values));
expect(errorMessage.text).toContain('Invalid Tax number');
expect(message.isSuccess).toBeTrue();
expect(formValues).toEqual({
province: 'Province one',
country: 'España',
postcode: '46000',
city: 'Valencia',
socialName: 'FARMER KING SL',
taxNumber: '12345678Z',
account: '0123456789',
sageWithholding: 'RETENCION ESTIMACION OBJETIVA',
sageTaxType: 'Operaciones no sujetas'
});
});
});