You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add script to update default E2E fixture from generated report (#26861)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
This PR improves the reliability and security of the automated E2E
fixture update workflow by fixing
race conditions, permission issues, and fork-handling logic.
Key changes:
update-e2e-fixtures.yml
- Fix: prevent stale fixture caching on cancelled jobs — adds if: ${{
!cancelled() }} guard to the
cache step so partial/failed runs don't overwrite valid cached fixtures
- Fix: commit-fixtures job now handles upstream cancellations — adds
!cancelled() to the job condition
so it can still commit even when update-fixtures was cancelled
- Fix: replace ACTIONS_WRITE_TOKEN with GITHUB_TOKEN — uses the built-in
token with explicit contents:
write and pull-requests: write permissions instead of a PAT, removing
the dependency on the org
secret
- Add explicit permissions to commit-fixtures and check-status jobs
ci.yml
- Fix: fork exclusion on all E2E jobs — moves
!github.event.pull_request.head.repo.fork to the top of
each condition so forks are excluded before any build/change checks
- Fix: ai_confidence string-to-number comparison — wraps comparison in
fromJSON(... || '0') to prevent
string comparison bugs
- Feat: force_run flag — propagates force_run output from
smart-e2e-selection so E2E jobs can be
manually forced regardless of file-change detection
- Adds smart-e2e-selection as a needs dependency where missing
(ios-tests-ready,
validate-e2e-fixtures)
scripts/update-e2e-fixture.sh
- Adds a helper script to update the default fixture from a generated
E2E report
Default fixture (tests/framework/fixtures/json/default-fixture.json)
- Updated fixture state to reflect current expected app state
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **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**
- [ ] 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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Medium risk because it changes CI gating/conditions for when E2E
builds and fixture workflows run, and adjusts GitHub Action
permissions/tokens for committing/commenting, which could impact test
coverage or workflow execution if misconfigured.
>
> **Overview**
> **Adds a manual override to always run E2E.** The
`smart-e2e-selection` composite action now outputs `force_run` when the
`skip-smart-e2e-selection` label is present, and `ci.yml` uses this flag
to trigger Android/iOS E2E builds/tests (and fixture validation) even
when path filters say nothing changed; confidence parsing was also
hardened via `fromJSON(... || '0')`.
>
> **Tightens and streamlines E2E fixture updates/validation.** The
fixture-validation Detox spec now throws (failing CI) when the committed
fixture is out of date and includes clearer remediation instructions;
ignored keys were expanded for several runtime-added network configs,
and a new unit test asserts unexpected new keys are detected. The
`Update E2E Fixtures` workflow now avoids cache/commit steps when
cancelled, sets explicit `contents`/`pull-requests` permissions, and
uses `GITHUB_TOKEN` for PR checkout/comments; a new
`scripts/update-e2e-fixture.sh` helps copy the generated fixture report
into the committed fixture locally.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
afc3f5f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
0 commit comments