Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
automation-core.3.0.1.source-code.micro_service.json Maven / Gradle / Ivy
{
"name" : "automation-core",
"serviceId" : "ad2d9ef6-8a22-447b-9b39-322625acdb8d",
"groupId" : "com.nginflow",
"artifactId" : "automation-core",
"version" : null,
"releaseKey" : null,
"httpPort" : 8081,
"instances" : 2,
"workerPool" : 5,
"components" : [ {
"process" : {
"id" : "Process_1hnqq28",
"start" : {
"outgoing" : "Flow_0i6qlhq",
"extensionElement" : {
"scriptCode" : {
"code" : "var modeler = {\n fields:[\n //\n {\n fieldName: \"type\",\n required: true,\n validation: function(value){\n return value != null;\n }\n },\n {\n fieldName: \"steepName\",\n required: true,\n validation: function(value){\n return value != null;\n }\n }\n // \n ]\n};"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"id" : "Event_0zpydyj"
},
"end" : [ {
"id" : "Event_1ykg2xa",
"name" : null,
"extensionElement" : null
}, {
"id" : "Event_1t2mr0r",
"name" : null,
"extensionElement" : null
} ],
"parallelGateways" : null,
"inclusiveGateways" : [ {
"outgoing" : [ "Flow_03o9l0o" ],
"incoming" : [ "Flow_1nolszg", "Flow_0rfld39" ],
"id" : "Gateway_0kf6098",
"name" : null
}, {
"outgoing" : [ "Flow_05jkw6v" ],
"incoming" : [ "Flow_0c9pg99", "Flow_0klymdf", "Flow_0pmgl3o" ],
"id" : "Gateway_190cnlp",
"name" : null
}, {
"outgoing" : [ "Flow_14xiuk2" ],
"incoming" : [ "Flow_0hkuwpp", "Flow_0bali12", "Flow_1nwc583", "Flow_05f1wv5", "Flow_0iy05dq", "Flow_1m1x428", "Flow_0ezqxwl", "Flow_01lc1kd", "Flow_1x0l68y", "Flow_0syc6q2", "Flow_16d24xk", "Flow_1y7r28d", "Flow_0jnzgu1", "Flow_1ilh1nh" ],
"id" : "Gateway_04l0ouq",
"name" : null
}, {
"outgoing" : [ "Flow_08b1afr", "Flow_046z14y" ],
"incoming" : [ "Flow_02clqzs" ],
"id" : "Gateway_0goes97",
"name" : null
}, {
"outgoing" : [ "Flow_1ilh1nh" ],
"incoming" : [ "Flow_1b4mwlx", "Flow_1thpfeb", "Flow_12b175w", "Flow_1waja06", "Flow_1t4sm0e", "Flow_0ug24ih", "Flow_0vcjkyu", "Flow_023r2px", "Flow_16fxsi6", "Flow_1mr20rh" ],
"id" : "Gateway_0sqd9hr",
"name" : null
} ],
"exclusiveGateway" : [ {
"outgoing" : [ "Flow_02clqzs", "Flow_1g9ux43" ],
"incoming" : "Flow_0i6qlhq",
"id" : "Gateway_0hotmtc",
"name" : "is input valid?"
}, {
"outgoing" : [ "Flow_0klymdf", "Flow_0l0cek4" ],
"incoming" : "Flow_03o9l0o",
"id" : "Gateway_1c5fjm6",
"name" : "is steep mocked?"
}, {
"outgoing" : [ "Flow_0hw7pag", "Flow_0c9pg99" ],
"incoming" : "Flow_1idt49t",
"id" : "Gateway_1u6o0sz",
"name" : "for each rule"
}, {
"outgoing" : [ "Flow_0onne0z", "Flow_04mwzo2" ],
"incoming" : "Flow_0r20q0p",
"id" : "Gateway_1rkewmj",
"name" : "has argument"
}, {
"outgoing" : [ "Flow_0bwxtnc", "Flow_07mqrao", "Flow_026jqoy", "Flow_0brfqm9", "Flow_1ptxory", "Flow_1nqm2qi", "Flow_02h1p4l", "Flow_0ezijin", "Flow_1cxjz6k", "Flow_1ig3fl7", "Flow_1dlm25o", "Flow_0zx4u9y", "Flow_0kt0881", "Flow_169dp77", "Flow_0s60dc6", "Flow_1g2b92s", "Flow_1czynyp", "Flow_1rywh2i", "Flow_0sjhy5y", "Flow_0vcdflo", "Flow_0j9oiea", "Flow_0r9jusq" ],
"incoming" : "Flow_1ikm2u4",
"id" : "Gateway_1a64ui0",
"name" : "Browser Action"
}, {
"outgoing" : [ "Flow_1ps9xh7", "Flow_1tz5ro4" ],
"incoming" : "Flow_0l0cek4",
"id" : "Gateway_1ezy9rm",
"name" : "has imported feattures"
}, {
"outgoing" : [ "Flow_1sn86uu", "Flow_05f1wv5" ],
"incoming" : "Flow_1k69kb4",
"id" : "Gateway_1u363vn",
"name" : "is rule mocked?"
}, {
"outgoing" : [ "Flow_1ikm2u4", "Flow_1icq3f9" ],
"incoming" : "Flow_04mwzo2",
"id" : "Gateway_07gonbc",
"name" : "has custom implementation?"
} ],
"sequenceFlows" : [ {
"id" : "Flow_0i6qlhq",
"name" : null,
"sourceRef" : "Event_0zpydyj",
"targetRef" : "Gateway_0hotmtc",
"conditionExpression" : null
}, {
"id" : "Flow_02clqzs",
"name" : "Yes",
"sourceRef" : "Gateway_0hotmtc",
"targetRef" : "Gateway_0goes97",
"conditionExpression" : "message.isInputValid"
}, {
"id" : "Flow_1g9ux43",
"name" : "No",
"sourceRef" : "Gateway_0hotmtc",
"targetRef" : "Activity_1af4mie",
"conditionExpression" : null
}, {
"id" : "Flow_0rfld39",
"name" : null,
"sourceRef" : "Activity_11f7ja9",
"targetRef" : "Gateway_0kf6098",
"conditionExpression" : null
}, {
"id" : "Flow_08b1afr",
"name" : null,
"sourceRef" : "Gateway_0goes97",
"targetRef" : "Activity_11f7ja9",
"conditionExpression" : null
}, {
"id" : "Flow_046z14y",
"name" : null,
"sourceRef" : "Gateway_0goes97",
"targetRef" : "Activity_1s9iueu",
"conditionExpression" : null
}, {
"id" : "Flow_1nolszg",
"name" : null,
"sourceRef" : "Activity_1s9iueu",
"targetRef" : "Gateway_0kf6098",
"conditionExpression" : null
}, {
"id" : "Flow_03o9l0o",
"name" : null,
"sourceRef" : "Gateway_0kf6098",
"targetRef" : "Gateway_1c5fjm6",
"conditionExpression" : null
}, {
"id" : "Flow_0klymdf",
"name" : "Yes",
"sourceRef" : "Gateway_1c5fjm6",
"targetRef" : "Gateway_190cnlp",
"conditionExpression" : "currentSteep.mocked && null == currentSteep.anImport && currentSteep.rules.length == 1"
}, {
"id" : "Flow_0l0cek4",
"name" : "No",
"sourceRef" : "Gateway_1c5fjm6",
"targetRef" : "Gateway_1ezy9rm",
"conditionExpression" : null
}, {
"id" : "Flow_0hw7pag",
"name" : "Next",
"sourceRef" : "Gateway_1u6o0sz",
"targetRef" : "Activity_1dr6xq3",
"conditionExpression" : "ruleIndex < currentSteep.rules.length"
}, {
"id" : "Flow_0c9pg99",
"name" : "finish",
"sourceRef" : "Gateway_1u6o0sz",
"targetRef" : "Gateway_190cnlp",
"conditionExpression" : null
}, {
"id" : "Flow_0r20q0p",
"name" : null,
"sourceRef" : "Activity_1i35k9d",
"targetRef" : "Gateway_1rkewmj",
"conditionExpression" : null
}, {
"id" : "Flow_0onne0z",
"name" : "Yes",
"sourceRef" : "Gateway_1rkewmj",
"targetRef" : "Activity_0zoeukr",
"conditionExpression" : "currentSteep.hasArgument && ruleIndex == currentSteep.rules.length -1 || Array.isArray(currentSteep.rules[ruleIndex])"
}, {
"id" : "Flow_04mwzo2",
"name" : "No",
"sourceRef" : "Gateway_1rkewmj",
"targetRef" : "Gateway_07gonbc",
"conditionExpression" : null
}, {
"id" : "Flow_0bwxtnc",
"name" : "OPEN",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1cs1mu6",
"conditionExpression" : "currentRule.type.toUpperCase() == \"OPEN\""
}, {
"id" : "Flow_0k0mwop",
"name" : null,
"sourceRef" : "Activity_0zoeukr",
"targetRef" : "Gateway_07gonbc",
"conditionExpression" : null
}, {
"id" : "Flow_0nj6j1x",
"name" : null,
"sourceRef" : "Activity_1af4mie",
"targetRef" : "Event_1ykg2xa",
"conditionExpression" : null
}, {
"id" : "Flow_01pedei",
"name" : null,
"sourceRef" : "Activity_1w8qhfh",
"targetRef" : "Gateway_1u6o0sz",
"conditionExpression" : null
}, {
"id" : "Flow_05jkw6v",
"name" : null,
"sourceRef" : "Gateway_190cnlp",
"targetRef" : "Event_1t2mr0r",
"conditionExpression" : null
}, {
"id" : "Flow_0bali12",
"name" : null,
"sourceRef" : "Activity_1cs1mu6",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_1idt49t",
"name" : null,
"sourceRef" : "Activity_0kv30v5",
"targetRef" : "Gateway_1u6o0sz",
"conditionExpression" : null
}, {
"id" : "Flow_07mqrao",
"name" : "CLICK",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0ize51r",
"conditionExpression" : "currentRule.type.toUpperCase() == \"CLICK\""
}, {
"id" : "Flow_0hkuwpp",
"name" : null,
"sourceRef" : "Activity_0ize51r",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_14xiuk2",
"name" : null,
"sourceRef" : "Gateway_04l0ouq",
"targetRef" : "Activity_0kv30v5",
"conditionExpression" : null
}, {
"id" : "Flow_026jqoy",
"name" : "VALIDATE_URL",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1dnpr5u",
"conditionExpression" : "currentRule.type.toUpperCase() == \"VALIDATE_URL\""
}, {
"id" : "Flow_1nwc583",
"name" : null,
"sourceRef" : "Activity_1dnpr5u",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_0a3yj8g",
"name" : null,
"sourceRef" : "Activity_15zl4kt",
"targetRef" : "Activity_0io4ojg",
"conditionExpression" : null
}, {
"id" : "Flow_1ps9xh7",
"name" : "Yes",
"sourceRef" : "Gateway_1ezy9rm",
"targetRef" : "Activity_15zl4kt",
"conditionExpression" : "null != currentSteep.anImport"
}, {
"id" : "Flow_1tz5ro4",
"name" : "No",
"sourceRef" : "Gateway_1ezy9rm",
"targetRef" : "Activity_1w8qhfh",
"conditionExpression" : null
}, {
"id" : "Flow_0vg2aho",
"name" : null,
"sourceRef" : "Activity_0io4ojg",
"targetRef" : "Activity_1w8qhfh",
"conditionExpression" : null
}, {
"id" : "Flow_1k69kb4",
"name" : null,
"sourceRef" : "Activity_1dr6xq3",
"targetRef" : "Gateway_1u363vn",
"conditionExpression" : null
}, {
"id" : "Flow_1sn86uu",
"name" : "No",
"sourceRef" : "Gateway_1u363vn",
"targetRef" : "Activity_1i35k9d",
"conditionExpression" : null
}, {
"id" : "Flow_05f1wv5",
"name" : "Yes",
"sourceRef" : "Gateway_1u363vn",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : "currentSteep.mocked && ruleIndex == currentSteep.rules.length -1"
}, {
"id" : "Flow_0brfqm9",
"name" : "FIND_TEXT",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0ds2fv0",
"conditionExpression" : "currentRule.type.toUpperCase() == \"FIND_TEXT\""
}, {
"id" : "Flow_0iy05dq",
"name" : null,
"sourceRef" : "Activity_0ds2fv0",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_1ptxory",
"name" : "FIND_TEXT_IN_ATTRIBUTE",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_09zxtq8",
"conditionExpression" : "currentRule.type.toUpperCase() == \"FIND_TEXT_IN_ATTRIBUTE\""
}, {
"id" : "Flow_1m1x428",
"name" : null,
"sourceRef" : "Activity_09zxtq8",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_1nqm2qi",
"name" : "COUNT_ELEMENTS",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1xhmfh1",
"conditionExpression" : "currentRule.type.toUpperCase() == \"COUNT_ELEMENTS\""
}, {
"id" : "Flow_0ezqxwl",
"name" : null,
"sourceRef" : "Activity_1xhmfh1",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_02h1p4l",
"name" : "INPUT",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0o8y814",
"conditionExpression" : "currentRule.type.toUpperCase() == \"INPUT\""
}, {
"id" : "Flow_01lc1kd",
"name" : null,
"sourceRef" : "Activity_0o8y814",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_0ezijin",
"name" : "KEY_PRESS_DELETE",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1tit03p",
"conditionExpression" : "currentRule.type.toUpperCase() == \"KEY_PRESS_DELETE\""
}, {
"id" : "Flow_1x0l68y",
"name" : null,
"sourceRef" : "Activity_1tit03p",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_1cxjz6k",
"name" : "KEY_PRESS_ENTER",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1trfn9q",
"conditionExpression" : "currentRule.type.toUpperCase() == \"KEY_PRESS_ENTER\""
}, {
"id" : "Flow_0syc6q2",
"name" : null,
"sourceRef" : "Activity_1trfn9q",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_1ig3fl7",
"name" : "SCROLL_TO",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0wt0d01",
"conditionExpression" : "currentRule.type.toUpperCase() == \"SCROLL_TO\""
}, {
"id" : "Flow_16d24xk",
"name" : null,
"sourceRef" : "Activity_0wt0d01",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_1ikm2u4",
"name" : "No",
"sourceRef" : "Gateway_07gonbc",
"targetRef" : "Gateway_1a64ui0",
"conditionExpression" : null
}, {
"id" : "Flow_1icq3f9",
"name" : "Yes",
"sourceRef" : "Gateway_07gonbc",
"targetRef" : "Activity_0crxont",
"conditionExpression" : "handler != null"
}, {
"id" : "Flow_1y7r28d",
"name" : null,
"sourceRef" : "Activity_0crxont",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_1dlm25o",
"name" : "QUIT",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1u92mrx",
"conditionExpression" : "currentRule.type.toUpperCase() == \"QUIT\""
}, {
"id" : "Flow_0pmgl3o",
"name" : null,
"sourceRef" : "Activity_1u92mrx",
"targetRef" : "Gateway_190cnlp",
"conditionExpression" : null
}, {
"id" : "Flow_0zx4u9y",
"name" : "SCRIPT",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0elsh7q",
"conditionExpression" : "currentRule.type.toUpperCase() == \"SCRIPT\""
}, {
"id" : "Flow_0jnzgu1",
"name" : null,
"sourceRef" : "Activity_0elsh7q",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
}, {
"id" : "Flow_0kt0881",
"name" : "API-HOST",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1lmhgp3",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_HOST\""
}, {
"id" : "Flow_1b4mwlx",
"name" : null,
"sourceRef" : "Activity_1lmhgp3",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_169dp77",
"name" : "API_PORT",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0nyzcpp",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_PORT\""
}, {
"id" : "Flow_1thpfeb",
"name" : null,
"sourceRef" : "Activity_0nyzcpp",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_0s60dc6",
"name" : "API_ENDPOINT",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1xy6py3",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_ENDPOINT\""
}, {
"id" : "Flow_12b175w",
"name" : null,
"sourceRef" : "Activity_1xy6py3",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_1g2b92s",
"name" : "API_SSL",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1xgx3la",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_SSL\""
}, {
"id" : "Flow_1waja06",
"name" : null,
"sourceRef" : "Activity_1xgx3la",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_1czynyp",
"name" : "api_load_payload",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1bm7gb1",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_LOAD_PAYLOAD\""
}, {
"id" : "Flow_1t4sm0e",
"name" : null,
"sourceRef" : "Activity_1bm7gb1",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_1rywh2i",
"name" : "api_headers",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0oqpq79",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_HEADERS\""
}, {
"id" : "Flow_0ug24ih",
"name" : null,
"sourceRef" : "Activity_0oqpq79",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_0sjhy5y",
"name" : "api_method",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_08jksh8",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_METHOD\""
}, {
"id" : "Flow_0vcjkyu",
"name" : null,
"sourceRef" : "Activity_08jksh8",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_0vcdflo",
"name" : "api_call",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0srayy7",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_CALL\""
}, {
"id" : "Flow_023r2px",
"name" : null,
"sourceRef" : "Activity_0srayy7",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_0j9oiea",
"name" : "api_validate_status_code",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_1l9qccd",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_VALIDATE_STATUS_CODE\""
}, {
"id" : "Flow_16fxsi6",
"name" : null,
"sourceRef" : "Activity_1l9qccd",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_0r9jusq",
"name" : "api_validate_body",
"sourceRef" : "Gateway_1a64ui0",
"targetRef" : "Activity_0ts990s",
"conditionExpression" : "currentRule.type.toUpperCase() == \"API_VALIDATE_BODY\""
}, {
"id" : "Flow_1mr20rh",
"name" : null,
"sourceRef" : "Activity_0ts990s",
"targetRef" : "Gateway_0sqd9hr",
"conditionExpression" : null
}, {
"id" : "Flow_1ilh1nh",
"name" : null,
"sourceRef" : "Gateway_0sqd9hr",
"targetRef" : "Gateway_04l0ouq",
"conditionExpression" : null
} ],
"callActivities" : null,
"businessRuleTasks" : null,
"scriptTasks" : [ {
"id" : "Activity_11f7ja9",
"name" : "load steep descriptor",
"outgoing" : "Flow_0rfld39",
"extensionElement" : {
"scriptCode" : {
"code" : "if(null == scenario) {\n util.finishStage(stage, \"Cucumber stage object is null\", \"ERROR_CODE\", 500);\n}else{\n var fileUrl = \"src/test/resources/build/features/\" + browser.name + \"/\" + scenario.id.match(/\\/([^\\/]+)\\.feature/)[1] + \".json\";\n info.log(\"Configuration file => {}\", fileUrl);\n fileUtils.readFileToString(\n fileUrl,\n function(data){\n \n var currentFeature = JSON.parse(data);\n \n var currentScenario = currentFeature.scenarios.filter(function(es){\n return es.name == scenario.name;\n })[0];\n \n var currentSteep = currentScenario.steeps.filter(function(st){\n return st.name == message.steepName;\n })[0];\n \n util.addGlobalVariable(\"currentFeature\", currentFeature);\n util.addGlobalVariable(\"currentScenario\", currentScenario);\n util.addGlobalVariable(\"currentSteep\", currentSteep);\n util.addGlobalVariable(\"ruleIndex\", 0);\n info.log(\"currentSteep => {}\", JSON.stringify(currentSteep));\n \n stage.complete(); \n },\n function(err){\n util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n }\n );\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1af4mie",
"name" : "input not valid",
"outgoing" : "Flow_0nj6j1x",
"extensionElement" : {
"scriptCode" : {
"code" : "util.finishStage(stage, \"Input is not valid\", \"ERROR_CODE\", 500);"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1s9iueu",
"name" : "load rules",
"outgoing" : "Flow_1nolszg",
"extensionElement" : {
"scriptCode" : {
"code" : "var fileUrl = \"src/test/resources/features/rules.json\";\nfileUtils.readFileToString(\n fileUrl,\n function(data){\n var config = JSON.parse(data);\n var rules = [];\n \n for(var key in config.rules){\n \n config.rules[key].forEach(function(r){\n rules.push(r);\n });\n \n }\n \n var environmentVariables = {};\n \n if(message.environment != \"\" && typeof config.env != \"undefined\" && typeof config.env[message.environment] != \"undefined\"){\n environmentVariables = config.env[message.environment];\n }\n \n util.addGlobalVariable(\"environmentVariables\", environmentVariables);\n util.addGlobalVariable(\"rules\", rules);\n info.log(\"Rules for =>{}\", browser.name);\n stage.complete(); \n },\n function(err){\n util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n }\n);"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1i35k9d",
"name" : "get rule",
"outgoing" : "Flow_0r20q0p",
"extensionElement" : {
"scriptCode" : {
"code" : "var r = currentSteep.rules[ruleIndex];\n\nvar filterRules = rules.filter(function(rr){\n if(Array.isArray(r)){\n return rr.name == r[0]\n }else{\n return rr.name == r\n }\n});\n\n\nif(filterRules.length > 0){\n var currentRule = filterRules[0];\n addEvironmentValue(currentRule);\n util.addGlobalVariable(\"currentRule\", currentRule);\n if(typeof currentRule.sleep != \"undefined\" && currentRule.sleep != null){\n seleniumDriver.waitFor(currentRule.sleep, function(f){\n stage.complete();\n }, function(err){\n util.finishStage(stage, err, \"BDD_9000\", 500);\n })\n }else{\n stage.complete();\n }\n \n} else {\n util.finishStage(stage, \"Unable to find the rule in the rules.json file\", \"BDD_9001\", 500); \n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0zoeukr",
"name" : "set argument",
"outgoing" : "Flow_0k0mwop",
"extensionElement" : {
"scriptCode" : {
"code" : "if(Array.isArray(currentSteep.rules[ruleIndex]) && currentSteep.rules[ruleIndex].length > 1){\n currentRule.value = currentSteep.rules[ruleIndex][1];\n}else if(currentSteep.hasArgument){\n currentRule.value = message.argument; \n}\naddEvironmentValue(currentRule);\nstage.complete();"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1cs1mu6",
"name" : "open action",
"outgoing" : "Flow_0bali12",
"extensionElement" : {
"scriptCode" : {
"code" : "info.log(\"Opening for => {}\", browser.name);\nopen(currentRule, function(){\n info.log(\"Browser opened successfully!!\");\n stage.complete()\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1w8qhfh",
"name" : "load webdriver functions",
"outgoing" : "Flow_01pedei",
"extensionElement" : {
"scriptCode" : {
"code" : "try{\n \n info.log(\"ENTROOOOOOOO\");\n var findElement = function(rule, isMultiple, onSuccess, onError){\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n var sleepTime = null != rule.sleep ? rule.sleep : 0;\n \n var by;\n \n if (null != rule.attrId) {\n seleniumDriver.findElementById(webDriver, sleepTime, rule.attrId, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else if (null != rule.attrName) {\n seleniumDriver.findElementByName(webDriver, sleepTime, rule.attrName, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else if (null != rule.className) {\n seleniumDriver.findElementByClassName(webDriver, sleepTime, rule.className, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else if (null != rule.xpath) {\n seleniumDriver.findElementByXpath(webDriver, sleepTime, rule.xpath, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else if (null != rule.tagName) {\n seleniumDriver.findElementByTagName(webDriver, sleepTime, rule.tagName, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else {\n seleniumDriver.findElementByText(webDriver, sleepTime, rule.attrText, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n }\n }; \n \n var open = function(rule, onSuccess, onError){\n try{\n \n function goTo(webDriver){\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n info.log(\"opening.. => {}\", JSON.stringify(rule));\n webDriver.manage().window().maximize();\n browser.setDriver(webDriver);\n var url = rule.value.replaceAll(\"\\\\\\\\\", \"\");\n webDriver.get(url);\n error.log(\"process success\");\n onSuccess();\n \n }\n \n if(null != browser.getDriver()){\n info.log(\"reusing driver...\");\n goTo(browser.getDriver());\n }else{\n \n seleniumDriver.createLocalWebDriver(browser.name, currentScenario.locale,\n goTo,\n function(err){\n error.log(\"selenium exception => {}\", err);\n onError(err);\n }\n );\n \n }\n \n } catch(e){\n error.log(\"catch exception => {}\", e);\n onError(e);\n }\n };\n \n var addEvironmentValue = function(rule){\n \n if(message.environment != \"\" && null != rule.value && /{{(.*)}}/.test(rule.value)) {\n var newVal = environmentVariables[rule.value.match(/{{(.*)}}/)[1]];\n if(typeof newVal != \"undefined\" && null != newVal){\n rule.value = rule.value.replaceAll(\"\\\\{\\\\{(.*)\\\\}\\\\}\", newVal) ;\n }\n }\n \n }\n \n util.addGlobalVariable(\"addEvironmentValue\", addEvironmentValue);\n util.addGlobalVariable(\"open\", open);\n util.addGlobalVariable(\"findElement\", findElement);\n \n stage.complete();\n \n} catch(e){\n \n util.finishStage(stage, \"Error preparing functions\", \"ERROR_CODE\", 500);\n \n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0kv30v5",
"name" : "take screenshot",
"outgoing" : "Flow_1idt49t",
"extensionElement" : {
"scriptCode" : {
"code" : "ruleIndex++;\nutil.addGlobalVariable(\"ruleIndex\", ruleIndex);\nif(currentRule.screenShot){\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n seleniumDriver.takeScreenShot(scenario, webDriver, function(f) {\n stage.complete();\n }, function(err) {\n util.finishStage(stage, \"Error while taking screenshot => \" + err, \"BDD_9003\", 500);\n }); \n}else{\n stage.complete();\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0ize51r",
"name" : "click action",
"outgoing" : "Flow_0hkuwpp",
"extensionElement" : {
"scriptCode" : {
"code" : "findElement(currentRule, false, function(el){\n el.click();\n stage.complete()\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1dnpr5u",
"name" : "validate location",
"outgoing" : "Flow_1nwc583",
"extensionElement" : {
"scriptCode" : {
"code" : "var featureName = scenario.id.match(/.*:(.*):.*/)[1];\nvar webDriver = browser.getDriver();\nif(currentRule.value == webDriver.getCurrentUrl()){\n stage.complete();\n}else{\n util.finishStage(stage, \"Assertion error \\\"\"+ webDriver.getCurrentUrl() +\"\\\" is not equals to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_15zl4kt",
"name" : "load imported rules",
"outgoing" : "Flow_0a3yj8g",
"extensionElement" : {
"scriptCode" : {
"code" : "fileUtils.getFileList(\"src/test/resources/build/features/\" + browser.name, [\"json\"],\n function(arr){\n var impFeatures = new Array();\n arr.forEach(function(file){\n fileUtils.readFileToString(file, function(data){\n impFeatures.push(JSON.parse(data));\n }, function(err){\n util.finishStage(stage, \"Unexpected error while reading the features => \" + err, \"BDD_9000\", 500);\n });\n });\n util.addGlobalVariable(\"impFeatures\", impFeatures);\n stage.complete();\n },\n function(err){\n util.finishStage(stage, \"Unexpected error while loading the imported features => \" + err, \"BDD_9000\", 500);\n }\n);"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0io4ojg",
"name" : "process features",
"outgoing" : "Flow_0vg2aho",
"extensionElement" : {
"scriptCode" : {
"code" : "try{\n info.log(\"total of imported features => {}\", impFeatures.length);\n \n var importedRules = new Array();\n \n function addRules(importedScenario, importObj){\n \n var n = 0;\n \n importedScenario.steeps.forEach(function(st){\n \n if(!st.mocked){\n \n if(st.anImport != null) findRule(st.anImport);\n \n st.rules.forEach(function(rule){\n importedRules.push(rule);\n if(importObj.arguments != null && importObj.arguments.length > 0 ){\n var rrArr = rules.filter(function(r){\n var nme = rule\n if(Array.isArray(nme)) nme = nme[0];\n return r.name == nme;\n });\n if(rrArr.length > 0){\n info.log(\"Adding argument => {}\", importObj.arguments[n]);\n rrArr[0].value = importObj.arguments[n]; \n }\n }\n });\n \n n++;\n \n }\n \n \n });\n }\n \n function findRule(importObj){\n var ftArr = impFeatures.filter(function(e){\n return e.name == importObj.featureName;\n });\n if(ftArr.length > 0){\n var ft = ftArr[0];\n var scArr = ft.scenarios.filter(function(sc){\n return sc.name == importObj.scenarioName;\n });\n if(scArr.length > 0 ){\n addRules(scArr[0], importObj)\n }\n }\n }\n \n findRule(currentSteep.anImport);\n \n \n currentSteep.rules.forEach(function(r){\n importedRules.push(r);\n });\n \n currentSteep.rules = importedRules;\n \n util.addGlobalVariable(\"rules\", rules);\n util.addGlobalVariable(\"currentSteep\", currentSteep);\n \n info.log(\"Total of rules to be processed => {}\", JSON.stringify(currentSteep.rules));\n \n stage.complete();\n}catch(e){\n util.finishStage(stage, \"Unexpected error while processing imported rules\" + e, \"BDD_9000\", 500);\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1dr6xq3",
"name" : "wait for sometime",
"outgoing" : "Flow_1k69kb4",
"extensionElement" : {
"scriptCode" : {
"code" : "info.log(\"Wait for => {}\", browser.name);\nseleniumDriver.waitFor(500, function(f){\n stage.complete();\n}, function(err){\n util.finishStage(stage, err, \"BDD_9000\", 500);\n})"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0ds2fv0",
"name" : "get html text",
"outgoing" : "Flow_0iy05dq",
"extensionElement" : {
"scriptCode" : {
"code" : "findElement(currentRule,false, function(el){\n var htmlText = el.getText();\n if(new RegExp(currentRule.value).test(htmlText)){\n stage.complete();\n }else{\n util.finishStage(stage, \"Assertion error \\\"\"+ htmlText +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n }\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_09zxtq8",
"name" : "get attribute value",
"outgoing" : "Flow_1m1x428",
"extensionElement" : {
"scriptCode" : {
"code" : "findElement(currentRule, false, function(el){\n \n var attrText = el.getAttribute(currentRule.attrName);\n if(new RegExp(currentRule.value).test(attrText)){\n stage.complete();\n }else{\n util.finishStage(stage, \"Assertion error \\\"\"+ attrText +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n } \n \n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1xhmfh1",
"name" : "count all elements",
"outgoing" : "Flow_0ezqxwl",
"extensionElement" : {
"scriptCode" : {
"code" : "findElement(currentRule, true, function(arr){\n if(new RegExp(currentRule.value).test(arr.length)){\n stage.complete();\n }else{\n util.finishStage(stage, \"Assertion error \\\"\"+ arr.length +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n }\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0o8y814",
"name" : "input text",
"outgoing" : "Flow_01lc1kd",
"extensionElement" : {
"scriptCode" : {
"code" : "try{\n findElement(currentRule, false, function(el){\n el.sendKeys(currentRule.value);\n stage.complete();\n }, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n }); \n}catch(e){\n util.finishStage(stage, \"Error while sending keys\", \"ERROR_CODE\", 500);\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1tit03p",
"name" : "press delete",
"outgoing" : "Flow_1x0l68y",
"extensionElement" : {
"scriptCode" : {
"code" : "findElement(currentRule, false, function(el){\n el.sendKeys(seleniumDriver.DELETE);\n stage.complete();\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1trfn9q",
"name" : "press enter",
"outgoing" : "Flow_0syc6q2",
"extensionElement" : {
"scriptCode" : {
"code" : "findElement(currentRule, false, function(el){\n el.sendKeys(seleniumDriver.ENTER);\n stage.complete();\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0wt0d01",
"name" : "scroll to",
"outgoing" : "Flow_16d24xk",
"extensionElement" : {
"scriptCode" : {
"code" : "try{\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n webDriver.executeScript(\"window.scrollBy(0,\" + currentRule.value + \")\");\n stage.complete(); \n}catch(e){\n util.finishStage(stage, \"Error while scrolling => \"+ e, \"BDD_9000\", 500);\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0crxont",
"name" : "custom handler",
"outgoing" : "Flow_1y7r28d",
"extensionElement" : {
"scriptCode" : {
"code" : "var webDriver = browser.getDrivers().get(scenario.name);\nhandler(webDriver, currentRule, function(f){\n if(f){\n stage.complete();\n }else{\n util.finishStage(stage, \"The custom implementation has returned an error signal\", \"BDD_9000\", 500);\n }\n}, function(err){\n util.finishStage(stage, \"Error while calling cutom implementation => \" + e, \"BDD_9000\", 500);\n});"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1u92mrx",
"name" : "quit driver",
"outgoing" : "Flow_0pmgl3o",
"extensionElement" : {
"scriptCode" : {
"code" : "try{\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n webDriver.quit();\n stage.complete(); \n}catch(e){\n util.finishStage(stage, \"Error while closing the session => \"+ e, \"BDD_9000\", 500);\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0elsh7q",
"name" : "run script",
"outgoing" : "Flow_0jnzgu1",
"extensionElement" : {
"scriptCode" : {
"code" : "try{\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n webDriver.executeScript(currentRule.value);\n stage.complete(); \n}catch(e){\n util.finishStage(stage, \"Error while scrolling => \"+ e, \"BDD_9000\", 500);\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1lmhgp3",
"name" : "API host",
"outgoing" : "Flow_1b4mwlx",
"extensionElement" : {
"scriptCode" : {
"code" : "httpTransaction.host = currentRule.value;\nstage.complete();"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0nyzcpp",
"name" : "API_PORT",
"outgoing" : "Flow_1thpfeb",
"extensionElement" : {
"scriptCode" : {
"code" : "httpTransaction.port = Number(currentRule.value);\nstage.complete();"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1xy6py3",
"name" : "add endpoint",
"outgoing" : "Flow_12b175w",
"extensionElement" : {
"scriptCode" : {
"code" : "httpTransaction.endPoint = currentRule.value;\nstage.complete();"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1xgx3la",
"name" : "set ssl",
"outgoing" : "Flow_1waja06",
"extensionElement" : {
"scriptCode" : {
"code" : "httpTransaction.ssl = currentRule.value;\nstage.complete();"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1bm7gb1",
"name" : "load payload",
"outgoing" : "Flow_1t4sm0e",
"extensionElement" : {
"scriptCode" : {
"code" : "var fileUrl = \"src/test/resources/\" + currentRule.value;\nfileUtils.readFileToString(\n fileUrl,\n function(data){\n httpTransaction.payload = data;\n info.log(data);\n stage.complete(); \n },\n function(err){\n util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n }\n);"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0oqpq79",
"name" : "add headers",
"outgoing" : "Flow_0ug24ih",
"extensionElement" : {
"scriptCode" : {
"code" : "if(dataTable != null){\n var headers= {};\n dataTable.forEach(function(v){\n headers[v[0]] = v[1];\n });\n headers = JSON.stringify(headers);\n info.log(headers);\n httpTransaction.headers = headers;\n}\nstage.complete();"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_08jksh8",
"name" : "define HTTP method",
"outgoing" : "Flow_0vcjkyu",
"extensionElement" : {
"scriptCode" : {
"code" : "httpTransaction.httpMethod = currentRule.value;\nstage.complete();"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0srayy7",
"name" : "call API",
"outgoing" : "Flow_023r2px",
"extensionElement" : {
"scriptCode" : {
"code" : "info.log(httpTransaction.toString());\n \n var wc = webclient.build(httpTransaction.port, httpTransaction.host, \n httpTransaction.endPoint)\n .httpMethod(httpTransaction.httpMethod)\n .setSSL(httpTransaction.ssl);\n \n if(httpTransaction.headers != null){\n \n var headers = JSON.parse(httpTransaction.headers);\n var key = \"\";\n for(key in headers){\n wc.addHeader(key, headers[key]);\n }\n \n }\n \n var payload = \"{}\";\n \n if(httpTransaction.payload != null){\n \n payload = httpTransaction.payload;\n \n }\n \n wc.sendJsonObjectAndGetStatusCode(payload, function(httpCode, jsonResponse){\n httpTransaction.statusCode = httpCode;\n httpTransaction.response = jsonResponse;\n info.log(\"API Response code => {}\",httpCode)\n info.log(\"API Response body => {}\",jsonResponse)\n stage.complete();\n }, function(err){\n stage.fail(err);\n });"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_1l9qccd",
"name" : "validate http code",
"outgoing" : "Flow_16fxsi6",
"extensionElement" : {
"scriptCode" : {
"code" : "if(httpTransaction.statusCode == Number(currentRule.value)){\n stage.complete();\n}else{\n util.finishStage(stage, \"Assertion error \\\"\"+ httpTransaction.statusCode +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
}, {
"id" : "Activity_0ts990s",
"name" : "validate response body",
"outgoing" : "Flow_1mr20rh",
"extensionElement" : {
"scriptCode" : {
"code" : "if(dataTable != null){\n \n var errors = \"\";\n dataTable.forEach(function(v){\n \n httpTransaction.validateField(v[0], v[1],\n function(ass){\n if (!ass.isStatus()) {\n errors += ass.getMessage() + \"\\n\";\n } \n },\n function(err){\n util.finishStage(stage, err, \"BDD_9000\", 500);\n }\n );\n });\n \n if(errors.length > 0){\n util.finishStage(stage, errors, \"BDD_9000\", 500);\n }else{\n stage.complete(); \n }\n}else{\n stage.complete();\n}"
},
"mockedCode" : null,
"beforeCode" : null,
"afterCode" : null
},
"dataInputAssociation" : null
} ],
"serviceTasks" : null,
"sendTasks" : null,
"dataStoreReferences" : null
},
"httpMethod" : "post",
"httpEndPoint" : "/interpret",
"serviceName" : "interpreter",
"resourceId" : "33f4db9f-19d2-4ede-a8a1-31afc29ab95b",
"auth" : null,
"xmlData" : "\n\n \n \n \n \n var modeler = {\n fields:[\n //<editable>\n {\n fieldName: \"type\",\n required: true,\n validation: function(value){\n return value != null;\n }\n },\n {\n fieldName: \"steepName\",\n required: true,\n validation: function(value){\n return value != null;\n }\n }\n //</editable>\n ]\n};
\n \n \n Flow_0i6qlhq \n \n \n Flow_0i6qlhq \n Flow_02clqzs \n Flow_1g9ux43 \n \n \n \n \n \n if(null == scenario) {\n util.finishStage(stage, \"Cucumber stage object is null\", \"ERROR_CODE\", 500);\n}else{\n var fileUrl = \"src/test/resources/build/features/\" + browser.name + \"/\" + scenario.id.match(/\\/([^\\/]+)\\.feature/)[1] + \".json\";\n info.log(\"Configuration file => {}\", fileUrl);\n fileUtils.readFileToString(\n fileUrl,\n function(data){\n \n var currentFeature = JSON.parse(data);\n \n var currentScenario = currentFeature.scenarios.filter(function(es){\n return es.name == scenario.name;\n })[0];\n \n var currentSteep = currentScenario.steeps.filter(function(st){\n return st.name == message.steepName;\n })[0];\n \n util.addGlobalVariable(\"currentFeature\", currentFeature);\n util.addGlobalVariable(\"currentScenario\", currentScenario);\n util.addGlobalVariable(\"currentSteep\", currentSteep);\n util.addGlobalVariable(\"ruleIndex\", 0);\n info.log(\"currentSteep => {}\", JSON.stringify(currentSteep));\n \n stage.complete(); \n },\n function(err){\n util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n }\n );\n}
\n \n \n Flow_08b1afr \n Flow_0rfld39 \n \n \n \n \n \n util.finishStage(stage, \"Input is not valid\", \"ERROR_CODE\", 500);
\n \n \n Flow_1g9ux43 \n Flow_0nj6j1x \n \n \n \n \n \n \n \n var fileUrl = \"src/test/resources/features/rules.json\";\nfileUtils.readFileToString(\n fileUrl,\n function(data){\n var config = JSON.parse(data);\n var rules = [];\n \n for(var key in config.rules){\n \n config.rules[key].forEach(function(r){\n rules.push(r);\n });\n \n }\n \n var environmentVariables = {};\n \n if(message.environment != \"\" && typeof config.env != \"undefined\" && typeof config.env[message.environment] != \"undefined\"){\n environmentVariables = config.env[message.environment];\n }\n \n util.addGlobalVariable(\"environmentVariables\", environmentVariables);\n util.addGlobalVariable(\"rules\", rules);\n info.log(\"Rules for =>{}\", browser.name);\n stage.complete(); \n },\n function(err){\n util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n }\n);
\n \n \n Flow_046z14y \n Flow_1nolszg \n \n \n \n \n Flow_1nolszg \n Flow_0rfld39 \n Flow_03o9l0o \n \n \n Flow_03o9l0o \n Flow_0klymdf \n Flow_0l0cek4 \n \n \n \n \n \n \n var r = currentSteep.rules[ruleIndex];\n\nvar filterRules = rules.filter(function(rr){\n if(Array.isArray(r)){\n return rr.name == r[0]\n }else{\n return rr.name == r\n }\n});\n\n\nif(filterRules.length > 0){\n var currentRule = filterRules[0];\n addEvironmentValue(currentRule);\n util.addGlobalVariable(\"currentRule\", currentRule);\n if(typeof currentRule.sleep != \"undefined\" && currentRule.sleep != null){\n seleniumDriver.waitFor(currentRule.sleep, function(f){\n stage.complete();\n }, function(err){\n util.finishStage(stage, err, \"BDD_9000\", 500);\n })\n }else{\n stage.complete();\n }\n \n} else {\n util.finishStage(stage, \"Unable to find the rule in the rules.json file\", \"BDD_9001\", 500); \n}
\n \n \n Flow_1sn86uu \n Flow_0r20q0p \n \n \n \n Flow_01pedei \n Flow_1idt49t \n Flow_0hw7pag \n Flow_0c9pg99 \n \n \n \n \n Flow_0c9pg99 \n Flow_0klymdf \n Flow_0pmgl3o \n Flow_05jkw6v \n \n \n Flow_0r20q0p \n Flow_0onne0z \n Flow_04mwzo2 \n \n \n \n \n \n if(Array.isArray(currentSteep.rules[ruleIndex]) && currentSteep.rules[ruleIndex].length > 1){\n currentRule.value = currentSteep.rules[ruleIndex][1];\n}else if(currentSteep.hasArgument){\n currentRule.value = message.argument; \n}\naddEvironmentValue(currentRule);\nstage.complete();
\n \n \n Flow_0onne0z \n Flow_0k0mwop \n \n \n \n \n \n info.log(\"Opening for => {}\", browser.name);\nopen(currentRule, function(){\n info.log(\"Browser opened successfully!!\");\n stage.complete()\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});
\n \n \n Flow_0bwxtnc \n Flow_0bali12 \n \n \n \n \n \n Flow_0nj6j1x \n \n \n \n \n \n try{\n \n info.log(\"ENTROOOOOOOO\");\n var findElement = function(rule, isMultiple, onSuccess, onError){\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n var sleepTime = null != rule.sleep ? rule.sleep : 0;\n \n var by;\n \n if (null != rule.attrId) {\n seleniumDriver.findElementById(webDriver, sleepTime, rule.attrId, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else if (null != rule.attrName) {\n seleniumDriver.findElementByName(webDriver, sleepTime, rule.attrName, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else if (null != rule.className) {\n seleniumDriver.findElementByClassName(webDriver, sleepTime, rule.className, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else if (null != rule.xpath) {\n seleniumDriver.findElementByXpath(webDriver, sleepTime, rule.xpath, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else if (null != rule.tagName) {\n seleniumDriver.findElementByTagName(webDriver, sleepTime, rule.tagName, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n } else {\n seleniumDriver.findElementByText(webDriver, sleepTime, rule.attrText, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n }\n }; \n \n var open = function(rule, onSuccess, onError){\n try{\n \n function goTo(webDriver){\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n info.log(\"opening.. => {}\", JSON.stringify(rule));\n webDriver.manage().window().maximize();\n browser.setDriver(webDriver);\n var url = rule.value.replaceAll(\"\\\\\\\\\", \"\");\n webDriver.get(url);\n error.log(\"process success\");\n onSuccess();\n \n }\n \n if(null != browser.getDriver()){\n info.log(\"reusing driver...\");\n goTo(browser.getDriver());\n }else{\n \n seleniumDriver.createLocalWebDriver(browser.name, currentScenario.locale,\n goTo,\n function(err){\n error.log(\"selenium exception => {}\", err);\n onError(err);\n }\n );\n \n }\n \n } catch(e){\n error.log(\"catch exception => {}\", e);\n onError(e);\n }\n };\n \n var addEvironmentValue = function(rule){\n \n if(message.environment != \"\" && null != rule.value && /{{(.*)}}/.test(rule.value)) {\n var newVal = environmentVariables[rule.value.match(/{{(.*)}}/)[1]];\n if(typeof newVal != \"undefined\" && null != newVal){\n rule.value = rule.value.replaceAll(\"\\\\{\\\\{(.*)\\\\}\\\\}\", newVal) ;\n }\n }\n \n }\n \n util.addGlobalVariable(\"addEvironmentValue\", addEvironmentValue);\n util.addGlobalVariable(\"open\", open);\n util.addGlobalVariable(\"findElement\", findElement);\n \n stage.complete();\n \n} catch(e){\n \n util.finishStage(stage, \"Error preparing functions\", \"ERROR_CODE\", 500);\n \n}
\n \n \n Flow_1tz5ro4 \n Flow_0vg2aho \n Flow_01pedei \n \n \n \n Flow_1ikm2u4 \n Flow_0bwxtnc \n Flow_07mqrao \n Flow_026jqoy \n Flow_0brfqm9 \n Flow_1ptxory \n Flow_1nqm2qi \n Flow_02h1p4l \n Flow_0ezijin \n Flow_1cxjz6k \n Flow_1ig3fl7 \n Flow_1dlm25o \n Flow_0zx4u9y \n Flow_0kt0881 \n Flow_169dp77 \n Flow_0s60dc6 \n Flow_1g2b92s \n Flow_1czynyp \n Flow_1rywh2i \n Flow_0sjhy5y \n Flow_0vcdflo \n Flow_0j9oiea \n Flow_0r9jusq \n \n \n Flow_05jkw6v \n \n \n \n \n \n \n ruleIndex++;\nutil.addGlobalVariable(\"ruleIndex\", ruleIndex);\nif(currentRule.screenShot){\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n seleniumDriver.takeScreenShot(scenario, webDriver, function(f) {\n stage.complete();\n }, function(err) {\n util.finishStage(stage, \"Error while taking screenshot => \" + err, \"BDD_9003\", 500);\n }); \n}else{\n stage.complete();\n}
\n \n \n Flow_14xiuk2 \n Flow_1idt49t \n \n \n \n \n \n findElement(currentRule, false, function(el){\n el.click();\n stage.complete()\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});
\n \n \n Flow_07mqrao \n Flow_0hkuwpp \n \n \n \n \n Flow_0hkuwpp \n Flow_0bali12 \n Flow_1nwc583 \n Flow_05f1wv5 \n Flow_0iy05dq \n Flow_1m1x428 \n Flow_0ezqxwl \n Flow_01lc1kd \n Flow_1x0l68y \n Flow_0syc6q2 \n Flow_16d24xk \n Flow_1y7r28d \n Flow_0jnzgu1 \n Flow_1ilh1nh \n Flow_14xiuk2 \n \n \n \n \n \n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\nvar webDriver = browser.getDriver();\nif(currentRule.value == webDriver.getCurrentUrl()){\n stage.complete();\n}else{\n util.finishStage(stage, \"Assertion error \\\"\"+ webDriver.getCurrentUrl() +\"\\\" is not equals to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n}
\n \n \n Flow_026jqoy \n Flow_1nwc583 \n \n \n \n \n \n \n fileUtils.getFileList(\"src/test/resources/build/features/\" + browser.name, [\"json\"],\n function(arr){\n var impFeatures = new Array();\n arr.forEach(function(file){\n fileUtils.readFileToString(file, function(data){\n impFeatures.push(JSON.parse(data));\n }, function(err){\n util.finishStage(stage, \"Unexpected error while reading the features => \" + err, \"BDD_9000\", 500);\n });\n });\n util.addGlobalVariable(\"impFeatures\", impFeatures);\n stage.complete();\n },\n function(err){\n util.finishStage(stage, \"Unexpected error while loading the imported features => \" + err, \"BDD_9000\", 500);\n }\n);
\n \n \n Flow_1ps9xh7 \n Flow_0a3yj8g \n \n \n \n Flow_0l0cek4 \n Flow_1ps9xh7 \n Flow_1tz5ro4 \n \n \n \n \n \n \n try{\n info.log(\"total of imported features => {}\", impFeatures.length);\n \n var importedRules = new Array();\n \n function addRules(importedScenario, importObj){\n \n var n = 0;\n \n importedScenario.steeps.forEach(function(st){\n \n if(!st.mocked){\n \n if(st.anImport != null) findRule(st.anImport);\n \n st.rules.forEach(function(rule){\n importedRules.push(rule);\n if(importObj.arguments != null && importObj.arguments.length > 0 ){\n var rrArr = rules.filter(function(r){\n var nme = rule\n if(Array.isArray(nme)) nme = nme[0];\n return r.name == nme;\n });\n if(rrArr.length > 0){\n info.log(\"Adding argument => {}\", importObj.arguments[n]);\n rrArr[0].value = importObj.arguments[n]; \n }\n }\n });\n \n n++;\n \n }\n \n \n });\n }\n \n function findRule(importObj){\n var ftArr = impFeatures.filter(function(e){\n return e.name == importObj.featureName;\n });\n if(ftArr.length > 0){\n var ft = ftArr[0];\n var scArr = ft.scenarios.filter(function(sc){\n return sc.name == importObj.scenarioName;\n });\n if(scArr.length > 0 ){\n addRules(scArr[0], importObj)\n }\n }\n }\n \n findRule(currentSteep.anImport);\n \n \n currentSteep.rules.forEach(function(r){\n importedRules.push(r);\n });\n \n currentSteep.rules = importedRules;\n \n util.addGlobalVariable(\"rules\", rules);\n util.addGlobalVariable(\"currentSteep\", currentSteep);\n \n info.log(\"Total of rules to be processed => {}\", JSON.stringify(currentSteep.rules));\n \n stage.complete();\n}catch(e){\n util.finishStage(stage, \"Unexpected error while processing imported rules\" + e, \"BDD_9000\", 500);\n}
\n \n \n Flow_0a3yj8g \n Flow_0vg2aho \n \n \n \n \n \n info.log(\"Wait for => {}\", browser.name);\nseleniumDriver.waitFor(500, function(f){\n stage.complete();\n}, function(err){\n util.finishStage(stage, err, \"BDD_9000\", 500);\n})
\n \n \n Flow_0hw7pag \n Flow_1k69kb4 \n \n \n \n Flow_1k69kb4 \n Flow_1sn86uu \n Flow_05f1wv5 \n \n \n \n \n \n \n findElement(currentRule,false, function(el){\n var htmlText = el.getText();\n if(new RegExp(currentRule.value).test(htmlText)){\n stage.complete();\n }else{\n util.finishStage(stage, \"Assertion error \\\"\"+ htmlText +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n }\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});
\n \n \n Flow_0brfqm9 \n Flow_0iy05dq \n \n \n \n \n \n \n findElement(currentRule, false, function(el){\n \n var attrText = el.getAttribute(currentRule.attrName);\n if(new RegExp(currentRule.value).test(attrText)){\n stage.complete();\n }else{\n util.finishStage(stage, \"Assertion error \\\"\"+ attrText +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n } \n \n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});
\n \n \n Flow_1ptxory \n Flow_1m1x428 \n \n \n \n \n \n \n findElement(currentRule, true, function(arr){\n if(new RegExp(currentRule.value).test(arr.length)){\n stage.complete();\n }else{\n util.finishStage(stage, \"Assertion error \\\"\"+ arr.length +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n }\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});
\n \n \n Flow_1nqm2qi \n Flow_0ezqxwl \n \n \n \n \n \n \n try{\n findElement(currentRule, false, function(el){\n el.sendKeys(currentRule.value);\n stage.complete();\n }, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n }); \n}catch(e){\n util.finishStage(stage, \"Error while sending keys\", \"ERROR_CODE\", 500);\n}
\n \n \n Flow_02h1p4l \n Flow_01lc1kd \n \n \n \n \n \n \n findElement(currentRule, false, function(el){\n el.sendKeys(seleniumDriver.DELETE);\n stage.complete();\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});
\n \n \n Flow_0ezijin \n Flow_1x0l68y \n \n \n \n \n \n \n findElement(currentRule, false, function(el){\n el.sendKeys(seleniumDriver.ENTER);\n stage.complete();\n}, function(e){\n util.finishStage(stage, e, \"BDD_9002\", 500);\n});
\n \n \n Flow_1cxjz6k \n Flow_0syc6q2 \n \n \n \n \n \n \n try{\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n webDriver.executeScript(\"window.scrollBy(0,\" + currentRule.value + \")\");\n stage.complete(); \n}catch(e){\n util.finishStage(stage, \"Error while scrolling => \"+ e, \"BDD_9000\", 500);\n}
\n \n \n Flow_1ig3fl7 \n Flow_16d24xk \n \n \n \n \n Flow_0k0mwop \n Flow_04mwzo2 \n Flow_1ikm2u4 \n Flow_1icq3f9 \n \n \n \n \n \n var webDriver = browser.getDrivers().get(scenario.name);\nhandler(webDriver, currentRule, function(f){\n if(f){\n stage.complete();\n }else{\n util.finishStage(stage, \"The custom implementation has returned an error signal\", \"BDD_9000\", 500);\n }\n}, function(err){\n util.finishStage(stage, \"Error while calling cutom implementation => \" + e, \"BDD_9000\", 500);\n});
\n \n \n Flow_1icq3f9 \n Flow_1y7r28d \n \n \n \n \n \n \n try{\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n webDriver.quit();\n stage.complete(); \n}catch(e){\n util.finishStage(stage, \"Error while closing the session => \"+ e, \"BDD_9000\", 500);\n}
\n \n \n Flow_1dlm25o \n Flow_0pmgl3o \n \n \n \n \n \n \n try{\n var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n var webDriver = browser.getDriver();\n webDriver.executeScript(currentRule.value);\n stage.complete(); \n}catch(e){\n util.finishStage(stage, \"Error while scrolling => \"+ e, \"BDD_9000\", 500);\n}
\n \n \n Flow_0zx4u9y \n Flow_0jnzgu1 \n \n \n \n \n Flow_02clqzs \n Flow_08b1afr \n Flow_046z14y \n \n \n \n \n httpTransaction.host = currentRule.value;\nstage.complete();
\n \n \n Flow_0kt0881 \n Flow_1b4mwlx \n \n \n \n \n \n \n httpTransaction.port = Number(currentRule.value);\nstage.complete();
\n \n \n Flow_169dp77 \n Flow_1thpfeb \n \n \n \n \n Flow_1b4mwlx \n Flow_1thpfeb \n Flow_12b175w \n Flow_1waja06 \n Flow_1t4sm0e \n Flow_0ug24ih \n Flow_0vcjkyu \n Flow_023r2px \n Flow_16fxsi6 \n Flow_1mr20rh \n Flow_1ilh1nh \n \n \n \n \n httpTransaction.endPoint = currentRule.value;\nstage.complete();
\n \n \n Flow_0s60dc6 \n Flow_12b175w \n \n \n \n \n \n \n httpTransaction.ssl = currentRule.value;\nstage.complete();
\n \n \n Flow_1g2b92s \n Flow_1waja06 \n \n \n \n \n \n \n var fileUrl = \"src/test/resources/\" + currentRule.value;\nfileUtils.readFileToString(\n fileUrl,\n function(data){\n httpTransaction.payload = data;\n info.log(data);\n stage.complete(); \n },\n function(err){\n util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n }\n);
\n \n \n Flow_1czynyp \n Flow_1t4sm0e \n \n \n \n \n \n \n if(dataTable != null){\n var headers= {};\n dataTable.forEach(function(v){\n headers[v[0]] = v[1];\n });\n headers = JSON.stringify(headers);\n info.log(headers);\n httpTransaction.headers = headers;\n}\nstage.complete();
\n \n \n Flow_1rywh2i \n Flow_0ug24ih \n \n \n \n \n \n \n httpTransaction.httpMethod = currentRule.value;\nstage.complete();
\n \n \n Flow_0sjhy5y \n Flow_0vcjkyu \n \n \n \n \n \n \n info.log(httpTransaction.toString());\n \n var wc = webclient.build(httpTransaction.port, httpTransaction.host, \n httpTransaction.endPoint)\n .httpMethod(httpTransaction.httpMethod)\n .setSSL(httpTransaction.ssl);\n \n if(httpTransaction.headers != null){\n \n var headers = JSON.parse(httpTransaction.headers);\n var key = \"\";\n for(key in headers){\n wc.addHeader(key, headers[key]);\n }\n \n }\n \n var payload = \"{}\";\n \n if(httpTransaction.payload != null){\n \n payload = httpTransaction.payload;\n \n }\n \n wc.sendJsonObjectAndGetStatusCode(payload, function(httpCode, jsonResponse){\n httpTransaction.statusCode = httpCode;\n httpTransaction.response = jsonResponse;\n info.log(\"API Response code => {}\",httpCode)\n info.log(\"API Response body => {}\",jsonResponse)\n stage.complete();\n }, function(err){\n stage.fail(err);\n });
\n \n \n Flow_0vcdflo \n Flow_023r2px \n \n \n \n \n \n \n if(httpTransaction.statusCode == Number(currentRule.value)){\n stage.complete();\n}else{\n util.finishStage(stage, \"Assertion error \\\"\"+ httpTransaction.statusCode +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n}
\n \n \n Flow_0j9oiea \n Flow_16fxsi6 \n \n \n \n \n \n \n if(dataTable != null){\n \n var errors = \"\";\n dataTable.forEach(function(v){\n \n httpTransaction.validateField(v[0], v[1],\n function(ass){\n if (!ass.isStatus()) {\n errors += ass.getMessage() + \"\\n\";\n } \n },\n function(err){\n util.finishStage(stage, err, \"BDD_9000\", 500);\n }\n );\n });\n \n if(errors.length > 0){\n util.finishStage(stage, errors, \"BDD_9000\", 500);\n }else{\n stage.complete(); \n }\n}else{\n stage.complete();\n}
\n \n \n Flow_0r9jusq \n Flow_1mr20rh \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n",
"jsFunctions" : "var interpreter = {\n\texclusive_gateway: {\n\t\tis_input_valid: {\n\t\t\tyes: function() {\n\t\t\t\treturn message.isInputValid\n\t\t\t},\n\t\t\tno: function() {\n\t\t\t\t\n\t\t\t}\n\t\t},\n\t\tis_steep_mocked: {\n\t\t\tyes: function() {\n\t\t\t\treturn currentSteep.mocked && null == currentSteep.anImport && currentSteep.rules.length == 1\n\t\t\t},\n\t\t\tno: function() {\n\t\t\t\t\n\t\t\t}\n\t\t},\n\t\tfor_each_rule: {\n\t\t\tnext: function() {\n\t\t\t\treturn ruleIndex < currentSteep.rules.length\n\t\t\t},\n\t\t\tfinish: function() {\n\t\t\t\t\n\t\t\t}\n\t\t},\n\t\thas_argument: {\n\t\t\tyes: function() {\n\t\t\t\treturn currentSteep.hasArgument && ruleIndex == currentSteep.rules.length -1 || Array.isArray(currentSteep.rules[ruleIndex])\n\t\t\t},\n\t\t\tno: function() {\n\t\t\t\t\n\t\t\t}\n\t\t},\n\t\tbrowser_action: {\n\t\t\topen: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"OPEN\"\n\t\t\t},\n\t\t\tclick: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"CLICK\"\n\t\t\t},\n\t\t\tvalidate_url: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"VALIDATE_URL\"\n\t\t\t},\n\t\t\tfind_text: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"FIND_TEXT\"\n\t\t\t},\n\t\t\tfind_text_in_attribute: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"FIND_TEXT_IN_ATTRIBUTE\"\n\t\t\t},\n\t\t\tcount_elements: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"COUNT_ELEMENTS\"\n\t\t\t},\n\t\t\tinput: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"INPUT\"\n\t\t\t},\n\t\t\tkey_press_delete: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"KEY_PRESS_DELETE\"\n\t\t\t},\n\t\t\tkey_press_enter: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"KEY_PRESS_ENTER\"\n\t\t\t},\n\t\t\tscroll_to: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"SCROLL_TO\"\n\t\t\t},\n\t\t\tquit: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"QUIT\"\n\t\t\t},\n\t\t\tscript: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"SCRIPT\"\n\t\t\t},\n\t\t\tapi_host: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_HOST\"\n\t\t\t},\n\t\t\tapi_port: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_PORT\"\n\t\t\t},\n\t\t\tapi_endpoint: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_ENDPOINT\"\n\t\t\t},\n\t\t\tapi_ssl: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_SSL\"\n\t\t\t},\n\t\t\tapi_load_payload: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_LOAD_PAYLOAD\"\n\t\t\t},\n\t\t\tapi_headers: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_HEADERS\"\n\t\t\t},\n\t\t\tapi_method: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_METHOD\"\n\t\t\t},\n\t\t\tapi_call: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_CALL\"\n\t\t\t},\n\t\t\tapi_validate_status_code: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_VALIDATE_STATUS_CODE\"\n\t\t\t},\n\t\t\tapi_validate_body: function() {\n\t\t\t\treturn currentRule.type.toUpperCase() == \"API_VALIDATE_BODY\"\n\t\t\t}\n\t\t},\n\t\thas_imported_feattures: {\n\t\t\tyes: function() {\n\t\t\t\treturn null != currentSteep.anImport\n\t\t\t},\n\t\t\tno: function() {\n\t\t\t\t\n\t\t\t}\n\t\t},\n\t\tis_rule_mocked: {\n\t\t\tno: function() {\n\t\t\t\t\n\t\t\t},\n\t\t\tyes: function() {\n\t\t\t\treturn currentSteep.mocked && ruleIndex == currentSteep.rules.length -1\n\t\t\t}\n\t\t},\n\t\thas_custom_implementation: {\n\t\t\tno: function() {\n\t\t\t\t\n\t\t\t},\n\t\t\tyes: function() {\n\t\t\t\treturn handler != null\n\t\t\t}\n\t\t}\n\t},\n\tbusiness_tasks: {},\n\tscript_tasks: {\n\t\tload_steep_descriptor: function() {\n\t\t\tif(null == scenario) {\n\t\t\t util.finishStage(stage, \"Cucumber stage object is null\", \"ERROR_CODE\", 500);\n\t\t\t}else{\n\t\t\t var fileUrl = \"src/test/resources/build/features/\" + browser.name + \"/\" + scenario.id.match(/\\/([^\\/]+)\\.feature/)[1] + \".json\";\n\t\t\t info.log(\"Configuration file => {}\", fileUrl);\n\t\t\t fileUtils.readFileToString(\n\t\t\t fileUrl,\n\t\t\t function(data){\n\t\t\t \n\t\t\t var currentFeature = JSON.parse(data);\n\t\t\t \n\t\t\t var currentScenario = currentFeature.scenarios.filter(function(es){\n\t\t\t return es.name == scenario.name;\n\t\t\t })[0];\n\t\t\t \n\t\t\t var currentSteep = currentScenario.steeps.filter(function(st){\n\t\t\t return st.name == message.steepName;\n\t\t\t })[0];\n\t\t\t \n\t\t\t util.addGlobalVariable(\"currentFeature\", currentFeature);\n\t\t\t util.addGlobalVariable(\"currentScenario\", currentScenario);\n\t\t\t util.addGlobalVariable(\"currentSteep\", currentSteep);\n\t\t\t util.addGlobalVariable(\"ruleIndex\", 0);\n\t\t\t info.log(\"currentSteep => {}\", JSON.stringify(currentSteep));\n\t\t\t \n\t\t\t stage.complete(); \n\t\t\t },\n\t\t\t function(err){\n\t\t\t util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n\t\t\t }\n\t\t\t );\n\t\t\t}\n\t\t},\n\t\tinput_not_valid: function() {\n\t\t\tutil.finishStage(stage, \"Input is not valid\", \"ERROR_CODE\", 500);\n\t\t},\n\t\tload_rules: function() {\n\t\t\tvar fileUrl = \"src/test/resources/features/rules.json\";\n\t\t\tfileUtils.readFileToString(\n\t\t\t fileUrl,\n\t\t\t function(data){\n\t\t\t var config = JSON.parse(data);\n\t\t\t var rules = [];\n\t\t\t \n\t\t\t for(var key in config.rules){\n\t\t\t \n\t\t\t config.rules[key].forEach(function(r){\n\t\t\t rules.push(r);\n\t\t\t });\n\t\t\t \n\t\t\t }\n\t\t\t \n\t\t\t var environmentVariables = {};\n\t\t\t \n\t\t\t if(message.environment != \"\" && typeof config.env != \"undefined\" && typeof config.env[message.environment] != \"undefined\"){\n\t\t\t environmentVariables = config.env[message.environment];\n\t\t\t }\n\t\t\t \n\t\t\t util.addGlobalVariable(\"environmentVariables\", environmentVariables);\n\t\t\t util.addGlobalVariable(\"rules\", rules);\n\t\t\t info.log(\"Rules for =>{}\", browser.name);\n\t\t\t stage.complete(); \n\t\t\t },\n\t\t\t function(err){\n\t\t\t util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n\t\t\t }\n\t\t\t);\n\t\t},\n\t\tget_rule: function() {\n\t\t\tvar r = currentSteep.rules[ruleIndex];\n\t\t\t\n\t\t\tvar filterRules = rules.filter(function(rr){\n\t\t\t if(Array.isArray(r)){\n\t\t\t return rr.name == r[0]\n\t\t\t }else{\n\t\t\t return rr.name == r\n\t\t\t }\n\t\t\t});\n\t\t\t\n\t\t\t\n\t\t\tif(filterRules.length > 0){\n\t\t\t var currentRule = filterRules[0];\n\t\t\t addEvironmentValue(currentRule);\n\t\t\t util.addGlobalVariable(\"currentRule\", currentRule);\n\t\t\t if(typeof currentRule.sleep != \"undefined\" && currentRule.sleep != null){\n\t\t\t seleniumDriver.waitFor(currentRule.sleep, function(f){\n\t\t\t stage.complete();\n\t\t\t }, function(err){\n\t\t\t util.finishStage(stage, err, \"BDD_9000\", 500);\n\t\t\t })\n\t\t\t }else{\n\t\t\t stage.complete();\n\t\t\t }\n\t\t\t \n\t\t\t} else {\n\t\t\t util.finishStage(stage, \"Unable to find the rule in the rules.json file\", \"BDD_9001\", 500); \n\t\t\t}\n\t\t},\n\t\tset_argument: function() {\n\t\t\tif(Array.isArray(currentSteep.rules[ruleIndex]) && currentSteep.rules[ruleIndex].length > 1){\n\t\t\t currentRule.value = currentSteep.rules[ruleIndex][1];\n\t\t\t}else if(currentSteep.hasArgument){\n\t\t\t currentRule.value = message.argument; \n\t\t\t}\n\t\t\taddEvironmentValue(currentRule);\n\t\t\tstage.complete();\n\t\t},\n\t\topen_action: function() {\n\t\t\tinfo.log(\"Opening for => {}\", browser.name);\n\t\t\topen(currentRule, function(){\n\t\t\t info.log(\"Browser opened successfully!!\");\n\t\t\t stage.complete()\n\t\t\t}, function(e){\n\t\t\t util.finishStage(stage, e, \"BDD_9002\", 500);\n\t\t\t});\n\t\t},\n\t\tload_webdriver_functions: function() {\n\t\t\ttry{\n\t\t\t \n\t\t\t info.log(\"ENTROOOOOOOO\");\n\t\t\t var findElement = function(rule, isMultiple, onSuccess, onError){\n\t\t\t var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n\t\t\t var webDriver = browser.getDriver();\n\t\t\t var sleepTime = null != rule.sleep ? rule.sleep : 0;\n\t\t\t \n\t\t\t var by;\n\t\t\t \n\t\t\t if (null != rule.attrId) {\n\t\t\t seleniumDriver.findElementById(webDriver, sleepTime, rule.attrId, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n\t\t\t } else if (null != rule.attrName) {\n\t\t\t seleniumDriver.findElementByName(webDriver, sleepTime, rule.attrName, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n\t\t\t } else if (null != rule.className) {\n\t\t\t seleniumDriver.findElementByClassName(webDriver, sleepTime, rule.className, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n\t\t\t } else if (null != rule.xpath) {\n\t\t\t seleniumDriver.findElementByXpath(webDriver, sleepTime, rule.xpath, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n\t\t\t } else if (null != rule.tagName) {\n\t\t\t seleniumDriver.findElementByTagName(webDriver, sleepTime, rule.tagName, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n\t\t\t } else {\n\t\t\t seleniumDriver.findElementByText(webDriver, sleepTime, rule.attrText, isMultiple, function(el){onSuccess(el)}, function(err){onError(err)});\n\t\t\t }\n\t\t\t }; \n\t\t\t \n\t\t\t var open = function(rule, onSuccess, onError){\n\t\t\t try{\n\t\t\t \n\t\t\t function goTo(webDriver){\n\t\t\t var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n\t\t\t info.log(\"opening.. => {}\", JSON.stringify(rule));\n\t\t\t webDriver.manage().window().maximize();\n\t\t\t browser.setDriver(webDriver);\n\t\t\t var url = rule.value.replaceAll(\"\\\\\\\\\", \"\");\n\t\t\t webDriver.get(url);\n\t\t\t error.log(\"process success\");\n\t\t\t onSuccess();\n\t\t\t \n\t\t\t }\n\t\t\t \n\t\t\t if(null != browser.getDriver()){\n\t\t\t info.log(\"reusing driver...\");\n\t\t\t goTo(browser.getDriver());\n\t\t\t }else{\n\t\t\t \n\t\t\t seleniumDriver.createLocalWebDriver(browser.name, currentScenario.locale,\n\t\t\t goTo,\n\t\t\t function(err){\n\t\t\t error.log(\"selenium exception => {}\", err);\n\t\t\t onError(err);\n\t\t\t }\n\t\t\t );\n\t\t\t \n\t\t\t }\n\t\t\t \n\t\t\t } catch(e){\n\t\t\t error.log(\"catch exception => {}\", e);\n\t\t\t onError(e);\n\t\t\t }\n\t\t\t };\n\t\t\t \n\t\t\t var addEvironmentValue = function(rule){\n\t\t\t \n\t\t\t if(message.environment != \"\" && null != rule.value && /{{(.*)}}/.test(rule.value)) {\n\t\t\t var newVal = environmentVariables[rule.value.match(/{{(.*)}}/)[1]];\n\t\t\t if(typeof newVal != \"undefined\" && null != newVal){\n\t\t\t rule.value = rule.value.replaceAll(\"\\\\{\\\\{(.*)\\\\}\\\\}\", newVal) ;\n\t\t\t }\n\t\t\t }\n\t\t\t \n\t\t\t }\n\t\t\t \n\t\t\t util.addGlobalVariable(\"addEvironmentValue\", addEvironmentValue);\n\t\t\t util.addGlobalVariable(\"open\", open);\n\t\t\t util.addGlobalVariable(\"findElement\", findElement);\n\t\t\t \n\t\t\t stage.complete();\n\t\t\t \n\t\t\t} catch(e){\n\t\t\t \n\t\t\t util.finishStage(stage, \"Error preparing functions\", \"ERROR_CODE\", 500);\n\t\t\t \n\t\t\t}\n\t\t},\n\t\ttake_screenshot: function() {\n\t\t\truleIndex++;\n\t\t\tutil.addGlobalVariable(\"ruleIndex\", ruleIndex);\n\t\t\tif(currentRule.screenShot){\n\t\t\t var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n\t\t\t var webDriver = browser.getDriver();\n\t\t\t seleniumDriver.takeScreenShot(scenario, webDriver, function(f) {\n\t\t\t stage.complete();\n\t\t\t }, function(err) {\n\t\t\t util.finishStage(stage, \"Error while taking screenshot => \" + err, \"BDD_9003\", 500);\n\t\t\t }); \n\t\t\t}else{\n\t\t\t stage.complete();\n\t\t\t}\n\t\t},\n\t\tclick_action: function() {\n\t\t\tfindElement(currentRule, false, function(el){\n\t\t\t el.click();\n\t\t\t stage.complete()\n\t\t\t}, function(e){\n\t\t\t util.finishStage(stage, e, \"BDD_9002\", 500);\n\t\t\t});\n\t\t},\n\t\tvalidate_location: function() {\n\t\t\tvar featureName = scenario.id.match(/.*:(.*):.*/)[1];\n\t\t\tvar webDriver = browser.getDriver();\n\t\t\tif(currentRule.value == webDriver.getCurrentUrl()){\n\t\t\t stage.complete();\n\t\t\t}else{\n\t\t\t util.finishStage(stage, \"Assertion error \\\"\"+ webDriver.getCurrentUrl() +\"\\\" is not equals to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n\t\t\t}\n\t\t},\n\t\tload_imported_rules: function() {\n\t\t\tfileUtils.getFileList(\"src/test/resources/build/features/\" + browser.name, [\"json\"],\n\t\t\t function(arr){\n\t\t\t var impFeatures = new Array();\n\t\t\t arr.forEach(function(file){\n\t\t\t fileUtils.readFileToString(file, function(data){\n\t\t\t impFeatures.push(JSON.parse(data));\n\t\t\t }, function(err){\n\t\t\t util.finishStage(stage, \"Unexpected error while reading the features => \" + err, \"BDD_9000\", 500);\n\t\t\t });\n\t\t\t });\n\t\t\t util.addGlobalVariable(\"impFeatures\", impFeatures);\n\t\t\t stage.complete();\n\t\t\t },\n\t\t\t function(err){\n\t\t\t util.finishStage(stage, \"Unexpected error while loading the imported features => \" + err, \"BDD_9000\", 500);\n\t\t\t }\n\t\t\t);\n\t\t},\n\t\tprocess_features: function() {\n\t\t\ttry{\n\t\t\t info.log(\"total of imported features => {}\", impFeatures.length);\n\t\t\t \n\t\t\t var importedRules = new Array();\n\t\t\t \n\t\t\t function addRules(importedScenario, importObj){\n\t\t\t \n\t\t\t var n = 0;\n\t\t\t \n\t\t\t importedScenario.steeps.forEach(function(st){\n\t\t\t \n\t\t\t if(!st.mocked){\n\t\t\t \n\t\t\t if(st.anImport != null) findRule(st.anImport);\n\t\t\t \n\t\t\t st.rules.forEach(function(rule){\n\t\t\t importedRules.push(rule);\n\t\t\t if(importObj.arguments != null && importObj.arguments.length > 0 ){\n\t\t\t var rrArr = rules.filter(function(r){\n\t\t\t var nme = rule\n\t\t\t if(Array.isArray(nme)) nme = nme[0];\n\t\t\t return r.name == nme;\n\t\t\t });\n\t\t\t if(rrArr.length > 0){\n\t\t\t info.log(\"Adding argument => {}\", importObj.arguments[n]);\n\t\t\t rrArr[0].value = importObj.arguments[n]; \n\t\t\t }\n\t\t\t }\n\t\t\t });\n\t\t\t \n\t\t\t n++;\n\t\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t\t });\n\t\t\t }\n\t\t\t \n\t\t\t function findRule(importObj){\n\t\t\t var ftArr = impFeatures.filter(function(e){\n\t\t\t return e.name == importObj.featureName;\n\t\t\t });\n\t\t\t if(ftArr.length > 0){\n\t\t\t var ft = ftArr[0];\n\t\t\t var scArr = ft.scenarios.filter(function(sc){\n\t\t\t return sc.name == importObj.scenarioName;\n\t\t\t });\n\t\t\t if(scArr.length > 0 ){\n\t\t\t addRules(scArr[0], importObj)\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t \n\t\t\t findRule(currentSteep.anImport);\n\t\t\t \n\t\t\t \n\t\t\t currentSteep.rules.forEach(function(r){\n\t\t\t importedRules.push(r);\n\t\t\t });\n\t\t\t \n\t\t\t currentSteep.rules = importedRules;\n\t\t\t \n\t\t\t util.addGlobalVariable(\"rules\", rules);\n\t\t\t util.addGlobalVariable(\"currentSteep\", currentSteep);\n\t\t\t \n\t\t\t info.log(\"Total of rules to be processed => {}\", JSON.stringify(currentSteep.rules));\n\t\t\t \n\t\t\t stage.complete();\n\t\t\t}catch(e){\n\t\t\t util.finishStage(stage, \"Unexpected error while processing imported rules\" + e, \"BDD_9000\", 500);\n\t\t\t}\n\t\t},\n\t\twait_for_sometime: function() {\n\t\t\tinfo.log(\"Wait for => {}\", browser.name);\n\t\t\tseleniumDriver.waitFor(500, function(f){\n\t\t\t stage.complete();\n\t\t\t}, function(err){\n\t\t\t util.finishStage(stage, err, \"BDD_9000\", 500);\n\t\t\t})\n\t\t},\n\t\tget_html_text: function() {\n\t\t\tfindElement(currentRule,false, function(el){\n\t\t\t var htmlText = el.getText();\n\t\t\t if(new RegExp(currentRule.value).test(htmlText)){\n\t\t\t stage.complete();\n\t\t\t }else{\n\t\t\t util.finishStage(stage, \"Assertion error \\\"\"+ htmlText +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n\t\t\t }\n\t\t\t}, function(e){\n\t\t\t util.finishStage(stage, e, \"BDD_9002\", 500);\n\t\t\t});\n\t\t},\n\t\tget_attribute_value: function() {\n\t\t\tfindElement(currentRule, false, function(el){\n\t\t\t \n\t\t\t var attrText = el.getAttribute(currentRule.attrName);\n\t\t\t if(new RegExp(currentRule.value).test(attrText)){\n\t\t\t stage.complete();\n\t\t\t }else{\n\t\t\t util.finishStage(stage, \"Assertion error \\\"\"+ attrText +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n\t\t\t } \n\t\t\t \n\t\t\t}, function(e){\n\t\t\t util.finishStage(stage, e, \"BDD_9002\", 500);\n\t\t\t});\n\t\t},\n\t\tcount_all_elements: function() {\n\t\t\tfindElement(currentRule, true, function(arr){\n\t\t\t if(new RegExp(currentRule.value).test(arr.length)){\n\t\t\t stage.complete();\n\t\t\t }else{\n\t\t\t util.finishStage(stage, \"Assertion error \\\"\"+ arr.length +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n\t\t\t }\n\t\t\t}, function(e){\n\t\t\t util.finishStage(stage, e, \"BDD_9002\", 500);\n\t\t\t});\n\t\t},\n\t\tinput_text: function() {\n\t\t\ttry{\n\t\t\t findElement(currentRule, false, function(el){\n\t\t\t el.sendKeys(currentRule.value);\n\t\t\t stage.complete();\n\t\t\t }, function(e){\n\t\t\t util.finishStage(stage, e, \"BDD_9002\", 500);\n\t\t\t }); \n\t\t\t}catch(e){\n\t\t\t util.finishStage(stage, \"Error while sending keys\", \"ERROR_CODE\", 500);\n\t\t\t}\n\t\t},\n\t\tpress_delete: function() {\n\t\t\tfindElement(currentRule, false, function(el){\n\t\t\t el.sendKeys(seleniumDriver.DELETE);\n\t\t\t stage.complete();\n\t\t\t}, function(e){\n\t\t\t util.finishStage(stage, e, \"BDD_9002\", 500);\n\t\t\t});\n\t\t},\n\t\tpress_enter: function() {\n\t\t\tfindElement(currentRule, false, function(el){\n\t\t\t el.sendKeys(seleniumDriver.ENTER);\n\t\t\t stage.complete();\n\t\t\t}, function(e){\n\t\t\t util.finishStage(stage, e, \"BDD_9002\", 500);\n\t\t\t});\n\t\t},\n\t\tscroll_to: function() {\n\t\t\ttry{\n\t\t\t var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n\t\t\t var webDriver = browser.getDriver();\n\t\t\t webDriver.executeScript(\"window.scrollBy(0,\" + currentRule.value + \")\");\n\t\t\t stage.complete(); \n\t\t\t}catch(e){\n\t\t\t util.finishStage(stage, \"Error while scrolling => \"+ e, \"BDD_9000\", 500);\n\t\t\t}\n\t\t},\n\t\tcustom_handler: function() {\n\t\t\tvar webDriver = browser.getDrivers().get(scenario.name);\n\t\t\thandler(webDriver, currentRule, function(f){\n\t\t\t if(f){\n\t\t\t stage.complete();\n\t\t\t }else{\n\t\t\t util.finishStage(stage, \"The custom implementation has returned an error signal\", \"BDD_9000\", 500);\n\t\t\t }\n\t\t\t}, function(err){\n\t\t\t util.finishStage(stage, \"Error while calling cutom implementation => \" + e, \"BDD_9000\", 500);\n\t\t\t});\n\t\t},\n\t\tquit_driver: function() {\n\t\t\ttry{\n\t\t\t var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n\t\t\t var webDriver = browser.getDriver();\n\t\t\t webDriver.quit();\n\t\t\t stage.complete(); \n\t\t\t}catch(e){\n\t\t\t util.finishStage(stage, \"Error while closing the session => \"+ e, \"BDD_9000\", 500);\n\t\t\t}\n\t\t},\n\t\trun_script: function() {\n\t\t\ttry{\n\t\t\t var featureName = scenario.id.match(/.*:(.*):.*/)[1];\n\t\t\t var webDriver = browser.getDriver();\n\t\t\t webDriver.executeScript(currentRule.value);\n\t\t\t stage.complete(); \n\t\t\t}catch(e){\n\t\t\t util.finishStage(stage, \"Error while scrolling => \"+ e, \"BDD_9000\", 500);\n\t\t\t}\n\t\t},\n\t\tapi_host: function() {\n\t\t\thttpTransaction.host = currentRule.value;\n\t\t\tstage.complete();\n\t\t},\n\t\tapi_port: function() {\n\t\t\thttpTransaction.port = Number(currentRule.value);\n\t\t\tstage.complete();\n\t\t},\n\t\tadd_endpoint: function() {\n\t\t\thttpTransaction.endPoint = currentRule.value;\n\t\t\tstage.complete();\n\t\t},\n\t\tset_ssl: function() {\n\t\t\thttpTransaction.ssl = currentRule.value;\n\t\t\tstage.complete();\n\t\t},\n\t\tload_payload: function() {\n\t\t\tvar fileUrl = \"src/test/resources/\" + currentRule.value;\n\t\t\tfileUtils.readFileToString(\n\t\t\t fileUrl,\n\t\t\t function(data){\n\t\t\t httpTransaction.payload = data;\n\t\t\t info.log(data);\n\t\t\t stage.complete(); \n\t\t\t },\n\t\t\t function(err){\n\t\t\t util.finishStage(stage, \"Error while ready configuration json file\", \"BDD_9000\", 500);\n\t\t\t }\n\t\t\t);\n\t\t},\n\t\tadd_headers: function() {\n\t\t\tif(dataTable != null){\n\t\t\t var headers= {};\n\t\t\t dataTable.forEach(function(v){\n\t\t\t headers[v[0]] = v[1];\n\t\t\t });\n\t\t\t headers = JSON.stringify(headers);\n\t\t\t info.log(headers);\n\t\t\t httpTransaction.headers = headers;\n\t\t\t}\n\t\t\tstage.complete();\n\t\t},\n\t\tdefine_http_method: function() {\n\t\t\thttpTransaction.httpMethod = currentRule.value;\n\t\t\tstage.complete();\n\t\t},\n\t\tcall_api: function() {\n\t\t\tinfo.log(httpTransaction.toString());\n\t\t\t \n\t\t\t var wc = webclient.build(httpTransaction.port, httpTransaction.host, \n\t\t\t httpTransaction.endPoint)\n\t\t\t .httpMethod(httpTransaction.httpMethod)\n\t\t\t .setSSL(httpTransaction.ssl);\n\t\t\t \n\t\t\t if(httpTransaction.headers != null){\n\t\t\t \n\t\t\t var headers = JSON.parse(httpTransaction.headers);\n\t\t\t var key = \"\";\n\t\t\t for(key in headers){\n\t\t\t wc.addHeader(key, headers[key]);\n\t\t\t }\n\t\t\t \n\t\t\t }\n\t\t\t \n\t\t\t var payload = \"{}\";\n\t\t\t \n\t\t\t if(httpTransaction.payload != null){\n\t\t\t \n\t\t\t payload = httpTransaction.payload;\n\t\t\t \n\t\t\t }\n\t\t\t \n\t\t\t wc.sendJsonObjectAndGetStatusCode(payload, function(httpCode, jsonResponse){\n\t\t\t httpTransaction.statusCode = httpCode;\n\t\t\t httpTransaction.response = jsonResponse;\n\t\t\t info.log(\"API Response code => {}\",httpCode)\n\t\t\t info.log(\"API Response body => {}\",jsonResponse)\n\t\t\t stage.complete();\n\t\t\t }, function(err){\n\t\t\t stage.fail(err);\n\t\t\t });\n\t\t},\n\t\tvalidate_http_code: function() {\n\t\t\tif(httpTransaction.statusCode == Number(currentRule.value)){\n\t\t\t stage.complete();\n\t\t\t}else{\n\t\t\t util.finishStage(stage, \"Assertion error \\\"\"+ httpTransaction.statusCode +\"\\\" is not matching to \\\"\"+ currentRule.value +\"\\\"\", \"BDD_9000\", 500);\n\t\t\t}\n\t\t},\n\t\tvalidate_response_body: function() {\n\t\t\tif(dataTable != null){\n\t\t\t \n\t\t\t var errors = \"\";\n\t\t\t dataTable.forEach(function(v){\n\t\t\t \n\t\t\t httpTransaction.validateField(v[0], v[1],\n\t\t\t function(ass){\n\t\t\t if (!ass.isStatus()) {\n\t\t\t errors += ass.getMessage() + \"\\n\";\n\t\t\t } \n\t\t\t },\n\t\t\t function(err){\n\t\t\t util.finishStage(stage, err, \"BDD_9000\", 500);\n\t\t\t }\n\t\t\t );\n\t\t\t });\n\t\t\t \n\t\t\t if(errors.length > 0){\n\t\t\t util.finishStage(stage, errors, \"BDD_9000\", 500);\n\t\t\t }else{\n\t\t\t stage.complete(); \n\t\t\t }\n\t\t\t}else{\n\t\t\t stage.complete();\n\t\t\t}\n\t\t}\n\t},\n\tservice_tasks: null\n}",
"needDeployment" : true,
"outgoingCache" : null,
"bddList" : [ ]
} ],
"properties" : { },
"beans" : null
}