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: When using allure report with cucumber, screenshot are not shown in the allure report. #246

Closed
samixchoumi opened this issue Nov 25, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@samixchoumi
Copy link

samixchoumi commented Nov 25, 2024

Given
Setup config :

export default defineConfig({
  testDir,
  snapshotPathTemplate: './fixtures/__screenshots__/{testFilePath}/{arg}{ext}',
  /* Run tests in files in parallel */
  fullyParallel: true,
  /* Fail the build on CI if you accidentally left test.only in the source code. */
  forbidOnly: !!process.env.CI,
  /* Retry on CI only */
  retries: process.env.CI ? 2 : 0,
  /* Opt out of parallel tests on CI. */
  workers: process.env.CI ? 2 : 5,
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: [
    ['./node_modules/playwright-slack-report/dist/src/SlackReporter.js', { sendResults: 'off' }],
    ['blob'], ['list'], ['allure-playwright', { outputFolder: `allure-results` }]
  ],
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  use: {
    baseURL: (process.env.BASE_URL || config.baseUrl),
    trace: 'off',
    navigationTimeout: 60000,
    actionTimeout: 42000,
    screenshot: 'only-on-failure'
  },
  expect: { timeout: 42000 },
  timeout: 480000,
  /* Configure projects for major browsers */
  projects: [
    {
      name: 'setup',
      testMatch: /^.+\.setup\.ts/,
      testDir: './setup'
    },
    {
      name: `chrome_${ environment }`,
      use: {
        ...devices['Desktop Chrome'],
        launchOptions: { args: ['--disable-gpu'] },
        contextOptions: { screen: { width: 1920, height: 1024 } },
        deviceScaleFactor: 1,
        viewport: { width: 1920, height: 1024 },
        storageState: '.auth/storageState.json'
      },
      dependencies: ['setup']
    }
  ]
});

When

"npx bddgen --tags 'not @teststeardown' && npx playwright test --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL",

Then

No error, just no screenshot appear when test are failing while I have screenshot: 'only-on-failure' option set.

But I expect

Screenshot appearing in my allure report.

Environment

Playwright-bdd environment info:

platform: darwin
node: v21.1.0
playwright-bdd: v7.5.0
@playwright/test: v1.49.0
@cucumber/cucumber: none
Playwright config file: playwright.config.ts
@samixchoumi samixchoumi added the bug Something isn't working label Nov 25, 2024
@vitalets
Copy link
Owner

I've tried on playwright-bdd-example + allure. It shows screenshot and video inside After Hooks block, that is collapsed by default:
image

Could you check on your side?

@samixchoumi
Copy link
Author

I don't have it, that's weird then, I will take a look more deeply, I don't have the issue when I don't use the plugin

@vitalets
Copy link
Owner

Could you also try to run without sharding

@samixchoumi
Copy link
Author

Okey, I will see that too

@samixchoumi
Copy link
Author

Hello, I will close this ticket, I've found the screenshot as you said in your first comment in the After Hooks, it seem that when I was merging shard, it was removing .png file, I fixed it (not sure why it happened like that by default on our old code)
Thanks for your answer !

Just an idea, shouldn't it be better to show the screenshot in the failing assertion/action ?

@vitalets
Copy link
Owner

You are welcome!

shouldn't it be better to show the screenshot in the failing assertion/action ?

I agree. Will investigate in #249

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