From 3650567caf3896a4a61b7b731da8df6c8928b9a3 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 19 May 2022 15:02:39 +0200 Subject: [PATCH] test(account): e2e for ldap and samba --- e2e/helpers/selectors.js | 18 +++++++++++++++ e2e/paths/14-account/07_ldap.spec.js | 32 +++++++++++++++++++++++++++ e2e/paths/14-account/08_samba.spec.js | 32 +++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 e2e/paths/14-account/07_ldap.spec.js create mode 100644 e2e/paths/14-account/08_samba.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 44facb13b..770911d0e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -124,6 +124,24 @@ export default { syncUserPassword: 'vn-textfield[ng-model="$ctrl.syncPassword"]', buttonAccept: 'button[response="accept"]' }, + accountLdap: { + checkEnable: 'vn-account-ldap vn-check[ng-model="watcher.hasData"]', + server: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.server"]', + rdn: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.rdn"]', + password: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.password"]', + userDn: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.userDn"]', + groupDn: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.groupDn"]', + save: 'vn-account-ldap vn-submit' + }, + accountSamba: { + checkEnable: 'vn-account-samba vn-check[ng-model="watcher.hasData"]', + adDomain: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adDomain"]', + adController: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adController"]', + adUser: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adUser"]', + adPassword: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adPassword"]', + verifyCert: 'vn-account-samba vn-check[ng-model="$ctrl.config.verifyCert"]', + save: 'vn-account-samba vn-submit' + }, clientsIndex: { createClientButton: `vn-float-button` }, diff --git a/e2e/paths/14-account/07_ldap.spec.js b/e2e/paths/14-account/07_ldap.spec.js new file mode 100644 index 000000000..a3b8137d3 --- /dev/null +++ b/e2e/paths/14-account/07_ldap.spec.js @@ -0,0 +1,32 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Account LDAP path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('sysadmin', 'account'); + await page.accessToSection('account.ldap'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should set data and save', async() => { + await page.waitToClick(selectors.accountLdap.checkEnable); + await page.write(selectors.accountLdap.server, '1234'); + await page.write(selectors.accountLdap.rdn, '1234'); + await page.write(selectors.accountLdap.password, 'nightmare'); + await page.write(selectors.accountLdap.userDn, 'sysadmin'); + await page.write(selectors.accountLdap.groupDn, '1234'); + await page.waitToClick(selectors.accountLdap.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); +}); diff --git a/e2e/paths/14-account/08_samba.spec.js b/e2e/paths/14-account/08_samba.spec.js new file mode 100644 index 000000000..c3db026dc --- /dev/null +++ b/e2e/paths/14-account/08_samba.spec.js @@ -0,0 +1,32 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Account Samba path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('sysadmin', 'account'); + await page.accessToSection('account.samba'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should set data and save', async() => { + await page.waitToClick(selectors.accountSamba.checkEnable); + await page.write(selectors.accountSamba.adDomain, '1234'); + await page.write(selectors.accountSamba.adController, '1234'); + await page.write(selectors.accountSamba.adUser, 'nightmare'); + await page.write(selectors.accountSamba.adPassword, 'sysadmin'); + await page.waitToClick(selectors.accountSamba.verifyCert); + await page.waitToClick(selectors.accountSamba.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); +});