synpress icon indicating copy to clipboard operation
synpress copied to clipboard

[๐Ÿ› Bug]: Metamask fixture can't be used on beforeAll because of using 'page' and 'context'

Open Mouse-Coach opened this issue 8 months ago โ€ข 0 comments

๐Ÿ”Ž Have you searched existing issues to avoid duplicates?

  • [x] I have made sure that my issue is not a duplicate.

๐Ÿงช Have you tested your code using latest version of Synpress?

๐Ÿ’ก Are you able to provide enough information to be able to reproduce your issue locally?

  • [x] I can provide enough details to reproduce my issue on local environment.

Synpress version

4.0.3

Node.js version

18.20.0

Operating system

macOS Monterey 12.4

Run mode

Playwright + Synpress (as plugin)

CI platform (if applicable)

GitHub Actions (It reproduces locally as well)

Are you running your tests inside docker? (if applicable)

  • [ ] This issue could be related to docker.

What happened?

The 'metamask' fixture can't be used on 'beforeAll' hook because it uses 'page' and 'context'. If the fixture is implemented myself, it will fail too because of 'extensionId' and 'context' fixtures - they also use context. It happens because the Playwright prohibits using them on the beforeAll level because it is created automatically on the beforeEach level - to create an isolated context for each test.

What is your expected behavior?

To give an opportunity to create a browser context ourselves to manage it there. I see that as an opportunity to do an implementation of your default 'context' fixture in the separate function/s (to remove it from fixtures that can block the hooks usages), it allows to await chromium.launchPersistentContext wherever you want.

How to reproduce the bug.

Use the 'metamask' fixture on the 'beforeAll' hook.

Relevant log output


Mouse-Coach avatar Feb 06 '25 14:02 Mouse-Coach