-
Notifications
You must be signed in to change notification settings - Fork 0
/
demoUsage.js
executable file
·70 lines (56 loc) · 2.35 KB
/
demoUsage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const configFile = require("./config.json");
const testRailHelper = require("./src/railInstance.js");
const jiraHelper = require("./src/jiraInstance.js");
const objectModels = require("./src/interfaces");
async function tryTestRail() {
let trInstance = new testRailHelper(configFile.testrail);
let cookies = trInstance.initateAuthenticationToken();
let projectID = trInstance.getProjectIDS(cookies, "AVL Project"); // Get Project ID by project name
let mileStoneID = trInstance.getMileStoneID(
cookies,
projectID,
"Testcafe Integration" // Get Milestone ID by Milestone name
);
let testSuiteID = trInstance.getSuiteID(
cookies,
projectID,
"Demo_TestSuite" // Get Test Suite ID by Testsuite name
);
let userID = trInstance.getUserID(cookies); // Get user ID which will be assigned to this test run
let newTestRunObject = new objectModels.testRunObject(
await testSuiteID,
"Custom Plugin run-00" + Math.floor(Math.random() * 100).toString(),
await userID,
[15569, 166],
await mileStoneID,
"This is just a test description"
); // Create new test run object
let testCasesResults = [new objectModels.testCaseResultObject(15569, 5, "Test result", "4m"), new objectModels.testCaseResultObject(15100, 2, "Test result2", "2m")];
let addedRun = await trInstance.pushNewTestRun(
await cookies,
await projectID,
newTestRunObject
); // Push test run object to test rail
let addedResults = await trInstance.updateTestRunResults(
await cookies,
await addedRun,
testCasesResults
); // Push the test run results
console.log(await addedRun);
console.log(await addedResults);
}
async function tryJira() {
const jira = new jiraHelper(configFile.jira)
let sessionCookies = await jira.initateAuthenticationToken()
let jiraObject = new objectModels.jiraDefectObject(
"AVLAUT",
"Test Case Summary",
"Test Case description",
"Target component name",
"Test case priority",
"Test case severty",
["Array of labels"]
); // Create new jira defect object
let createIssue = await jira.pushNewIssue(await sessionCookies, jiraObject)
console.log(await createIssue)
}