Closed kziemianek closed 3 months ago
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
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
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.
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)
In the end, we can make it optional - add another prompt in the init.
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.
For e2e support:
generate
to test
command (if ink! is used) and a way to run themWhat is the command to run e2e tests?
swanky contract test
it's implemented in: https://github.com/AstarNetwork/swanky-cli/blob/master/packages/cli/src/commands/contract/test.ts
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.