diff --git a/awx/ui/client/src/configuration/auth-form/configuration-auth.controller.js b/awx/ui/client/src/configuration/auth-form/configuration-auth.controller.js index 5b80e40ddb..66d2f8818d 100644 --- a/awx/ui/client/src/configuration/auth-form/configuration-auth.controller.js +++ b/awx/ui/client/src/configuration/auth-form/configuration-auth.controller.js @@ -82,7 +82,7 @@ export default [ }; var activeForm = function() { - if(!$scope.$parent[formTracker.currentFormName()].$dirty) { + if(!_.get($scope.$parent, [formTracker.currentFormName(), '$dirty'])) { authVm.activeAuthForm = getActiveAuthForm(); formTracker.setCurrentAuth(authVm.activeAuthForm); startCodeMirrors(); diff --git a/awx/ui/client/src/configuration/configuration.controller.js b/awx/ui/client/src/configuration/configuration.controller.js index 9752522e9d..db0696ddaf 100644 --- a/awx/ui/client/src/configuration/configuration.controller.js +++ b/awx/ui/client/src/configuration/configuration.controller.js @@ -169,7 +169,7 @@ export default [ setCurrentSystem: function(form) { this.currentSystem = form; this.setCurrent(this.currentSystem); - } + }, }; // Default to auth form and tab @@ -275,7 +275,13 @@ export default [ vm.activeTab = setForm; if (setForm !== 'license') { - formTracker.setCurrent(setForm); + if (setForm === 'auth') { + formTracker.setCurrentAuth(formTracker.currentAuth); + } else if (setForm === 'system') { + formTracker.setCurrentSystem(formTracker.currenSystem); + } else { + formTracker.setCurrent(setForm); + } $state.go('configuration', { currentTab: setForm diff --git a/awx/ui/client/src/configuration/configuration.partial.html b/awx/ui/client/src/configuration/configuration.partial.html index c7f65fd05e..47f9abfe10 100644 --- a/awx/ui/client/src/configuration/configuration.partial.html +++ b/awx/ui/client/src/configuration/configuration.partial.html @@ -7,16 +7,47 @@
-
CONFIGURE {{BRAND_NAME}}
+
CONFIGURE {{ BRAND_NAME }}
-
Authentication
-
Jobs
-
System
-
User Interface
-
License
+
+ Authentication +
+
+ Jobs +
+
+ System +
+
+ User Interface +
+
+ License +
diff --git a/awx/ui/client/src/configuration/system-form/configuration-system.controller.js b/awx/ui/client/src/configuration/system-form/configuration-system.controller.js index 11a631aca3..68a01f6a2c 100644 --- a/awx/ui/client/src/configuration/system-form/configuration-system.controller.js +++ b/awx/ui/client/src/configuration/system-form/configuration-system.controller.js @@ -47,7 +47,7 @@ export default [ } var activeForm = function() { - if(!$scope.$parent[formTracker.currentFormName()].$dirty) { + if(!_.get($scope.$parent, [formTracker.currentFormName(), '$dirty'])) { systemVm.activeSystemForm = systemVm.dropdownValue; formTracker.setCurrentSystem(systemVm.activeSystemForm); } else { diff --git a/awx/ui/test/e2e/objects/configuration.js b/awx/ui/test/e2e/objects/configuration.js new file mode 100644 index 0000000000..fdf45677a9 --- /dev/null +++ b/awx/ui/test/e2e/objects/configuration.js @@ -0,0 +1,40 @@ +import breadcrumb from './sections/breadcrumb'; +import header from './sections/header'; +import navigation from './sections/navigation'; + +const sections = { + header, + navigation, + breadcrumb, +}; + +const commands = [{ + load () { + this.api.url('data:,'); // https://github.com/nightwatchjs/nightwatch/issues/1724 + return this.navigate(); + }, + selectSubcategory (name) { + const spinny = 'div.spinny'; + const select = '#configure-dropdown-nav'; + const arrow = `${select} + span span[class$="arrow"]`; + const option = `//li[contains(text(), "${name}")]`; + + this.api.waitForElementVisible(arrow); + this.api.click(arrow); + + this.api.useXpath(); + this.api.waitForElementVisible(option); + this.api.click(option); + this.api.useCss(); + + return this; + }, +}]; + +module.exports = { + url () { + return `${this.api.globals.launch_url}/#/configuration`; + }, + sections, + commands, +}; diff --git a/awx/ui/test/e2e/objects/dashboard.js b/awx/ui/test/e2e/objects/dashboard.js new file mode 100644 index 0000000000..ca6695ca5c --- /dev/null +++ b/awx/ui/test/e2e/objects/dashboard.js @@ -0,0 +1,24 @@ +import breadcrumb from './sections/breadcrumb'; +import header from './sections/header'; +import navigation from './sections/navigation'; + +const sections = { + header, + navigation, + breadcrumb, +}; + +const commands = [{ + load () { + this.api.url('data:,'); // https://github.com/nightwatchjs/nightwatch/issues/1724 + return this.navigate(); + } +}]; + +module.exports = { + url () { + return `${this.api.globals.launch_url}/#/home`; + }, + sections, + commands, +}; diff --git a/awx/ui/test/e2e/objects/sections/navigation.js b/awx/ui/test/e2e/objects/sections/navigation.js index 62f3359202..2ac257f1dd 100644 --- a/awx/ui/test/e2e/objects/sections/navigation.js +++ b/awx/ui/test/e2e/objects/sections/navigation.js @@ -17,7 +17,8 @@ const navigation = { inventoryScripts: 'i[class$="fa-code"]', notifications: 'i[class$="fa-bell"]', managementJobs: 'i[class$="fa-wrench"]', - instanceGroups: 'i[class$="fa-server"]' + instanceGroups: 'i[class$="fa-server"]', + settings: 'i[class$="fa-cog"]', } }; diff --git a/awx/ui/test/e2e/tests/test-configuration-ldap-fields.js b/awx/ui/test/e2e/tests/test-configuration-ldap-fields.js new file mode 100644 index 0000000000..181e33f509 --- /dev/null +++ b/awx/ui/test/e2e/tests/test-configuration-ldap-fields.js @@ -0,0 +1,61 @@ +module.exports = { + 'expected LDAP codemirror fields are rendered when returning from another tab': client => { + const authTab = '#auth_tab'; + const authView = 'div[ui-view="auth"]'; + const ldapForm = '#configuration_ldap_template_form'; + const systemTab = '#system_tab'; + const systemView = 'div[ui-view="system"]'; + + const { navigation } = client.page.dashboard().section; + const configuration = client.page.configuration(); + + client.login(); + client.waitForAngular(); + + navigation + .waitForElementVisible('@settings') + .click('@settings'); + + configuration.waitForElementVisible(authView); + + configuration.waitForElementVisible(systemTab); + configuration.click(systemTab); + + configuration.waitForElementNotVisible(authView); + configuration.waitForElementVisible(systemView); + + configuration.waitForElementVisible(authTab); + configuration.click(authTab); + + configuration.waitForElementNotVisible(systemView); + configuration.waitForElementVisible(authView); + + configuration.selectSubcategory('LDAP'); + configuration.waitForElementVisible(ldapForm); + + const expectedCodemirrorFields = [ + 'AUTH_LDAP_USER_SEARCH', + 'AUTH_LDAP_GROUP_SEARCH', + 'AUTH_LDAP_USER_ATTR_MAP', + 'AUTH_LDAP_GROUP_TYPE_PARAMS', + 'AUTH_LDAP_USER_FLAGS_BY_GROUP', + 'AUTH_LDAP_ORGANIZATION_MAP', + 'AUTH_LDAP_TEAM_MAP', + ]; + + const ldapCodeMirrors = `${ldapForm} div[class^="CodeMirror"] textarea`; + + client.elements('css selector', ldapCodeMirrors, ({ value }) => { + client.assert.equal(value.length, expectedCodemirrorFields.length); + }); + + expectedCodemirrorFields.forEach(fieldName => { + const codemirror = `#cm-${fieldName}-container div[class^="CodeMirror"]`; + + configuration.expect.element(codemirror).visible; + configuration.expect.element(codemirror).enabled; + }); + + client.end(); + }, +};