-
Notifications
You must be signed in to change notification settings - Fork 446
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
[E2E] Add create_call_builder
for testing on-chain contracts
#2075
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can make a simple free function which constructs from an account id, extracting this code here
<<Contract as ContractCallBuilder>::Type as FromAccountId<E>>::from_account_id(
self.account_id.clone(),
)
To replace
type CallBuilderType = <Flipper as ink_e2e::ContractCallBuilder>::Type;
let call_builder = CallBuilderType {
account_id: acc_id
};
with e.g.
let call_builder = create_call_builder::<Flipper>(acc_id);
🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑These are the results when building the
Link to the run | Last update: Mon Jan 29 15:13:30 CET 2024 |
ContractCallBuilder
from ink_e2e
create_call_builder
for testing on-chain contracts
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2075 +/- ##
==========================================
+ Coverage 53.70% 53.72% +0.01%
==========================================
Files 223 223
Lines 7040 7040
Branches 3141 3120 -21
==========================================
+ Hits 3781 3782 +1
+ Misses 3259 3258 -1 ☔ View full report in Codecov by Sentry. |
--features e2e-tests \ | ||
--manifest-path integration-tests/flipper/Cargo.toml \ | ||
e2e_test_deployed_contract \ | ||
-- --ignored --nocapture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just thinking if this logic could be moved to an e2e/integration test for Ink instead of the CI workflow. This change would enable us to run it locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean as an ink! e2e test that directly uses the cargo-contract
crates to build and instantiate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So my idea with the e2e test in flipper
was to illustrate how to test a contract on-chain, this doesn't necessarily require having to build the contract beforehand.
Since the integration-tests/
end up on ink-examples
, I'd like to avoid putting non-user relevant things there.
Why?
Allows for easy writing of an E2E test that runs against an already deployed contract. Our typical examples always have the whole instantiation workflow with creating a contract instance, constructor & co.
So you can e.g. take a snapshot of Aleph Zero, upgrade your contract there to a new ink! version, and then run your E2E test suite against this updated contract to assert that everything will still work.