From 18ed685c75fed92e045bed97b50d245eaa1fd4d1 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 5 Nov 2020 13:53:19 +0100 Subject: [PATCH] e2e path for supplier basic data --- e2e/helpers/selectors.js | 6 +- e2e/paths/13-supplier/02_basic_data.spec.js | 60 +++++++++++++++++++ ...{02_contact.spec.js => 04_contact.spec.js} | 0 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 e2e/paths/13-supplier/02_basic_data.spec.js rename e2e/paths/13-supplier/{02_contact.spec.js => 04_contact.spec.js} (100%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 02c749b3c..3df6eec8c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -925,7 +925,11 @@ export default { thirdContactDeleteButton: 'vn-supplier-contact div:nth-child(3) vn-icon-button[icon="delete"]' }, supplierBasicData: { - + alias: 'vn-supplier-basic-data vn-textfield[ng-model="$ctrl.supplier.nickname"]', + isOfficial: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isOfficial"]', + isActive: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isActive"]', + notes: 'vn-supplier-basic-data vn-textarea[ng-model="$ctrl.supplier.note"]', + saveButton: 'vn-supplier-basic-data button[type="submit"]', }, supplierFiscalData: { socialName: 'vn-supplier-fiscal-data vn-textfield[ng-model="$ctrl.supplier.name"]', diff --git a/e2e/paths/13-supplier/02_basic_data.spec.js b/e2e/paths/13-supplier/02_basic_data.spec.js new file mode 100644 index 000000000..1e283749d --- /dev/null +++ b/e2e/paths/13-supplier/02_basic_data.spec.js @@ -0,0 +1,60 @@ +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; + await page.loginAndModule('administrative', 'supplier'); + 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'); + await page.waitToClick(selectors.supplierBasicData.isOfficial); + await page.waitToClick(selectors.supplierBasicData.isActive); + await page.write(selectors.supplierBasicData.notes, 'Some notes'); + + await page.waitToClick(selectors.supplierBasicData.saveButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toBe('Data saved!'); + }); + + 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'); + }); + + it('should check the isOffical checkbox is now unchecked', async() => { + const result = await page.checkboxState(selectors.supplierBasicData.isOfficial); + + 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'); + }); + + it('should check the notes were edited', async() => { + const result = await page.waitToGetProperty(selectors.supplierBasicData.notes, 'value'); + + expect(result).toEqual('Some notes'); + }); +}); diff --git a/e2e/paths/13-supplier/02_contact.spec.js b/e2e/paths/13-supplier/04_contact.spec.js similarity index 100% rename from e2e/paths/13-supplier/02_contact.spec.js rename to e2e/paths/13-supplier/04_contact.spec.js