Skip to content

[🐛 Bug]: AllureReporter.step - Failed custom steps do not fail test (Mocha, Allure) #9986

@Lemonpill

Description

@Lemonpill

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.5.9

Node.js Version

18.13.0

Mode

WDIO Testrunner

Which capabilities are you using?

{
  maxInstances: 5,
  browserName: "chrome",
  acceptInsecureCerts: true,
}

What happened?

Test cases do not fail when using AllureReporter.step method. The step seem to fail but the case itself doesn't.

image
image

This is the current state of my package.json:

{
  "name": "my-new-project",
  "type": "module",
  "devDependencies": {
    "@babel/core": "^7.21.0",
    "@babel/preset-env": "^7.20.2",
    "@babel/register": "^7.21.0",
    "@wdio/allure-reporter": "^8.5.0",
    "@wdio/cli": "^8.5.9",
    "@wdio/local-runner": "^8.5.9",
    "@wdio/mocha-framework": "^8.5.6",
    "@wdio/spec-reporter": "^8.4.0",
    "allure-commandline": "^2.21.0",
    "chromedriver": "^111.0.0",
    "wdio-chromedriver-service": "^8.1.1",
    "wdio-wait-for": "^3.0.2"
  },
  "scripts": {
    "wdio": "wdio run ./wdio.conf.js"
  }
}

What is your expected behavior?

Test case should fail whenever a step fails.

How to reproduce the bug.

import AllureReporter from "@wdio/allure-reporter";

describe("Testing custom steps", () => {
  it("Shows a passing test", async () => {
    await AllureReporter.step("this is a passing step", () => {});
  });
  it("Shows a failing test", async () => {
    await AllureReporter.step("this is a failing step", () => {
      throw new Error("testing");
    });
  });
});

Relevant log output

Execution of 1 workers started at 2023-03-15T21:48:39.095Z

2023-03-15T21:48:39.159Z INFO chromedriver: Initiate Chromedriver Launcher (v8.1.1)
2023-03-15T21:48:39.160Z INFO @wdio/cli:launcher: Run onPrepare hook
2023-03-15T21:48:39.165Z INFO chromedriver: Start Chromedriver (C:\Users\97258\Projects\stepobject-poc\node_modules\chromedriver\lib\chromedriver\chromedriver.exe) with args --port=9515 --url-base=/
2023-03-15T21:48:39.191Z INFO chromedriver: Starting ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995}) on port 9515
2023-03-15T21:48:39.191Z INFO chromedriver: Only local connections are allowed.
2023-03-15T21:48:39.192Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
2023-03-15T21:48:39.197Z INFO chromedriver: ChromeDriver was started successfully.
2023-03-15T21:48:39.298Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2023-03-15T21:48:39.301Z INFO @wdio/local-runner: Start worker 0-0 with arg: 
[0-0] 2023-03-15T21:48:39.962Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - file:///C:/Users/97258/Projects/stepobject-poc/test/specs/example.steps.spec.js
[0-0] 2023-03-15T21:48:40.227Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2023-03-15T21:48:40.324Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2023-03-15T21:48:40.324Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: { browserName: 'chrome', acceptInsecureCerts: true },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: { browserName: 'chrome', acceptInsecureCerts: true }
[0-0] }

DevTools listening on ws://127.0.0.1:53546/devtools/browser/0684f7f9-8667-4f0f-a144-7d6063ccca9b
[0-0] 2023-03-15T21:48:40.945Z INFO webdriver: COMMAND deleteSession()
[0-0] 2023-03-15T21:48:40.946Z INFO webdriver: [DELETE] http://localhost:9515/session/562c2ab11ae6d7d61ef70bada6e247f8
[0-0] 2023-03-15T21:48:41.000Z INFO webdriver: RESULT null
[0-0] PASSED in chrome - file:///C:/Users/97258/Projects/stepobject-poc/test/specs/example.steps.spec.js
2023-03-15T21:48:41.135Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2023-03-15T21:48:41.136Z INFO @wdio/cli:launcher: Run onComplete hook
Report successfully generated to allure-report
Allure report successfully generated

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

Labels

Bug 🐛help wantedIssues that are free to take by anyone interested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions