Format
Write scenarios inside a fenced code block with gherkin language tag.
Keywords: Feature, Background, Scenario, Given, When, Then, And
Feature-- name of the feature being testedBackground-- shared preconditions across all scenarios (optional, use when multiple scenarios share setup)Scenario-- one distinct user flow to verifyGiven-- initial state / preconditionsWhen-- user actionThen-- expected outcomeAnd-- continuation of the previous keyword
Use data tables (| col | col |) when verifying multiple inputs or list entries.
Steps
- Read the diff:
git diff main...HEAD - Identify the changed features and user-facing behaviors
- Write scenarios covering the primary happy path and critical edge cases
- Use multiple
Scenarioblocks when changes affect distinct behaviors
Template
Feature: [feature name derived from changes]
Background:
Given I am logged into MetaMask Mobile
Scenario: [describe the user flow being verified]
Given [initial app state]
When user [performs action]
Then [expected outcome]
Examples
Simple single scenario:
Feature: Token balance refresh
Scenario: user pulls to refresh token balances
Given I am on the Wallet home screen
And I have tokens in my portfolio
When user pulls down on the token list
Then the token balances should update
And a loading indicator should appear briefly
Multiple scenarios with background:
Feature: Network selector migration to design system
Background:
Given I am logged into MetaMask Mobile
And I have multiple networks configured
Scenario: user switches network from wallet screen
Given I am on the Wallet home screen
When user taps the network selector
Then I should see the network list bottom sheet
And the current network should be highlighted
When user selects "Linea"
Then the network should switch to "Linea"
And the wallet should display Linea balances
Scenario: user dismisses network selector
Given I am on the Wallet home screen
When user taps the network selector
And user taps outside the bottom sheet
Then the network selector should close
And the network should remain unchanged
Scenario with data table:
Feature: Address book validation
Scenario: user enters invalid addresses
Given I am on the Send screen
When user enters the following invalid addresses:
| Input | Reason |
| 0x123 | Too short |
| not-an-address | Invalid format |
Then the "Next" button should remain disabled
Reference
For richer Gherkin patterns (tags, complex data tables, network-specific scenarios), see app/features/SampleFeature/e2e/sample-scenarios.feature.