From c0f3fea407d0ead106d0b3b3c9cb33d7d9df838e Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 10 Feb 2020 12:12:49 +0100 Subject: [PATCH 1/2] #1940 e2e client.phone --- e2e/helpers/selectors.js | 7 ++++ .../04_edit_billing_data.spec.js | 2 +- .../02-client-module/18_contacts.spec.js | 37 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 e2e/paths/02-client-module/18_contacts.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 63e5ddf2f..6b8ae2aeb 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -185,6 +185,13 @@ export default { firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor', acceptDeleteButton: '.vn-confirm.shown button[response="accept"]' }, + clientContacts: { + addContactButton: 'vn-client-contact vn-icon[icon="add_circle"]', + name: 'vn-client-contact vn-textfield[ng-model="contact.name"]', + phone: 'vn-client-contact vn-textfield[ng-model="contact.phone"]', + deleteFirstPhone: 'vn-client-contact vn-icon[icon="delete"]', + saveButton: 'button[type=submit]' + }, itemsIndex: { searchIcon: 'vn-searchbar vn-icon[icon="search"]', createItemButton: `vn-float-button`, diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index 7e8df8aa8..b757940be 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -60,7 +60,7 @@ describe('Client Edit billing data path', () => { }); it(`should save the form with all its new data`, async() => { - await page.waitFor(2000); + await page.waitFor(3000); await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitToClick(selectors.clientBillingData.saveButton); let snackbarMessage = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/18_contacts.spec.js b/e2e/paths/02-client-module/18_contacts.spec.js new file mode 100644 index 000000000..252c5d667 --- /dev/null +++ b/e2e/paths/02-client-module/18_contacts.spec.js @@ -0,0 +1,37 @@ +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Client contacts', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Clark Kent'); + await page.accessToSection('client.card.contact'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should add a contact', async() => { + await page.waitToClick(selectors.clientContacts.addContactButton); + await page.clearInput(selectors.clientContacts.name); + await page.write(selectors.clientContacts.name, 'Ansible'); + await page.write(selectors.clientContacts.phone, 'FTL comms'); + await page.waitToClick(selectors.clientContacts.saveButton); + let result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should delete de contact', async() => { + await page.waitToClick(selectors.clientContacts.deleteFirstPhone); + await page.waitToClick(selectors.clientContacts.saveButton); + let result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); +}); From 80839c771ebe47442e799e9f2904b247dcd5324a Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 10 Feb 2020 12:57:00 +0100 Subject: [PATCH 2/2] updated a selector --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 07aef93c1..99c78eea2 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -93,7 +93,7 @@ export default { newBankEntityBIC: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newBankEntity.bic"]', newBankEntityCode: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newBankEntity.id"]', acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]', - saveButton: `button[type=submit]`, + saveButton: 'vn-client-billing-data button[type=submit]', watcher: 'vn-client-billing-data vn-watcher' }, clientAddresses: {