2020-11-04 17:14:08 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
2023-04-24 10:59:56 +00:00
|
|
|
const $ = {
|
|
|
|
saveButton: 'vn-supplier-fiscal-data button[type="submit"]',
|
|
|
|
};
|
|
|
|
const $inputs = {
|
|
|
|
province: 'vn-supplier-fiscal-data [name="province"]',
|
|
|
|
country: 'vn-supplier-fiscal-data [name="country"]',
|
|
|
|
postcode: 'vn-supplier-fiscal-data [name="postcode"]',
|
|
|
|
city: 'vn-supplier-fiscal-data [name="city"]',
|
|
|
|
socialName: 'vn-supplier-fiscal-data [name="socialName"]',
|
|
|
|
taxNumber: 'vn-supplier-fiscal-data [name="taxNumber"]',
|
|
|
|
account: 'vn-supplier-fiscal-data [name="account"]',
|
|
|
|
sageWithholding: 'vn-supplier-fiscal-data [ng-model="$ctrl.supplier.sageWithholdingFk"]',
|
|
|
|
sageTaxType: 'vn-supplier-fiscal-data [ng-model="$ctrl.supplier.sageTaxTypeFk"]'
|
|
|
|
};
|
|
|
|
|
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-04-24 10:59:56 +00:00
|
|
|
it('should attempt to edit the fiscal data and check data is saved', async() => {
|
|
|
|
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',
|
|
|
|
taxNumber: 'Wrong tax number',
|
|
|
|
account: '0123456789',
|
|
|
|
sageWithholding: 'retencion estimacion objetiva',
|
|
|
|
sageTaxType: 'operaciones no sujetas'
|
|
|
|
};
|
|
|
|
|
|
|
|
const errorMessage = await page.sendForm(form, values);
|
|
|
|
const message = await page.sendForm(form, {
|
|
|
|
taxNumber: '12345678Z'
|
|
|
|
});
|
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
|
|
|
});
|
|
|
|
});
|