mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 12:20:45 -03:30
Fixes hint/lint errors in workflow viz test
This commit is contained in:
parent
17cc82d946
commit
51669c9765
@ -14,7 +14,7 @@ const workflowSearchBar = "//input[contains(@class, 'SmartSearch-input')]";
|
||||
const workflowText = 'name.iexact:"test-actions-workflow-template"';
|
||||
const workflowSearchBadgeCount = '//span[contains(@class, "at-Panel-headingTitleBadge") and contains(text(), "1")]';
|
||||
|
||||
const startNodeId = "1";
|
||||
const startNodeId = '1';
|
||||
let initialJobNodeId;
|
||||
let initialProjectNodeId;
|
||||
let initialInventoryNodeId;
|
||||
@ -44,13 +44,8 @@ const linkSelectButton = "//*[@id='workflow_maker_select_link_btn']";
|
||||
const nodeCancelButton = "//*[@id='workflow_maker_cancel_node_btn']";
|
||||
const deleteConfirmation = "//button[@ng-click='confirmDeleteNode()']";
|
||||
|
||||
const xPathNodeById = (id) => {
|
||||
return `//*[@id='node-${id}']`;
|
||||
};
|
||||
|
||||
const xPathLinkById = (sourceId, targetId) => {
|
||||
return `//*[@id='link-${sourceId}-${targetId}']//*[contains(@class, 'WorkflowChart-linkPath')]`;
|
||||
};
|
||||
const xPathNodeById = (id) => `//*[@id='node-${id}']`;
|
||||
const xPathLinkById = (sourceId, targetId) => `//*[@id='link-${sourceId}-${targetId}']//*[contains(@class, 'WorkflowChart-linkPath')]`;
|
||||
|
||||
module.exports = {
|
||||
before: (client, done) => {
|
||||
@ -83,14 +78,14 @@ module.exports = {
|
||||
.waitForElementVisible('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-job")]/..');
|
||||
|
||||
// Grab the ids of the nodes
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-job")]/..', 'id', function(res) {
|
||||
initialJobNodeId = res.value.split('-')[1];
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-job")]/..', 'id', (res) => {
|
||||
initialJobNodeId = res.value.split('-')[1];
|
||||
});
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-project")]/..', 'id', function(res) {
|
||||
initialProjectNodeId = res.value.split('-')[1];
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-project")]/..', 'id', (res) => {
|
||||
initialProjectNodeId = res.value.split('-')[1];
|
||||
});
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-inventory")]/..', 'id', function(res) {
|
||||
initialInventoryNodeId = res.value.split('-')[1];
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-inventory")]/..', 'id', (res) => {
|
||||
initialInventoryNodeId = res.value.split('-')[1];
|
||||
});
|
||||
},
|
||||
'verify that workflow visualizer new root node can only be set to always': client => {
|
||||
@ -134,8 +129,8 @@ module.exports = {
|
||||
.waitForElementNotVisible(spinny);
|
||||
|
||||
// Grab the id of the new child node for later
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-isNodeBeingAdded")]/..', 'id', function(res) {
|
||||
newChildNodeId = res.value.split('-')[1];
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-isNodeBeingAdded")]/..', 'id', (res) => {
|
||||
newChildNodeId = res.value.split('-')[1];
|
||||
});
|
||||
|
||||
client
|
||||
@ -163,35 +158,34 @@ module.exports = {
|
||||
.waitForElementNotVisible(spinny);
|
||||
|
||||
// Grab the id of the new child node for later
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-isNodeBeingAdded")]/..', 'id', function(res) {
|
||||
// I had to nest this logic in order to ensure that leafNodeId was available later on.
|
||||
// Separating this out resulted in leafNodeId being `undefined` when sent to xPathLinkById
|
||||
leafNodeId = res.value.split('-')[1];
|
||||
client
|
||||
.clearValue(jobSearchBar)
|
||||
.setValue(jobSearchBar, [testActionsJobText, client.Keys.ENTER])
|
||||
.pause(1000)
|
||||
.findThenClick(testActionsJob)
|
||||
.pause(1000)
|
||||
.waitForElementNotVisible(spinny)
|
||||
.findThenClick(edgeTypeDropdownBar)
|
||||
.waitForElementPresent(successDropdown)
|
||||
.waitForElementPresent(failureDropdown)
|
||||
.waitForElementPresent(alwaysDropdown)
|
||||
.findThenClick(alwaysDropdown)
|
||||
.click(nodeSelectButton)
|
||||
.moveToElement(xPathNodeById(newChildNodeId), 0, 0, () => {
|
||||
client.pause(500);
|
||||
client.waitForElementNotVisible(spinny);
|
||||
client.click(xPathNodeById(newChildNodeId) + nodeRemove);
|
||||
})
|
||||
.pause(1000)
|
||||
.waitForElementNotVisible(spinny)
|
||||
.findThenClick(deleteConfirmation)
|
||||
.waitForElementVisible(xPathLinkById(initialJobNodeId, leafNodeId));
|
||||
client.getAttribute('//*[contains(@class, "WorkflowChart-isNodeBeingAdded")]/..', 'id', (res) => {
|
||||
// I had to nest this logic in order to ensure that leafNodeId was available later on.
|
||||
// Separating this out resulted in leafNodeId being `undefined` when sent to
|
||||
// xPathLinkById
|
||||
leafNodeId = res.value.split('-')[1];
|
||||
client
|
||||
.clearValue(jobSearchBar)
|
||||
.setValue(jobSearchBar, [testActionsJobText, client.Keys.ENTER])
|
||||
.pause(1000)
|
||||
.findThenClick(testActionsJob)
|
||||
.pause(1000)
|
||||
.waitForElementNotVisible(spinny)
|
||||
.findThenClick(edgeTypeDropdownBar)
|
||||
.waitForElementPresent(successDropdown)
|
||||
.waitForElementPresent(failureDropdown)
|
||||
.waitForElementPresent(alwaysDropdown)
|
||||
.findThenClick(alwaysDropdown)
|
||||
.click(nodeSelectButton)
|
||||
.moveToElement(xPathNodeById(newChildNodeId), 0, 0, () => {
|
||||
client.pause(500);
|
||||
client.waitForElementNotVisible(spinny);
|
||||
client.click(xPathNodeById(newChildNodeId) + nodeRemove);
|
||||
})
|
||||
.pause(1000)
|
||||
.waitForElementNotVisible(spinny)
|
||||
.findThenClick(deleteConfirmation)
|
||||
.waitForElementVisible(xPathLinkById(initialJobNodeId, leafNodeId));
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user