Skip to content

feat: add api spec test infrastructure#24132

Merged
adonesky1 merged 63 commits intodevelopfrom
sj/api-spec-tests
Jun 25, 2024
Merged

feat: add api spec test infrastructure#24132
adonesky1 merged 63 commits intodevelopfrom
sj/api-spec-tests

Conversation

@shanejonas
Copy link
Copy Markdown
Contributor

@shanejonas shanejonas commented Apr 19, 2024

Description

This PR adds tests using api-specs via the @open-rpc/test-coverage tool.

Check out the test report on CircleCI as an artifact.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2304

Manual testing steps

  1. run yarn build:test
  2. run yarn test:api-specs
  3. see test report

Screenshots/Recordings

Link to video from PI lane demos
image
image
image

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • 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.

@shanejonas shanejonas requested review from a team as code owners April 19, 2024 15:11
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Apr 19, 2024
@shanejonas
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Copy Markdown
Collaborator

Policy update failed. You can review the logs or retry the policy update here

@shanejonas shanejonas closed this Apr 19, 2024
@shanejonas shanejonas reopened this Apr 19, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2024
@shanejonas
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated

@shanejonas shanejonas closed this Apr 19, 2024
@shanejonas shanejonas reopened this Apr 19, 2024
@shanejonas shanejonas closed this Apr 19, 2024
@shanejonas shanejonas reopened this Apr 19, 2024
@shanejonas shanejonas closed this Apr 19, 2024
@shanejonas shanejonas reopened this Apr 19, 2024
@shanejonas
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

1 similar comment
@shanejonas
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@shanejonas shanejonas added the team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead label Apr 19, 2024
@shanejonas shanejonas changed the title Sj/api spec tests feat: add api spec tests Apr 19, 2024
@metamaskbot metamaskbot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Apr 19, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated

@shanejonas
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Copy Markdown
Collaborator

No policy changes

1 similar comment
@metamaskbot
Copy link
Copy Markdown
Collaborator

No policy changes

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [c63d737]
Page Load Metrics (139 ± 179 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint66978484
domContentLoaded9181121
load431767139374179
domInteractive9181121
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 437 Bytes (0.01%)

@mcmire
Copy link
Copy Markdown
Contributor

mcmire commented Jun 21, 2024

@shanejonas I'm having trouble running yarn test:api-specs locally. Does Ganache run there? It doesn't seem to be able to connect to localhost.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [ad13905]
Page Load Metrics (42 ± 3 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint57164782512
domContentLoaded719921
load37564253
domInteractive719921
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 437 Bytes (0.01%)

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [1cdb3d7]
Page Load Metrics (58 ± 5 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6211193126
domContentLoaded10231332
load478258105
domInteractive10231332
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 437 Bytes (0.01%)

@mcmire
Copy link
Copy Markdown
Contributor

mcmire commented Jun 24, 2024

@shanejonas I added:

        await new Promise((resolve) => {
          setTimeout(resolve, 4000);
        });

after server.start() and got:

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: can't resolve reference #/components/schemas/BlockNumberOrTag from id #".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

and then the test just ended without doing anything else.

Is it possible that something inside of @open-rpc/mock-server is not being awaited properly? Or that openrpcDocument is somehow invalid?

Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests do succeed on CI, so that's good. Would be nice to figure out why it's failing locally but it could be my machine. Will approve in the meantime.

@adonesky1 adonesky1 merged commit c9fb2ab into develop Jun 25, 2024
@adonesky1 adonesky1 deleted the sj/api-spec-tests branch June 25, 2024 00:32
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants