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]: Alpha version: Wallet cache hashes are different between generation and test #1103

Open
3 of 4 tasks
andtos90 opened this issue Feb 18, 2024 · 7 comments
Open
3 of 4 tasks
Labels
bug 🐛 Something isn't working needs triaging ⏳

Comments

@andtos90
Copy link

🔎 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?

💡 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: NeokingdomDAO/dapp#161

What is your expected behavior?

No response

How to reproduce the bug.

It should fail before starting to test the real application. You can check the trace and see the error.

Relevant log output

No response

@andtos90 andtos90 added bug 🐛 Something isn't working needs triaging ⏳ labels Feb 18, 2024
@andtos90 andtos90 changed the title [🐛 Bug]: <title> [🐛 Bug]: Alpha version: Wallet cache hash are different between generation and test Feb 18, 2024
@andtos90 andtos90 changed the title [🐛 Bug]: Alpha version: Wallet cache hash are different between generation and test [🐛 Bug]: Alpha version: Wallet cache hashes are different between generation and test Feb 18, 2024
@drptbl
Copy link
Member

drptbl commented Feb 20, 2024

Thanks for report @andtos90, we're looking in to it. Will keep you updated.

ETA: hopefully until EOW.

andtos90 added a commit to NeokingdomDAO/dapp that referenced this issue Feb 22, 2024
# Description
Part of #157 

Add Playwrigh and add the first few tests. The main goals are:

- [x] Add Playwright and make it work locally
- [x] Add a few tests and confirm they are working correctly (with
localhost)
- [x] Support connection to Metamask
- [x] Add a test with API mocks, specifically for subgraph
- [x] Add a test with Odoo and Wallet connection
- [x] Make the API mocks typesafe
- [x] Add documentation

⚠️ There is an issue with how the wallet is handled after being cached
for the e2e test: Synthetixio/synpress#1103

### A few notes:

I started mocking with MSW but it was a painful experience. First,
Playwright doesn't work well with libraries that [override their service
worker
](https://playwright.dev/docs/network#missing-network-events-and-service-workers).
Then, the most promising plugin to support graphql-codegen with MSW and
Playwright does not support multiple endpoints, which is an issue for
testing the legacy flow (like the resolutions).

In the end, I'm fairly happy with the final solution. It's not a lot of
code and it doesn't use new libraries but reuses what we have without
sacrificing functionalities.

---------

Co-authored-by: Andrea Tosatto <andrea.tosatto@infinitaslearning.com>
@andtos90
Copy link
Author

Thanks @drptbl for the quick answer. I've tried alpha.3 and patching locally the package based on #1105 but didn't work for me. Let me know if you need more help with testing, you can find me in your Discord (handle andtos)

@vishwajeetraj11
Copy link

Facing this.
any work around other than manually renaming the cache?

@danielsimao
Copy link

danielsimao commented Jun 7, 2024

Facing the same issue when running the example code.

@drptbl
Copy link
Member

drptbl commented Jun 7, 2024

@andtos90 @vishwajeetraj11 @danielsimao could we connect on discord for further debugging, please? This issue is important for us.

My discord handle is: jakubsynthetix

@danielsimao
Copy link

jakubsynthetix

Added you

@vishwajeetraj11
Copy link

jakubsynthetix
sent request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working needs triaging ⏳
Projects
None yet
Development

No branches or pull requests

4 participants