Skip to content

chore: refactor testId selectors to avoid imports from app to e2e#24313

Merged
Gudahtt merged 7 commits intomainfrom
cferreira/fix-selectors-location
Jan 14, 2026
Merged

chore: refactor testId selectors to avoid imports from app to e2e#24313
Gudahtt merged 7 commits intomainfrom
cferreira/fix-selectors-location

Conversation

@christopherferreira9
Copy link
Copy Markdown
Contributor

@christopherferreira9 christopherferreira9 commented Jan 8, 2026

Description

This PR aims to refactor test ID definitions to follow proper architectural guidelines by moving them from e2e/selectors/ into the application code. App code was importing test IDs from the e2e/ folder, creating an incorrect dependency where production code depends on test infrastructure. This moves test ID definitions to app/ code as *.testIds.ts files, co-located with their respective components. E2E page objects now import test IDs from app code instead of vice versa.

Changes

  • Created *.testIds.ts files in app/ alongside their components
  • Updated all app/ imports to use local testIds files
  • Updated e2e/ page object imports to reference new app locations
  • No logic changes - only file organization and import paths
  • Existing selectors under e2e/ are test related files and are not imported in app/

Example

Before

// app/component-library/components/Cells/Cell/Cell.tsx
import { CellComponentSelectorsIDs } from '../../../../../e2e/selectors/wallet/CellComponent.selectors';

After

// app/component-library/components/Cells/Cell/Cell.tsx
import { CellComponentSelectorsIDs } from './CellComponent.testIds';

Notes

  • Duplicate selector files remain in e2e/selectors/ for wdio compatibility (wdio deprecation planned)
  • E2e-only selectors (test dapp, snaps, etc.) intentionally remain in e2e/selectors/

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

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

Before

After

Pre-merge author checklist

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.

Note

Refactors test ID ownership and imports to align with architecture (app code no longer imports from e2e/).

  • Adds/co-locates *.testIds.ts files alongside components and updates all app/tests to import from these modules (e.g., CellComponent.testIds, BrowserURLBar.testIds, TokenOverview.testIds, Network*...testIds, Perps/Predict testIds, etc.)
  • Removes e2e/selectors/* imports from app code; E2E can now consume IDs from app modules
  • Minor housekeeping: as const typings on IDs, localized path fixes for en.json, and small selector text/ID adjustments

Written by Cursor Bugbot for commit 60471d1. This will update automatically on new commits. Configure here.

@christopherferreira9 christopherferreira9 added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Jan 8, 2026
@christopherferreira9 christopherferreira9 requested review from a team as code owners January 8, 2026 12:09
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 8, 2026

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 team-qa QA team label Jan 8, 2026
@christopherferreira9 christopherferreira9 marked this pull request as draft January 8, 2026 12:09
@jvbriones jvbriones marked this pull request as ready for review January 8, 2026 12:28
@jvbriones jvbriones marked this pull request as draft January 8, 2026 12:29
@christopherferreira9 christopherferreira9 marked this pull request as ready for review January 8, 2026 13:22
@christopherferreira9 christopherferreira9 requested a review from a team as a code owner January 8, 2026 13:22
@christopherferreira9 christopherferreira9 force-pushed the cferreira/fix-selectors-location branch from 399815e to 2060c3f Compare January 8, 2026 17:40
@jvbriones jvbriones added the skip-e2e-quality-gate Skips the E2E Quality gate (flakiness detection) label Jan 9, 2026
brianacnguyen
brianacnguyen previously approved these changes Jan 12, 2026
@christopherferreira9 christopherferreira9 force-pushed the cferreira/fix-selectors-location branch 2 times, most recently from 6aabc5a to f1cdef1 Compare January 13, 2026 15:57
cortisiko
cortisiko previously approved these changes Jan 13, 2026
Copy link
Copy Markdown
Member

@cortisiko cortisiko left a comment

Choose a reason for hiding this comment

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

🌮 🌮

Gudahtt
Gudahtt previously approved these changes Jan 13, 2026
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

Gudahtt
Gudahtt previously approved these changes Jan 13, 2026
Gudahtt
Gudahtt previously approved these changes Jan 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - skip-smart-e2e-selection label found

All E2E tests pre-selected.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@Gudahtt Gudahtt merged commit e50fefa into main Jan 14, 2026
96 of 97 checks passed
@Gudahtt Gudahtt deleted the cferreira/fix-selectors-location branch January 14, 2026 14:25
@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2026
@metamaskbot metamaskbot added the release-7.62.0 Issue or pull request that will be included in release 7.62.0 label Jan 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.62.0 Issue or pull request that will be included in release 7.62.0 size-XL skip-e2e-quality-gate Skips the E2E Quality gate (flakiness detection) skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants