Skip to content

test: add script for updating the mock cdn files and headers automatically to the latest version#23706

Merged
seaona merged 4 commits intodevelopfrom
update-mock-cdn
Mar 26, 2024
Merged

test: add script for updating the mock cdn files and headers automatically to the latest version#23706
seaona merged 4 commits intodevelopfrom
update-mock-cdn

Conversation

@seaona
Copy link
Copy Markdown
Member

@seaona seaona commented Mar 25, 2024

Description

After the cdn mock PR has been merged, we are now introducing a script for automatically replace the mocks with the latest version files.
This way, when running yarn mock-cdn-update the new versions will be fetched and all the mocks regarding cdn blockaid will be updated.

  • If no breaking changes to the responses/files are introduced, we should expect the tests to continue to run successfully.
  • If there are breaking changes in the new file versions, which make the ppom tests fail, the tests should be updated too.

Related issues

Fixes: #23640

Manual testing steps

  1. Checkout the branch
  2. Run yarn mock-cdn-update --> see cdn files are updated
  3. Run blockaid test yarn test:e2e:single test/e2e/tests/ppom/ppom-blockaid-alert-simple-send.spec.js --browser=chrome --> see they continue to pass using the new cdn files

Screenshots/Recordings

update-mock-cdn-script.mp4

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.

@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.

@seaona seaona added the team-confirmations-secure-ux-deprecated DEPRECATED: please use "team-confirmations" instead label Mar 25, 2024
@seaona seaona changed the title update mock cdn script add: script for updating the mock cdn files and headers automatically to the latest version Mar 25, 2024
@seaona seaona changed the title add: script for updating the mock cdn files and headers automatically to the latest version test: add script for updating the mock cdn files and headers automatically to the latest version Mar 25, 2024
@seaona seaona added team-confirmations-secure-ux-PR PRs from the confirmations team and removed team-confirmations-secure-ux-deprecated DEPRECATED: please use "team-confirmations" instead labels Mar 26, 2024
@seaona seaona marked this pull request as ready for review March 26, 2024 09:27
@seaona seaona requested a review from a team as a code owner March 26, 2024 09:27
return {
mainnetConfigVersion,
mainnetStaleVersion,
mainnetStaleDiffVersion,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we need to get each file version, for later make the corresponding request to the config, stale and stale_files, by passing the version into the URL param

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.81%. Comparing base (87d98ea) to head (04fc9e2).
Report is 29 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #23706   +/-   ##
========================================
  Coverage    68.81%   68.81%           
========================================
  Files         1169     1169           
  Lines        44376    44376           
  Branches     11874    11874           
========================================
  Hits         30536    30536           
  Misses       13840    13840           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"download-builds:test": "tsx .devcontainer/download-builds.ts prep-build-test",
"master-sync": "node development/master-sync.js"
"master-sync": "node development/master-sync.js",
"update-mock-cdn": "node test/e2e/mock-cdn/update-mock-cdn-files.js"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @seaona : is this script also called somewhere ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hey Jyoti, the script is not called anywhere in the code for now. We can use run it locally whenever we want to update/get new files, instead of doing this manually. For example, for adding this new spec, where we test a data upgrade
#23641

In the future we could think on having some periodic upgrades of the mock files in the case we want, and we could use this script too.

@seaona seaona merged commit 6f38eb3 into develop Mar 26, 2024
@seaona seaona deleted the update-mock-cdn branch March 26, 2024 15:24
@github-actions github-actions bot locked and limited conversation to collaborators Mar 26, 2024
@metamaskbot metamaskbot added the release-11.15.0 Issue or pull request that will be included in release 11.15.0 label Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-11.15.0 Issue or pull request that will be included in release 11.15.0 team-confirmations-secure-ux-PR PRs from the confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[e2e] Infra - PPOM - Add script to update the cdn mock files automatically

4 participants