diff --git a/db/changes/10260-navidad/00-acl.sql b/db/changes/10260-navidad/00-acl.sql new file mode 100644 index 0000000000..9fba4786b7 --- /dev/null +++ b/db/changes/10260-navidad/00-acl.sql @@ -0,0 +1,2 @@ + INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES ('PayDem', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index c23a8cc4d4..11087d2d4a 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -960,5 +960,11 @@ export default { province: 'vn-supplier-fiscal-data vn-autocomplete[ng-model="$ctrl.supplier.provinceFk"]', country: 'vn-supplier-fiscal-data vn-autocomplete[ng-model="$ctrl.supplier.countryFk"]', saveButton: 'vn-supplier-fiscal-data button[type="submit"]', + }, + supplierBillingData: { + payMethod: 'vn-supplier-billing-data vn-autocomplete[ng-model="$ctrl.supplier.payMethodFk"]', + payDem: 'vn-supplier-billing-data vn-autocomplete[ng-model="$ctrl.supplier.payDemFk"]', + payDay: 'vn-supplier-billing-data vn-input-number[ng-model="$ctrl.supplier.payDay"]', + saveButton: 'vn-supplier-billing-data button[type=submit]' } }; diff --git a/e2e/paths/13-supplier/05_billing_data.spec.js b/e2e/paths/13-supplier/05_billing_data.spec.js new file mode 100644 index 0000000000..d3cb6dcab8 --- /dev/null +++ b/e2e/paths/13-supplier/05_billing_data.spec.js @@ -0,0 +1,52 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Supplier billing data path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('administrative', 'supplier'); + await page.accessToSearchResult('442'); + await page.accessToSection('supplier.card.billingData'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should edit the billing data', async() => { + await page.autocompleteSearch(selectors.supplierBillingData.payMethod, 'PayMethod with IBAN'); + await page.autocompleteSearch(selectors.supplierBillingData.payDem, '10'); + await page.clearInput(selectors.supplierBillingData.payDay); + await page.write(selectors.supplierBillingData.payDay, '19'); + await page.waitToClick(selectors.supplierBillingData.saveButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + + it('should reload the section', async() => { + await page.reloadSection('supplier.card.billingData'); + }); + + it('should check the pay method was edited', async() => { + const result = await page.waitToGetProperty(selectors.supplierBillingData.payMethod, 'value'); + + expect(result).toEqual('PayMethod with IBAN'); + }); + + it('should check the payDem was edited', async() => { + const result = await page.waitToGetProperty(selectors.supplierBillingData.payDem, 'value'); + + expect(result).toEqual('10'); + }); + + it('should check the pay day was edited', async() => { + const result = await page.waitToGetProperty(selectors.supplierBillingData.payDay, 'value'); + + expect(result).toEqual('19'); + }); +}); diff --git a/modules/supplier/front/billing-data/index.html b/modules/supplier/front/billing-data/index.html index 2cb3f7c4b9..0fb7011b89 100644 --- a/modules/supplier/front/billing-data/index.html +++ b/modules/supplier/front/billing-data/index.html @@ -52,12 +52,13 @@ diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index 31a358ef12..47f742a70b 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -84,7 +84,8 @@ "description": "Billing data", "params": { "supplier": "$ctrl.supplier" - } + }, + "acl": ["administrative"] } ] } \ No newline at end of file