synpress: [π Bug]: Alpha version: Wallet cache hashes are different between generation and test
π Have you searched existing issues to avoid duplicates?
- I have made sure that my issue is not a duplicate.
π§ͺ Have you tested your code using latest version of Synpress?
- I have made sure that my issue still exists on latest version of Synpress.
π‘ Are you able to provide enough information to be able to reproduce your issue locally?
- I can provide enough details to reproduce my issue on local environment.
Synpress version
4.0.0-alpha.0
Node.js version
18
Operating system
macOS Sonoma 14.1.1
Run mode
Playwright + Synpress (as plugin)
CI platform (if applicable)
No response
Are you running your tests inside docker? (if applicable)
- This issue could be related to docker.
What happened?
Not sure if you need any feedback on the alpha release, but Iβll add this here and you can close it if itβs something already on your radar. (Nice work, I really like the new API)
My playwright tests with Synpres donβt work because I get this error inside the error trace:
{
"type": "after",
"callId": "fixture@6",
"endTime": 405.01,
"attachments": [],
"error": {
"name": "",
"message": "Error: Cache for 45ff4daed99a0b6ab9cf does not exist. Create it first!",
"stack": "Error: Cache for 45ff4daed99a0b6ab9cf does not exist. Create it first!\n at Object.context (/Users/atosatto/neok/dapp/node_modules/.pnpm/@synthetixio+synpress-fixtures@0.0.1-alpha.0_@playwright+test@1.41.2_playwright-core@1.41.2_typescript@4.5.4/node_modules/@synthetixio/synpress-fixtures/src/fixtures/testWithSynpress.ts:54:12)"
}
}
The easy workaround is manually renaming the cached wallet folder from the hash generated by synpress to the one from the error.
The internal function getWalletSetupFuncHash returns different values between synpress and playwright test, I can confirm that by putting a console.log after this line https://github.com/Synthetixio/synpress/blob/new-dawn/packages/core/src/defineWalletSetup.ts#L18
This is the PR Iβm working on: https://github.com/NeokingdomDAO/dapp/pull/161
What is your expected behavior?
No response
How to reproduce the bug.
- clone https://github.com/NeokingdomDAO/dapp/pull/161
- run
pnpm i - rename
.env.testto.env - run
pnpm e2e:init - run
pnpm e2e:uiand select the testlogin just with the wallet (account in DAO)
It should fail before starting to test the real application. You can check the trace and see the error.
Relevant log output
No response
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 15
This issue happens when βtypeβ: βmoduleβ is not set in package.json. So during the cache generation step it uses ESM mode, but when running tests it uses commonjs by default, as a result different versions of dependencies produces different hashes!
Solution
Set
"type": "module"in yourpackage.jsonThe error occurs if we need to sign a message during cache creation and possibly in some other cases. Here is a reproduction repository: https://github.com/Maksandre/synpress-cache-error.
Is there an estimated timeline for fixing this issue?
Thank you for reproduction steps π.
Hopefully we will have a fix ready within a week. π
jakubsynthetix sent request.
Added you