seamless-protocol / seamless-interface

https://seamless-interface.vercel.app
Other
7 stars 6 forks source link

cypress: add test for all (4) strategies #607

Closed WingsDevelopment closed 2 months ago

WingsDevelopment commented 2 months ago

11.09.2024 Srdjan

Resolved an issue with the prepareForTests file where a random import prevented the file from loading properly in tests. After some debugging, the problem was fixed. Added data-cy attributes to elements for upcoming test cases. Encountered an issue while simulating transaction fees, which needs to be resolved first.

Turns out that RPC wasn't configured correctly, resolved this.

Managed to implement withdraw + deposit flow for wstETH booster 3x strategy

Encountered an issue with tenderly virtual testnet, there is a limit of 50 blocks (50 transactions) that can be made in free version.. Which is a big issue for tests, initially we thought we can only snapshot, test, revert. but this limit is going to make us dynamically create forks like we initially tried to do. Thinking about solution, but I think we will need some RPC Factory file for this. where we can only set 1 variable env=testing and nothing else.. and also we need to ensure that we never actually use tenderly in prod!

12.09.2024 Resolved issue with tenderly testnet limit by always creating and deleting fork after each test. todo: It would be probably better to do it once before and after all tests, will try to improve this.

Refactored user balances, now sets for each test, instead all balances every single time.

Wrote tests for all 4 strategies. All tests are passing (most of the time) it looks like sometimes it fails because of hardcoded timeouts, so that will also need some refactoring. Improvement: where we can only set 1 variable env=testing and nothing else can actually be done even better, so what i've managed to do is to automatically recognize cypress environemnt and override some of RPC's to correct RPC's

13.09.2024 Added new script to package.json. Refactored commands, splitted code into logical chunks. Did final testing.

[x] Removed all (hardcoded) cy.wait's [x] Improved test time from ~4:45 to ~2:45 [x] Implement commands to logically wait for next steps [x] Refactored command's code, splited it into multiple logical files [x] Created more commands [x] Implement withdraw command [x] Implement deposit/withdraw for all strategies [x] Refactored balanceConfigs (setting balance on each test), for tenderly balance is set only for token that is needed for that test. [x] Add new script to package json for prod build (to include test into pipeline) [x] Refactored how we used RPC's, especially tenderly RPC's, We should be able to set tenderly RPC in only one place, instead of in multiple places. [x] Tests used to fail sometimes (probably because of cy.wait), this is resolved by removing those. [x] Implemented createTenderly and deleteTenderly fork before and after each test

17.09.2024 Fixed comments from yesterday. Asked Danilo to review