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

feat(routeFromHAR): add shouldSave option to control when to save HAR files #33628

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mskelton
Copy link
Contributor

@mskelton mskelton commented Nov 15, 2024

This adds a function to allow conditionally saving HAR files. This can be combined with testInfo to save HAR files only if a test passes, etc.

Example usage

it('welcome', async ({ page }, testInfo) => {
  const harPath = testInfo.outputPath('har.har');
  await page.routeFromHAR(harPath, {
    update: true,
    shouldSave: () => testInfo.status === 'passed'
  });

  await page.goto('/welcome');
  await expect(page.getByRole('heading')).toHaveText('Welcome');
});

Fixes #33559, inspired by #28796

This comment has been minimized.

Copy link
Contributor

Test results for "tests 1"

36907 passed, 650 skipped
✔️✔️✔️

Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Conditionally save HAR recordings
1 participant