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

POC for screenshot when the test errors #853

Open
ankur22 opened this issue Apr 13, 2023 · 0 comments
Open

POC for screenshot when the test errors #853

ankur22 opened this issue Apr 13, 2023 · 0 comments
Labels
dx developer experience enhancement New feature or request idea 💡 team/k6browser To distinguish the issue on project boards. user request Requested by the community ux
Milestone

Comments

@ankur22
Copy link
Collaborator

ankur22 commented Apr 13, 2023

When a test runs, but then fails when we didn't expect it to, the current option for the user is to:

  1. Look at the logs;
  2. Replicate the issue;
  3. Fix the issue.

Another tool that could be useful is the ability to view the page that was rendered when the error occurred. For example, let's say we have the following test:

import { chromium } from 'k6/x/browser'

export default async function () {
  const browser = chromium.launch({ headless: false })
  const context = browser.newContext()
  const page = context.newPage()

  try {
    await page.goto('https://test.k6.io/', { waitUntil: 'networkidle' })
    await Promise.all([
      page.waitForNavigation(),
      page.locator('a[href="/browser.php"]').click(),
    ]);
  } finally {
    page.close()
    browser.close()
  }
}

This test works today. What if the link address changes from browser to browserChrome? Then the test will fail, with a timeout while waiting for the selector a[href="/browser.php"]. What would be good is when the timeout occurs, a screenshot is taken of the current rendered page, which could make it a little easier to identify the problem. This feature could be disabled initially, but enabled with a command line flag and/or env var.

@ankur22 ankur22 added enhancement New feature or request idea 💡 ux dx developer experience team/k6browser To distinguish the issue on project boards. user request Requested by the community labels Apr 13, 2023
@ankur22 ankur22 added this to the v0.10.0 milestone Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx developer experience enhancement New feature or request idea 💡 team/k6browser To distinguish the issue on project boards. user request Requested by the community ux
Projects
None yet
Development

No branches or pull requests

1 participant