adds a Devchain class (in test-sol/e2e/utils.sol). This class can be inherited by e2e test files to have access to the deployed contracts on the devchain.
adds a demo e2e test FeeCurrencyDirectory.t.sol (in test-sol/e2e/common/FeeCurrencyDirectory.t.sol) that leverages the Devchain class, and runs e2e tests against the FeeCurrencyDirectory contract on the anvil devchain
adds a script to run e2e tests (run_e2e_tests_in_anvil.sh) that can be used in CI workflows.
Other changes
replaces ../.. with @celo-... remapping in FeeCurrencyDirectory.t.sol
Note
I decided to keep this PR small, but in a subsequent PR, I'd like to refactor the test-sol/ directory structure like:
Create and run anvil devchain (in a separate terminal)
cd packages/protocol
./migrations_sol/create_and_migrate_anvil_devchain.sh
Run e2e test against anvil devchain
forge test \
-vvv \
--match-path "*test-sol/e2e/*" \
--fork-url http://127.0.0.1:8546
Ran 1 test for test-sol/e2e/common/FeeCurrencyDirectory.t.sol:E2EDemo
[PASS] test_ShouldAllowOwnerSetCurrencyConfig() (gas: 94493)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 9.52ms (1.59ms CPU time)
Ran 1 test suite in 176.73ms (9.52ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)
Not tested on CI. I'll include e2e tests on CI after I refactor the test-sol/ directory structure as described here:
Description
Devchain
class (intest-sol/e2e/utils.sol
). This class can be inherited by e2e test files to have access to the deployed contracts on the devchain.FeeCurrencyDirectory.t.sol
(intest-sol/e2e/common/FeeCurrencyDirectory.t.sol
) that leverages theDevchain
class, and runs e2e tests against theFeeCurrencyDirectory
contract on the anvil devchainrun_e2e_tests_in_anvil.sh
) that can be used in CI workflows.Other changes
../..
with@celo-...
remapping inFeeCurrencyDirectory.t.sol
Note
I decided to keep this PR small, but in a subsequent PR, I'd like to refactor the
test-sol/
directory structure like:That way we could run tests on CI with a command structure like:
Here is an issue to track this:
Tested
Yes, tested locally ✅
Steps to reproduce e2e test locally:
Create and run anvil devchain (in a separate terminal)
Run e2e test against anvil devchain
Not tested on CI. I'll include e2e tests on CI after I refactor the
test-sol/
directory structure as described here:Related issues
Backwards compatibility
Yes, only adds tests.
Documentation
No, we'll need better documentation for Foundry tests in general once the directory structure is cleaner.