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 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,13 +78,13 @@ 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) {
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) {
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) {
client.getAttribute('//*[contains(@class, "WorkflowChart-nameText") and contains(text(), "test-actions-inventory")]/..', 'id', (res) => {
initialInventoryNodeId = res.value.split('-')[1];
});
},
@@ -134,7 +129,7 @@ module.exports = {
.waitForElementNotVisible(spinny);
// 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];
});
@@ -163,9 +158,10 @@ module.exports = {
.waitForElementNotVisible(spinny);
// 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.
// Separating this out resulted in leafNodeId being `undefined` when sent to xPathLinkById
// Separating this out resulted in leafNodeId being `undefined` when sent to
// xPathLinkById
leafNodeId = res.value.split('-')[1];
client
.clearValue(jobSearchBar)
@@ -190,8 +186,6 @@ module.exports = {
.findThenClick(deleteConfirmation)
.waitForElementVisible(xPathLinkById(initialJobNodeId, leafNodeId));
});
},
after: client => {
client.end();