Conversation
|
|
||
| export const isE2eTestEnabled = process.env.NEXT_PUBLIC_E2E_TEST_ENABLED === "true"; | ||
| if (isE2eTestEnabled) console.warn("E2E tests are enabled. This should only be used in a testing environment."); | ||
| export const baseSepoliaE2eForkUrl = "http://127.0.0.1:8545"; |
There was a problem hiding this comment.
This could be extracted to env vars and extended to e2e test with multiple chains.
There was a problem hiding this comment.
As a general rule, we prefer to use environment variables for scenarios like this. It makes things much smoother for both local development and when deploying to different environments on Vercel
| const nextConfig: NextConfig = { | ||
| // FIXME: Delete this setup where TS errors in main are fixed | ||
| eslint: { | ||
| ignoreDuringBuilds: true, |
| environment: "jsdom", | ||
| globals: true, | ||
| setupFiles: ["./src/test/setup.ts"], | ||
| exclude: ["**/node_modules/**", "**/dist/**", "**/e2e/**"], |
There was a problem hiding this comment.
Avoids running e2e tests from vitest. Using another filename convention to distinguish unit vs e2e would also be a good improvement.
* Add env var to test scripts * Improve e2e readme * Add NEXT_PUBLIC_E2E_TEST_ENABLED env var to GHA yaml * Add default RPC url for GHA yaml * Change default e2e timeout * Mock allStkTokens with disabled query * Comment steps in tests
* add anvil warmup * rename GHA job * change GHA push on pull_request * add disable-block-gas-limit * undo useAllStkTokens changes * change Claim All button label * change Cooldown label * wait for claimable rewards
|
Hi @agualis! Thanks a lot for contributing and opening this PR! We appreciate you taking the time to add e2e tests with Playwright to the project. |
|
Regarding the Testing Environment Before you put too much more work into this PR, I wanted to share some thoughts on the testing environment. We've actually been planning to implement our e2e tests using a Tenderly Fork rather than Anvil. There are a few reasons for this, one of which you've already touched upon: running complex functions on Anvil can be quite time-consuming and can make test execution slow/unpredictable. With a Tenderly Fork, we don't face this issue. Our plan involves creating a separate fork via the Tenderly API for each test run, which allows us to manage wallet balances, rewind time for reward accrual, and handle cooldown execution effectively. |
|
Closing in favor of #29 as discussed above. |

Adds initial playwright setup and demo covering several happy paths
Test execution in UI mode:
playwright-demo.mp4
BlockersAdded anvil warm up script to loadgetAllAggregatedDatafunction is quite complex and it takes a long time to run in the context of an anvil fork. For now, I'm mocking the response ofuseAllStkTokenswhen running it in CI but that's far from ideal so I will think about a better way.getAllAggregatedDatacall before running e2e tests so that they are using anvil's cache.Open questions
eslintandtypecheckwere failing in main when I forked so I had to temporary disable it innext.config.ts. Wouldn't it be interesting to add a job to disable merging to main when those are broken?build --turbopackfor building the app in e2e in CI mode. This mode is not yet ready for production but provides a faster feedback loop. So there's a tradeoff between detecting production build errors using webpack build VS speed.ssroption in wagmi is set to true in e2e tests to avoid hydration issues. Why do you have it disabled?await page.getByRole("combobox").click();). Improving accesibility would be good for both real users and e2e tests.react-scanis activated by default. That affects the DX of the playwright UI mode so I disabled it in that context. Now I seeTanstack devtoolsbutton instead so it looks like there is a collision there.chromium. It would be straighforward to run them for other browsers or viewport setups.walletsRainbowKit (RK) option, I had to manually definegroupName: Popularwith RK defaults. I guess you would prefer to define your own ones, which is easier now.Nice to haves
const defaultAnvilAccount: Address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";) will always have enough ETH to stake many times in subsequent tests but adding aresetForkfunction to reset state between test executions would be a good practice.