Skip to content

[🐛 Bug]: Cucumber doc strings are not displayed on reports generated by spec-reporter #10394

@toan-lab

Description

@toan-lab

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.10.2

Node.js Version

18.14.2

Mode

WDIO Testrunner

Which capabilities are you using?

{
  browserName: 'chrome',
  browserVersion: 'latest',
  platformName: 'Windows 10'
}

What happened?

Doc strings of a cucumber step do not display on the report generated by wdio spec-reporter.

What is your expected behavior?

Doc strings of a cucumber step display on the report generated by wdio spec-reporter.

The report content should be:

 "spec" Reporter:
------------------------------------------------------------------
[chrome 113.0.5672.93 Windows 10 #0-0] Running: chrome (v113.0.5672.93) on Windows 10
[chrome 113.0.5672.93 Windows 10 #0-0] Session ID: 0a438b3d6040c9f9144fec6c8d87c05c
[chrome 113.0.5672.93 Windows 10 #0-0]
[chrome 113.0.5672.93 Windows 10 #0-0] » \test\features\test.feature
[chrome 113.0.5672.93 Windows 10 #0-0] Test
[chrome 113.0.5672.93 Windows 10 #0-0] Docstring
[chrome 113.0.5672.93 Windows 10 #0-0]    ✓ Given I have the following docstring
[chrome 113.0.5672.93 Windows 10 #0-0]        First line
[chrome 113.0.5672.93 Windows 10 #0-0]        Second line
[chrome 113.0.5672.93 Windows 10 #0-0]        Third line
[chrome 113.0.5672.93 Windows 10 #0-0]    ✓ When I run test
[chrome 113.0.5672.93 Windows 10 #0-0]    ✓ Then I find it in the reporter
[chrome 113.0.5672.93 Windows 10 #0-0]
[chrome 113.0.5672.93 Windows 10 #0-0] 3 passing (996ms)


Spec Files:      1 passed, 1 total (100% completed) in 00:00:20

How to reproduce the bug.

Create a webdriverio project using cucumber framework, spec reporter for chrome testing and add the following feature and step definition files

test.feature

Feature: Test
    Scenario: Docstring
        Given I have the following docstring
            """
            First line
            Second line
            Third line
            """
        When I run test
        Then I find it in the reporter

test.steps.ts

import { Given, When, Then } from "@cucumber/cucumber";

Given(/^I have the following books in the store$/, async function (dataTable) {
  console.log(dataTable);
});

When(/^I search for books by author Erik Larson$/, async function () {
  console.log("abc");
});

Then(/^I find 2 books$/, async function () {
  console.log("abc");
});

Then execute the test with the command

wdio run ./config/wdio.conf.ts

The actual report from spec reporter will be

 "spec" Reporter:
------------------------------------------------------------------
[chrome 113.0.5672.93 Windows 10 #0-0] Running: chrome (v113.0.5672.93) on Windows 10
[chrome 113.0.5672.93 Windows 10 #0-0] Session ID: 0a438b3d6040c9f9144fec6c8d87c05c
[chrome 113.0.5672.93 Windows 10 #0-0]
[chrome 113.0.5672.93 Windows 10 #0-0] » \test\api\features\a.feature
[chrome 113.0.5672.93 Windows 10 #0-0] Test
[chrome 113.0.5672.93 Windows 10 #0-0] Docstring
[chrome 113.0.5672.93 Windows 10 #0-0]    ✓ Given I have the following docstring
[chrome 113.0.5672.93 Windows 10 #0-0]    ✓ When I run test
[chrome 113.0.5672.93 Windows 10 #0-0]    ✓ Then I find it in the reporter
[chrome 113.0.5672.93 Windows 10 #0-0]
[chrome 113.0.5672.93 Windows 10 #0-0] 3 passing (996ms)


Spec Files:      1 passed, 1 total (100% completed) in 00:00:20

Relevant log output

"spec" Reporter:
------------------------------------------------------------------
[chrome 113.0.5672.93 Windows 10 #0-0] Running: chrome (v113.0.5672.93) on Windows 10
[chrome 113.0.5672.93 Windows 10 #0-0] Session ID: 0a438b3d6040c9f9144fec6c8d87c05c
[chrome 113.0.5672.93 Windows 10 #0-0]
[chrome 113.0.5672.93 Windows 10 #0-0] » \test\api\features\a.feature
[chrome 113.0.5672.93 Windows 10 #0-0] Test
[chrome 113.0.5672.93 Windows 10 #0-0] Docstring
[chrome 113.0.5672.93 Windows 10 #0-0]     Given I have the following docstring
[chrome 113.0.5672.93 Windows 10 #0-0]     When I run test
[chrome 113.0.5672.93 Windows 10 #0-0]     Then I find it in the reporter
[chrome 113.0.5672.93 Windows 10 #0-0]
[chrome 113.0.5672.93 Windows 10 #0-0] 3 passing (996ms)


Spec Files:      1 passed, 1 total (100% completed) in 00:00:20

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

No one assigned

    Labels

    Bug 🐛good first picka reasonable task to start getting familiar with the code basehelp 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