diff --git a/awx/ui/client/features/templates/templatesList.view.html b/awx/ui/client/features/templates/templatesList.view.html index 5aed695f57..e047b02ab6 100644 --- a/awx/ui/client/features/templates/templatesList.view.html +++ b/awx/ui/client/features/templates/templatesList.view.html @@ -35,7 +35,7 @@ - + +
- {{:: vm.strings.get('prompt.INVENTORY') }} - {{:: vm.strings.get('prompt.CREDENTIAL') }} - {{:: vm.strings.get('prompt.OTHER_PROMPTS') }} - {{:: vm.strings.get('prompt.SURVEY') }} - {{:: vm.strings.get('prompt.PREVIEW') }} + {{:: vm.strings.get('prompt.INVENTORY') }} + {{:: vm.strings.get('prompt.CREDENTIAL') }} + {{:: vm.strings.get('prompt.OTHER_PROMPTS') }} + {{:: vm.strings.get('prompt.SURVEY') }} + {{:: vm.strings.get('prompt.PREVIEW') }}
-
+
-
+
-
+
-
+
-
+
diff --git a/awx/ui/test/e2e/objects/templates.js b/awx/ui/test/e2e/objects/templates.js index 062d62c0ce..457ccf091d 100644 --- a/awx/ui/test/e2e/objects/templates.js +++ b/awx/ui/test/e2e/objects/templates.js @@ -11,7 +11,7 @@ import pagination from './sections/pagination'; import permissions from './sections/permissions'; import search from './sections/search'; -const details = createFormSection({ +const jtDetails = createFormSection({ selector: 'form', props: { formElementSelectors: [ @@ -31,6 +31,25 @@ const details = createFormSection({ } }); +const wfjtDetails = createFormSection({ + selector: 'form', + props: { + formElementSelectors: [ + '#workflow_job_template_form .Form-textInput', + '#workflow_job_template_form select.Form-dropDown', + '#workflow_job_template_form .Form-textArea', + '#workflow_job_template_form input[type="checkbox"]', + '#workflow_job_template_form .ui-spinner-input', + '#workflow_job_template_form .ScheduleToggle-switch' + ] + }, + labels: { + name: 'Name', + description: 'Description' + + } +}); + const lookupInventory = _.merge({}, lookupModal, { locateStrategy: 'xpath', selector: './/div[text()="Select inventory"]/ancestor::div[contains(@class, "modal-content")]' @@ -54,7 +73,7 @@ module.exports = { addJobTemplate: { selector: 'div[ui-view="form"]', sections: { - details + jtDetails }, elements: { title: 'div[class^="Form-title"]' @@ -63,7 +82,7 @@ module.exports = { editJobTemplate: { selector: 'div[ui-view="form"]', sections: { - details, + jtDetails, permissions }, elements: { @@ -73,7 +92,7 @@ module.exports = { addWorkflowJobTemplate: { selector: 'div[ui-view="form"]', sections: { - details + wfjtDetails }, elements: { title: 'div[class^="Form-title"]' @@ -82,7 +101,7 @@ module.exports = { editWorkflowJobTemplate: { selector: 'div[ui-view="form"]', sections: { - details, + wfjtDetails, permissions }, elements: { @@ -90,7 +109,7 @@ module.exports = { } }, list: { - selector: '.Panel', + selector: '.at-Panel', elements: { badge: 'span[class~="badge"]', title: 'div[class="List-titleText"]', diff --git a/awx/ui/test/e2e/tests/test-launch-jt.js b/awx/ui/test/e2e/tests/test-launch-jt.js new file mode 100644 index 0000000000..c2127d8dda --- /dev/null +++ b/awx/ui/test/e2e/tests/test-launch-jt.js @@ -0,0 +1,170 @@ +import { post, patch } from '../api'; +import { + getOrCreate, + getProject, + getInventory +} from '../fixtures'; + +let templateReferences = {}; + +module.exports = { + before: (client, done) => { + const resources = [ + getProject('test-launch-jt'), + getInventory('test-launch-jt') + ]; + + Promise.all(resources) + .then(([project, inventory]) => { + const noPromptPromise = getOrCreate('/job_templates/', { + name: `test-launch-jt-no-prompts`, + inventory: inventory.id, + project: project.id, + playbook: 'hello_world.yml', + }); + + const promptNoPassPromise = getOrCreate('/job_templates/', { + name: `test-launch-jt-prompts-no-pass`, + inventory: inventory.id, + ask_inventory_on_launch: true, + project: project.id, + playbook: 'hello_world.yml', + ask_diff_mode_on_launch: true, + ask_variables_on_launch: true, + ask_limit_on_launch: true, + ask_tags_on_launch: true, + ask_skip_tags_on_launch: true, + ask_job_type_on_launch: true, + ask_verbosity_on_launch: true, + ask_credential_on_launch: true + }); + + Promise.all([noPromptPromise, promptNoPassPromise]) + .then(([noPrompt, promptNoPass]) => { + templateReferences = {noPrompt, promptNoPass}; + let surveyPost = post(promptNoPass.related.survey_spec, { + name: "", + description: "", + spec: [{ + question_name: "Foo", + question_description: "", + required: true, + type: "text", + variable: "foo", + min: 0, + max: 1024, + default: "bar", + choices: "", + new_question: true + }] + }); + let surveyPatch = patch(promptNoPass.url, { survey_enabled: true }); + Promise.all([surveyPost, surveyPatch]) + .then(done); + }); + }); + }, + 'login to awx': client => { + client.login(); + client.resizeWindow(1200, 800); + client.waitForAngular(); + }, + 'expected jt launch with no prompts to navigate to job details': client => { + const templates = client.page.templates(); + templates.load(); + + templates.waitForElementVisible('input[class*="SmartSearch-input"]'); + + templates.section.list.section.search + .sendKeys('@input', `id:${templateReferences.noPrompt.id}`); + // work in progress trying to check search input for correct text + // templates.section.list.section.search.getText('@input', function(result) { + // client.assert.equal(result.value, `id:${templateReferences.noPrompt.id}`); + // }); + templates.section.list.section.search.click('i[class$="search"]'); + + templates.waitForElementVisible('div.spinny'); + templates.waitForElementNotVisible('div.spinny'); + + templates.expect.element(`#templates_list .at-Row[id="row-${templateReferences.noPrompt.id}"]`).visible; + templates.expect.element('i[class*="icon-launch"]').visible; + templates.expect.element('i[class*="icon-launch"]').enabled; + + templates.click('i[class*="icon-launch"]'); + templates.waitForElementVisible('div.spinny'); + templates.waitForElementNotVisible('div.spinny'); + + client.waitForElementVisible('at-job-details'); + }, + 'expected jt launch with prompts but no changes to navigate to job details': client => { + const templates = client.page.templates(); + + templates.load(); + templates.waitForElementVisible('input[class*="SmartSearch-input"]', 5000); + + templates.section.list.section.search + .sendKeys('@input', `id:${templateReferences.promptNoPass.id}`); + templates.section.list.section.search.click('i[class$="search"]'); + + templates.waitForElementVisible('div.spinny'); + templates.waitForElementNotVisible('div.spinny'); + + templates.expect.element(`#templates_list .at-Row[id="row-${templateReferences.promptNoPass.id}"]`).visible; + templates.expect.element('i[class*="icon-launch"]').visible; + templates.expect.element('i[class*="icon-launch"]').enabled; + + templates.click('i[class*="icon-launch"]'); + + templates.waitForElementVisible('.Prompt-previewTag'); + + templates.expect.element('#prompt_inventory_tab').visible; + templates.expect.element('#prompt_inventory_tab').to.have.attribute('class').which.contains('at-Tab--active'); + templates.expect.element('#prompt_inventory_next').visible; + templates.expect.element('#prompt_inventory_next').enabled; + + templates.click('#prompt_inventory_next'); + + templates.waitForElementVisible('#prompt_credential_step'); + + templates.expect.element('#prompt_credential_tab').visible; + templates.expect.element('#prompt_credential_tab').to.have.attribute('class').which.contains('at-Tab--active'); + templates.expect.element('#prompt_credential_next').visible; + templates.expect.element('#prompt_credential_next').enabled; + + templates.click('#prompt_credential_next'); + + templates.waitForElementVisible('#prompt_other_prompts_step'); + + templates.expect.element('#prompt_other_prompts_tab').visible; + templates.expect.element('#prompt_other_prompts_tab').to.have.attribute('class').which.contains('at-Tab--active'); + templates.expect.element('#prompt_other_prompts_next').visible; + templates.expect.element('#prompt_other_prompts_next').enabled; + + templates.click('#prompt_other_prompts_next'); + + templates.waitForElementVisible('#prompt_survey_step'); + + templates.expect.element('#prompt_survey_tab').visible; + templates.expect.element('#prompt_survey_tab').to.have.attribute('class').which.contains('at-Tab--active'); + templates.expect.element('#prompt_survey_next').visible; + templates.expect.element('#prompt_survey_next').enabled; + + templates.click('#prompt_survey_next'); + + templates.waitForElementVisible('#prompt_preview_step'); + + templates.expect.element('#prompt_preview_tab').visible; + templates.expect.element('#prompt_preview_tab').to.have.attribute('class').which.contains('at-Tab--active'); + templates.expect.element('#prompt_finish').visible; + templates.expect.element('#prompt_finish').enabled; + + templates.click('#prompt_finish'); + + templates.waitForElementVisible('div.spinny'); + templates.waitForElementNotVisible('div.spinny'); + + client.waitForElementVisible('at-job-details'); + + client.end(); + } +};