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

Rust e2e tests for ink contracts #127

Closed
kziemianek opened this issue Mar 14, 2023 · 9 comments · Fixed by #196 or #205
Closed

Rust e2e tests for ink contracts #127

kziemianek opened this issue Mar 14, 2023 · 9 comments · Fixed by #196 or #205
Assignees
Labels
enhancement New feature or request

Comments

@kziemianek
Copy link
Contributor

Overview

With the release of ink 4.0 developers have possibility to write e2e tests in Rust link. The process looks similar to what is right now in swanky: developer need to run substrate node locally and run e2e tests against it. The idea is to init ink smart contracts with e2e tests written in Rust and change contract test command to run these tests while keeping actual nodejs e2e tests for ask smart contracts. In both scenarios tests could be run against local swanky node.

If the idea sounds reasonable I would be more than happy to make required changes.

@shunsukew
Copy link
Contributor

shunsukew commented Mar 28, 2023

Sorry for being late to reply. I think it is good idea to support both swanky e2e tests written in TS and ink! native e2e test written in Rust as an alternative option.
Having optional flag to execute Rust e2e tests or invoking both TS and Rust at the same time is possible, and the former one is legitimate in my opinion. One thing we need to consider is this only applies to ink! contracts not for Ask! contracts, command should emit some errors in case of ask!.
What do you think @codespool

@codespool
Copy link
Collaborator

codespool commented Mar 28, 2023

I agree it could be a great option to have.
A big plus would also be not having to use polkadot.js, minimising dependencies and getting rid of those warnings..
In fact, I suggest in the init phase, if ink! is selected, only bootstrap ink! e2e, and mocha for ask!.
Probably needs a bit more investigation though.
I'll create an issue in the "ideas" section, we can discuss in the sprint planning. added this one to the project instead

@codespool codespool added the enhancement New feature or request label Mar 28, 2023
@shunsukew
Copy link
Contributor

But being able to write tests in TS is great option for especially frontend engineers.
So, we'd like to have it as it is.

@codespool
Copy link
Collaborator

I'd argue that if a developer is writing a smart contract using ink! already, they'd be more comfortable writing tests in it too, instead of context/language switching. (and tooling/environment too)

@codespool
Copy link
Collaborator

In the end, we can make it optional - add another prompt in the init.

@kziemianek
Copy link
Contributor Author

I also doubt people will choose mocha tests over ink_e2e, but making it optional as long as swanky still supports mocha tests for ask! contracts and probably existing ink! contracts sounds like a low cost overall.

@codespool
Copy link
Collaborator

codespool commented May 3, 2023

For e2e support:

  • add generate to test command (if ink! is used) and a way to run them

@niklabh
Copy link

niklabh commented May 8, 2023

What is the command to run e2e tests?

@niklabh niklabh self-assigned this May 9, 2023
@codespool
Copy link
Collaborator

@codespool codespool added this to the Grant proposal roadmap milestone Jul 5, 2023
@prxgr4mm3r prxgr4mm3r linked a pull request Jan 31, 2024 that will close this issue
ipapandinas added a commit that referenced this issue Feb 26, 2024
Co-authored-by: Igor Papandinas <igor.papandinas@posteo.net>
ipapandinas added a commit that referenced this issue Mar 25, 2024
Co-authored-by: Igor Papandinas <igor.papandinas@posteo.net>
ipapandinas added a commit that referenced this issue Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment