Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas Al-Fitiani committed Jun 25, 2020
1 parent b05d48b commit 237d6be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/lib/cypress-testrail-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export class CypressTestRailReporter extends reporters.Spec {
}

// publish test cases results & close the run
this.testRail.publishResults(this.results);
this.testRail.closeRun(this.results);
this.testRail.publishResults(this.results)
.then(()=> this.testRail.closeRun());
});
}

Expand Down
17 changes: 3 additions & 14 deletions src/lib/testrail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class TestRail {
}

public publishResults(results: TestRailResult[]) {
axios({
return axios({
method: 'post',
url: `${this.base}/add_results_for_cases/${this.runId}`,
headers: { 'Content-Type': 'application/json' },
Expand All @@ -61,14 +61,14 @@ export class TestRail {
'\n',
` - Results are published to ${chalk.magenta(
`https://${this.options.domain}/index.php?/runs/view/${this.runId}`
)}`,
)} and test run marked as completed.`,
'\n'
);
})
.catch(error => console.error(error));
}

public closeRun(results: TestRailResult[]) {
public closeRun() {
axios({
method: 'post',
url: `${this.base}/close_run/${this.runId}`,
Expand All @@ -77,18 +77,7 @@ export class TestRail {
username: this.options.username,
password: this.options.password,
},
data: JSON.stringify({ results }),
})
.then(response => {
console.log('\n', chalk.green.underline.bold('(TestRail Reporter)'));
console.log(
'\n',
` - Test run marked as closed ${chalk.green(
`https://${this.options.domain}/index.php?/runs/view/${this.runId}`
)}`,
'\n'
);
})
.catch(error => console.error(error));
}
}

0 comments on commit 237d6be

Please sign in to comment.