Skip to content

Conversation

@grandima
Copy link

@grandima grandima commented Oct 29, 2025

Summary

Closes #2588

  • [n] y/n | Does it introduce breaking changes?
  • [n] y/n | Is it dependent on a specific version of cargo-contract or pallet-revive?

Description

Implements bash script switch-e2e-backend.sh that allows developers to easily switch between sandboxed and non-sandboxed E2E test backends for contracts.

Features

  • Accepts --manifest-path argument pointing to contract's Cargo.toml
  • Automatically detects current mode and switches to opposite
  • Converts test attributes between #[ink_e2e::test] and #[ink_sandbox::test(backend(runtime_only(...)))]
  • Manages sandbox feature flag in Cargo.toml dependencies
  • Handles tests with additional parameters (environment, replace_test_attr)

Usage

# Switch to sandboxed mode
./switch-e2e-backend.sh --manifest-path ./integration-tests/my_contract/Cargo.toml

# Switch back to non-sandboxed mode  
./switch-e2e-backend.sh --manifest-path ./integration-tests/my_contract/Cargo.toml

Checklist before requesting a review

  • I have added an entry to CHANGELOG.md
  • I have commented on my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@grandima grandima force-pushed the feature/switch-e2e-backend-script branch 2 times, most recently from 1770d1f to 6a18fd7 Compare October 29, 2025 14:55
@grandima
Copy link
Author

Hey @cmichi. Please check, it's ready for review.

@grandima grandima force-pushed the feature/switch-e2e-backend-script branch from 6a18fd7 to f61efc0 Compare October 29, 2025 15:00
…oxed modes (use-ink#2588)

Implements bash script `scripts/switch-e2e-backend.sh` that allows developers to easily
switch between sandboxed and non-sandboxed E2E test backends for contracts.

Features:
- Accepts `--manifest-path` argument pointing to contract's Cargo.toml
- Automatically detects current mode and switches to opposite
- Converts test attributes between `#[ink_e2e::test]` and `#[ink_sandbox::test(backend(runtime_only(...)))]`
- Manages sandbox feature flag in Cargo.toml dependencies
- Handles tests with additional parameters (environment, replace_test_attr)
- Provides simple output and error handling consistent with other ink scripts
@grandima grandima force-pushed the feature/switch-e2e-backend-script branch from f61efc0 to c25d4f9 Compare October 29, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write bash script to switch a contract's E2E tests from sandboxed to non-sandboxed (and vice-versa)

1 participant