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 · 10 comments
Open

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

laytong opened this issue Apr 24, 2024 · 10 comments
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.

@laytong
Copy link
Author

laytong commented May 31, 2024 via email

@magarwal19
Copy link

magarwal19 commented Jun 24, 2024

Hi @vitalets
i am still facing this issue with latest version intermittently
platform: darwin
node: v16.20.0
playwright-bdd: v6.5.1
@playwright/test: v1.44.1
@cucumber/cucumber: v10.3.2
Playwright config file: playwright.config.js

Can it be due to tag i am using in feature file?
@mode:serial

@vitalets
Copy link
Owner

Hi @magarwal19!
@mode:serial should not be a reason. Could you share more details about your setup?
The most useful is to create a demo based on https://github.com/vitalets/playwright-bdd-example

@vitalets vitalets reopened this Jun 24, 2024
@vitalets
Copy link
Owner

Looks like the same as #166
Fixed in v6.6.0.
@magarwal19 could you re-check on your side?

@magarwal19
Copy link

Hi It seems to be working as expected currently . We can close this issues.. and if observed again in future will log a new with more details

@vitalets
Copy link
Owner

Ok! Thanks for the feedback!

@aluckin3
Copy link

aluckin3 commented Aug 30, 2024

@vitalets i see that issue again:
Error in reporter Error: __bddData annotation is not found for test "Client Portal - Test notification (email)". at TestCaseRun.extractBddData (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright-bdd\src\reporter\cucumber\messagesBuilder\TestCaseRun.ts:76:13) at new TestCaseRun (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright-bdd\src\reporter\cucumber\messagesBuilder\TestCaseRun.ts:52:25) at MessagesBuilder.onTestEnd (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright-bdd\src\reporter\cucumber\messagesBuilder\index.ts:68:25) at Object.onTestEnd (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright-bdd\src\reporter\cucumber\messagesBuilder\ref.ts:24:34) at CucumberReporterAdapter.onTestEnd (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright-bdd\src\reporter\cucumber\index.ts:61:29) at ReporterV2Wrapper.onTestEnd (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\reporters\reporterV2.js:87:150) at C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\reporters\multiplexer.js:47:65 at wrap (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\reporters\multiplexer.js:86:5) at Multiplexer.onTestEnd (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\reporters\multiplexer.js:47:45) at InternalReporter.onTestEnd (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\reporters\internalReporter.js:62:20) at JobDispatcher._reportTestEnd (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\runner\dispatcher.js:518:20) at JobDispatcher._failTestWithErrors (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\runner\dispatcher.js:370:10) at JobDispatcher._massSkipTestsFromRemaining (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\runner\dispatcher.js:377:14) at JobDispatcher._onDone (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\runner\dispatcher.js:443:10) at WorkerHost.emit (node:events:518:28) at ChildProcess.<anonymous> (C:\BuildAgent\work\a556589622e3634b\e2e-tests\node_modules\playwright\lib\runner\processHost.js:105:16) at ChildProcess.emit (node:events:518:28) at emit (node:internal/child_process:951:14) at processTicksAndRejections (node:internal/process/task_queues:83:21)

It is only present with file that has "@mode:serial" added.

If i have like 10 tests inside one .feature file that has @mode:serial, and 3rd or any test fails, after playwright try to restart that test every next test fails with this log.

@vitalets
Copy link
Owner

vitalets commented Aug 31, 2024

I will check it, reopening.

@vitalets
Copy link
Owner

vitalets commented Sep 7, 2024

Fixed in v7.3.0.
@aluckin3 could you 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

4 participants