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

Sample basic test example contracts #137

Closed
technophile-04 opened this issue Jul 22, 2024 · 8 comments · Fixed by #140
Closed

Sample basic test example contracts #137

technophile-04 opened this issue Jul 22, 2024 · 8 comments · Fixed by #140

Comments

@technophile-04
Copy link
Member

technophile-04 commented Jul 22, 2024

Description

I think it will nice to have a document / or maybe comment on this issue with list of contract address from different chains which we can use for testing PR's.

I usually do this:

  • One sepolia YourContract.sol instance(so that we can check read + write are working fine)
  • find -2-3 unverified contracts addresses on diff chain(so that we can test heimdall)
  • Find some proxy contracts on diff chain(to test if we are resolving implementation address and abi correctly)
@portdeveloper
Copy link
Member

proxy something on base: 0xca808b3eada02d53073e129b25f74b31d8647ae0

unverif on sepolia eth: 0x759c0e9d7858566df8ab751026bedce462ff42df

bnb chain verified: 0x79eE0771dCa47a68a19053DfDd5eEb84FDcfB650

parex chain details:
chainId: 322202
rpc: https://mainnet-rpc.parex.network
verified contract: 0x6058518142C6AD506530F5A62dCc58050bf6fC28
block explorer: https://scan.parex.network/

link to test for parex:

http://localhost:3000/0x6058518142C6AD506530F5A62dCc58050bf6fC28/322202

These are how I currently test if something is working or not.

@carletex
Copy link
Collaborator

having some functional automated testing for this would be amazing too :P

@portdeveloper
Copy link
Member

@carletex

Gh.Upload.mp4

I was playing around with cypress and it works fine! But we may try playwright as well.

@technophile-04
Copy link
Member Author

This is really cool @portdeveloper!!!! and will make our testing sooo easy!! Could create an PR? I am not well versed with testing at all, so excited to learn!

I was playing around with cypress and it works fine! But we may try playwright as well.

Reading couple of articles, I think cypress could be just perfect for us it works in CI we also have very basic poc working.

Both playwright and cypress has their pros and cons, but playwright pros seems a bit overpowered and not that needed for us. So lets go with cypress for now 🙌

Also just want to throw out here that we were also planning to add some test to SE-2 just in CI, so this learnings will also help us their!

@carletex
Copy link
Collaborator

you are on 🔥 @portdeveloper nothing can't stop you now :P Great stuff.

Cypress is really cool (I've never used playwright tho).


So the idea would be to our CI (when PRing to main) to run cypress with the test, right? I guess we should spin up a local CI abi ninja instance an running it there (we'd need some secrets for the envvars). Not sure if it'd be possible to run it on the Vercel preview (which might have less config overhead for us)

@portdeveloper
Copy link
Member

@carletex
The changes that implement a CI workflow that trigger on push and pr are ready at https://github.com/portdeveloper/abi.ninja.

However, the tests are not perfect. I had to use cy.wait() at multiple places to ensure we wait for things to appear and sometimes, for heimdall-rs backend to boot up.

Here is an example PR that has a cypress e2e CI workflow:
portdeveloper#3

Maybe what we could do here is to open some PRs over the weekend to ensure everything is working smoothly and on Tuesday or Wednesday, we merge this to main.

@technophile-04
Copy link
Member Author

TYSM Port !!

However, the tests are not perfect. I had to use cy.wait() at multiple places to ensure we wait for things to appear and sometimes, for heimdall-rs backend to boot up.

I think its fine? we could always iterate over it to find better solution also it won't affect the prod so maybe lets try it out

@portdeveloper
Copy link
Member

Yes! Test in prod is the best. Maybe we could do a call to heimdall to boot it up before the tests to eliminate one of those waits.

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 a pull request may close this issue.

3 participants