Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Reporter doesn't work for non BDD setup projects #143

Open
laytong opened this issue Apr 24, 2024 · 1 comment
Open

Bug: Reporter doesn't work for non BDD setup projects #143

laytong opened this issue Apr 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@laytong
Copy link

laytong commented Apr 24, 2024

Given

import 'dotenv/config';
import { defineConfig, devices } from '@playwright/test';
import { defineBddConfig, cucumberReporter } from 'playwright-bdd';

const testDir = defineBddConfig({
  paths: ['tests/features/*'],
  import: ['tests/steps/**/*.ts', '!tests/fixtures/*'],
  importTestFrom: 'tests/steps/fixtures.ts',
});

export default defineConfig({
  testDir,
  reporter: [
    ['line'],
    cucumberReporter('junit', {
      outputFile: 'coverage/junit.xml',
    }),
    cucumberReporter('html', {
      outputFile: 'coverage/web.html',
    }),
  ],
  retries: 2,
  projects: [
    {
      name: 'setup',
      testMatch: /setup\.ts/,
      testDir: 'auth',
    },
    {
      name: 'chromium',
      use: {
        ...devices['Desktop Chrome'],
      },
      dependencies: ['setup'],
    },
});

When
When I run the "setup" job and there's an error

Then
The reporter falls over for non BDD driven projects and you can't opt out of cucumber report for that project

Error in reporter Error: __bddData annotation is not found for test "reservation user".
    at TestCaseRun.extractBddData (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright-bdd/src/reporter/cucumber/messagesBuilder/TestCaseRun.ts:77:13)
    at new TestCaseRun (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright-bdd/src/reporter/cucumber/messagesBuilder/TestCaseRun.ts:53:25)
    at MessagesBuilder.onTestEnd (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright-bdd/src/reporter/cucumber/messagesBuilder/Builder.ts:58:25)
    at Object.onTestEnd (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright-bdd/src/reporter/cucumber/messagesBuilder/index.ts:21:34)
    at CucumberReporterAdapter.onTestEnd (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright-bdd/src/reporter/cucumber/index.ts:56:29)
    at ReporterV2Wrapper.onTestEnd (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright/lib/reporters/reporterV2.js:87:150)
    at /Users/lgilbraith/code/OrderIntegrity/node_modules/playwright/lib/reporters/multiplexer.js:47:65
    at wrap (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright/lib/reporters/multiplexer.js:86:5)
    at Multiplexer.onTestEnd (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright/lib/reporters/multiplexer.js:47:45)
    at InternalReporter.onTestEnd (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright/lib/reporters/internalReporter.js:62:20)
    at JobDispatcher._reportTestEnd (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright/lib/runner/dispatcher.js:519:20)
    at JobDispatcher._onTestEnd (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright/lib/runner/dispatcher.js:285:10)
    at WorkerHost.emit (node:events:514:28)
    at ChildProcess.<anonymous> (/Users/lgilbraith/code/OrderIntegrity/node_modules/playwright/lib/runner/processHost.js:105:16)
    at ChildProcess.emit (node:events:514:28)
    at emit (node:internal/child_process:951:14)

But I expect
To be able to run without error

Isolated demo
I'll try to create a repro soon

Environment

Playwright-bdd environment info:

platform: darwin
node: v20.10.0
playwright-bdd: v6.2.0
@playwright/test: v1.43.1
@cucumber/cucumber: v10.5.1
Playwright config file: playwright.config.ts

@laytong laytong added the bug Something isn't working label Apr 24, 2024
@vitalets
Copy link
Owner

vitalets commented May 3, 2024

Released in v6.3.1.
Please re-check on your side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants