Fixes hint/lint errors in workflow viz test

This commit is contained in:
mabashian
2018-11-27 16:08:11 -05:00
parent 17cc82d946
commit 51669c9765

View File

@@ -14,7 +14,7 @@ const workflowSearchBar = "//input[contains(@class, 'SmartSearch-input')]";
const workflowText = 'name.iexact:"test-actions-workflow-template"'; const workflowText = 'name.iexact:"test-actions-workflow-template"';
const workflowSearchBadgeCount = '//span[contains(@class, "at-Panel-headingTitleBadge") and contains(text(), "1")]'; const workflowSearchBadgeCount = '//span[contains(@class, "at-Panel-headingTitleBadge") and contains(text(), "1")]';
const startNodeId = "1"; const startNodeId = '1';
let initialJobNodeId; let initialJobNodeId;
let initialProjectNodeId; let initialProjectNodeId;
let initialInventoryNodeId; let initialInventoryNodeId;
@@ -44,13 +44,8 @@ const linkSelectButton = "//*[@id='workflow_maker_select_link_btn']";
const nodeCancelButton = "//*[@id='workflow_maker_cancel_node_btn']"; const nodeCancelButton = "//*[@id='workflow_maker_cancel_node_btn']";
const deleteConfirmation = "//button[@ng-click='confirmDeleteNode()']"; const deleteConfirmation = "//button[@ng-click='confirmDeleteNode()']";
const xPathNodeById = (id) => { const xPathNodeById = (id) => `//*[@id='node-${id}']`;
return `//*[@id='node-${id}']`; const xPathLinkById = (sourceId, targetId) => `//*[@id='link-${sourceId}-${targetId}']//*[contains(@class, 'WorkflowChart-linkPath')]`;
};
const xPathLinkById = (sourceId, targetId) => {
return `//*[@id='link-${sourceId}-${targetId}']//*[contains(@class, 'WorkflowChart-linkPath')]`;
};
module.exports = { module.exports = {
before: (client, done) => { before: (client, done) => {
@@ -83,14 +78,14 @@ module.exports = {
.waitForElementVisible('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-job")]/..'); .waitForElementVisible('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-job")]/..');
// Grab the ids of the nodes // Grab the ids of the nodes
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-job")]/..', 'id', function(res) { client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-job")]/..', 'id', (res) => {
initialJobNodeId = res.value.split('-')[1]; initialJobNodeId = res.value.split('-')[1];
}); });
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-project")]/..', 'id', function(res) { client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-project")]/..', 'id', (res) => {
initialProjectNodeId = res.value.split('-')[1]; initialProjectNodeId = res.value.split('-')[1];
}); });
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-inventory")]/..', 'id', function(res) { client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-inventory")]/..', 'id', (res) => {
initialInventoryNodeId = res.value.split('-')[1]; initialInventoryNodeId = res.value.split('-')[1];
}); });
}, },
'verify that workflow visualizer new root node can only be set to always': client => { 'verify that workflow visualizer new root node can only be set to always': client => {
@@ -134,8 +129,8 @@ module.exports = {
.waitForElementNotVisible(spinny); .waitForElementNotVisible(spinny);
// Grab the id of the new child node for later // Grab the id of the new child node for later
client.getAttribute('//*[contains(@class, "WorkflowChart-isNodeBeingAdded")]/..', 'id', function(res) { client.getAttribute('//*[contains(@class, "WorkflowChart-isNodeBeingAdded")]/..', 'id', (res) => {
newChildNodeId = res.value.split('-')[1]; newChildNodeId = res.value.split('-')[1];
}); });
client client
@@ -163,35 +158,34 @@ module.exports = {
.waitForElementNotVisible(spinny); .waitForElementNotVisible(spinny);
// Grab the id of the new child node for later // Grab the id of the new child node for later
client.getAttribute('//*[contains(@class, "WorkflowChart-isNodeBeingAdded")]/..', 'id', function(res) { client.getAttribute('//*[contains(@class, "WorkflowChart-isNodeBeingAdded")]/..', 'id', (res) => {
// I had to nest this logic in order to ensure that leafNodeId was available later on. // 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 // Separating this out resulted in leafNodeId being `undefined` when sent to
leafNodeId = res.value.split('-')[1]; // xPathLinkById
client leafNodeId = res.value.split('-')[1];
.clearValue(jobSearchBar) client
.setValue(jobSearchBar, [testActionsJobText, client.Keys.ENTER]) .clearValue(jobSearchBar)
.pause(1000) .setValue(jobSearchBar, [testActionsJobText, client.Keys.ENTER])
.findThenClick(testActionsJob) .pause(1000)
.pause(1000) .findThenClick(testActionsJob)
.waitForElementNotVisible(spinny) .pause(1000)
.findThenClick(edgeTypeDropdownBar) .waitForElementNotVisible(spinny)
.waitForElementPresent(successDropdown) .findThenClick(edgeTypeDropdownBar)
.waitForElementPresent(failureDropdown) .waitForElementPresent(successDropdown)
.waitForElementPresent(alwaysDropdown) .waitForElementPresent(failureDropdown)
.findThenClick(alwaysDropdown) .waitForElementPresent(alwaysDropdown)
.click(nodeSelectButton) .findThenClick(alwaysDropdown)
.moveToElement(xPathNodeById(newChildNodeId), 0, 0, () => { .click(nodeSelectButton)
client.pause(500); .moveToElement(xPathNodeById(newChildNodeId), 0, 0, () => {
client.waitForElementNotVisible(spinny); client.pause(500);
client.click(xPathNodeById(newChildNodeId) + nodeRemove); client.waitForElementNotVisible(spinny);
}) client.click(xPathNodeById(newChildNodeId) + nodeRemove);
.pause(1000) })
.waitForElementNotVisible(spinny) .pause(1000)
.findThenClick(deleteConfirmation) .waitForElementNotVisible(spinny)
.waitForElementVisible(xPathLinkById(initialJobNodeId, leafNodeId)); .findThenClick(deleteConfirmation)
.waitForElementVisible(xPathLinkById(initialJobNodeId, leafNodeId));
}); });
}, },
after: client => { after: client => {
client.end(); client.end();