From b02677a8d08e5fa4549f1cd3c46368c011234002 Mon Sep 17 00:00:00 2001 From: Daniel Sami Date: Tue, 9 Oct 2018 16:32:24 -0400 Subject: [PATCH] Initial commit for UI tests for always nodes --- awx/ui/test/e2e/commands/findThenClick.js | 7 +++ .../e2e/tests/test-workflow-visualizer.js | 53 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 awx/ui/test/e2e/commands/findThenClick.js create mode 100644 awx/ui/test/e2e/tests/test-workflow-visualizer.js diff --git a/awx/ui/test/e2e/commands/findThenClick.js b/awx/ui/test/e2e/commands/findThenClick.js new file mode 100644 index 0000000000..908f1a190b --- /dev/null +++ b/awx/ui/test/e2e/commands/findThenClick.js @@ -0,0 +1,7 @@ +exports.command = function findThenClick (selector) { + this + .waitForElementPresent(selector) + .moveToElement(selector, 0, 0) + .click(selector); + return this; +}; diff --git a/awx/ui/test/e2e/tests/test-workflow-visualizer.js b/awx/ui/test/e2e/tests/test-workflow-visualizer.js new file mode 100644 index 0000000000..497de1b52b --- /dev/null +++ b/awx/ui/test/e2e/tests/test-workflow-visualizer.js @@ -0,0 +1,53 @@ +import { + getInventorySource, + getJobTemplate, + getProject, + getWorkflowTemplate +} from '../fixtures'; + +let data; +const workflowTemplateNavTab = "//at-side-nav-item[contains(@name, 'TEMPLATES')]"; +const workflowSelector = "//a[contains(text(), 'test-actions-workflow-template')]"; +const workflowVisualizerBtn = "//button[contains(@id, 'workflow_job_template_workflow_visualizer_btn')]"; + +const rootNode = "//*[@id='node-2']"; +const childNode = ""; +const leafNode = "//g[contains(@id, 'node-1')]"; +const project = "//td[contains(text(), 'test-actions-project')]"; +const edgeTypeDropdown = "//span[contains(@id, 'select2-workflow_node_edge-container')]"; +const alwaysDropdown = "//*[@id='select2-workflow_node_edge-result-elm7-always']" +const successDropdown = "//*[@id='select2-workflow_node_edge-result-veyc-success']" +const failureDropdown = "//*[@id='select2-workflow_node_edge-result-xitr-failure']" + +module.exports = { + before: (client, done) => { + const resources = [ + getInventorySource('test-actions'), + getJobTemplate('test-actions'), + getProject('test-actions'), + getWorkflowTemplate('test-actions'), + ]; + + Promise.all(resources) + .then(([source, template, project, workflow]) => { + data = { source, template, project, workflow }; + done(); + }); + client + .login() + .waitForAngular() + .resizeWindow(1200, 1000) + .useXpath() + .findThenClick(workflowTemplateNavTab) + .pause(1000) + .findThenClick(workflowSelector) + .findThenClick(workflowVisualizerBtn); + }, + 'verify that workflow visualizer root node can only be set to always': client => { + client + .useXpath() + .findThenClick(rootNode) + .findThenClick(project) + .findThenClick(edgeTypeDropdown); + }, +};