From bfa52bbd3669cca5dbae85c2a0969abb41a940db Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 27 Jun 2024 10:58:18 -0400 Subject: [PATCH] fix: add API Spec Tests section in testing.md (#10146) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** Adds a new section to testing.md that explains how to run the api spec tests ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- docs/readme/testing.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/readme/testing.md b/docs/readme/testing.md index d5ceb080777..a16eca1df86 100644 --- a/docs/readme/testing.md +++ b/docs/readme/testing.md @@ -133,3 +133,17 @@ If you want to run a specific test, you can include the `--spec` flag in the afo ```bash yarn test:wdio:android --spec ./wdio/features/Onboarding/CreateNewWallet.feature ``` + +##### API Spec Tests + +The API Spec tests use the `@open-rpc/test-coverage` tool to generate tests from our [api-specs](https://github.com/MetaMask/api-specs) OpenRPC Document. +Currently, the API Spec tests only run on iOS and uses the same build as the Detox tests for iOS. + +The `test-coverage` tool uses `Rules` and `Reporters` to generate tests and report the results. The `Rules` and `Reporters` are passed in via params to the test coverage tool call in [e2e/api-specs/json-rpc-coverage.js](../../e2e/api-specs/json-rpc-coverage.js). You can read more about the `Rules` and `Reporters` [here](https://github.com/open-rpc/test-coverage?tab=readme-ov-file#extending-with-a-rule). + +To run the API Spec tests, run these commands: + +```bash +yarn test:e2e:ios:debug:build +yarn test:api-specs +````