Skip to content

Commit

Permalink
test: Give better reason
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversalzburg committed Nov 7, 2022
1 parent 0a980ba commit 4375af6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/tests/source/tests/smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ describe("Smoke test", function () {
let driver: WebDriver;
let kg: KittenGamePage;
let allPassed = true;
let countPassed = 0;
let countTotal = 0;

before(async function () {
if (username && accessKey) {
Expand Down Expand Up @@ -54,14 +56,17 @@ describe("Smoke test", function () {
if (!this.currentTest) {
return;
}
allPassed = allPassed && this.currentTest.state === "passed";
const testPassed = this.currentTest.state === "passed";
countPassed += testPassed ? 1 : 0;
++countTotal;
allPassed = allPassed && testPassed;
});

after(async () => {
await driver.executeScript(
`browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"${
allPassed ? "passed" : "failed"
}", "reason": "none"}}`
}", "reason": "${`${countPassed} / ${countTotal} passed.`}"}}`
);

await driver.quit();
Expand Down

0 comments on commit 4375af6

Please sign in to comment.