refactor: tests selectors#113
Open
RocioCM wants to merge 15 commits into
Open
Conversation
…ssertion, split contract types - Add `import/first: off` to the spec override in eslint.config.js and remove all 26 inline `// eslint-disable-next-line import/first` suppressions - Restore the `!` non-null assertion on `intls[locale]` in i18n.ts to avoid a potential TS compile error with Partial<Record> indexed access - Split `AggregatorContract` into `OracleReaderContract` (marketplace's `manaUsdAggregator()`) and `AggregatorContract` (Chainlink's `decimals()` + `latestRoundData()`) in both buy.ts and mana-rate.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instrument components and pages with stable data-testid attributes (plus data-* state/variant attrs: data-selected, data-direction, data-size, data-variant) and switch the unit specs from brittle CSS-class selectors (.creator__ava, .spinner-box--column) onto those hooks. Decouples the tests from styling class names ahead of the styled-components refactor. SaleCountdown gains an optional testId prop so callers can label individual instances. No behavior change. tsc, lint, and the full unit suite (619 tests) stay green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rewrites every puppeteer selector in the e2e suite (16 spec files) from brittle CSS class names (.card, .pack, .subnav__balance, .cover-picker__tile.is-selected, .search-pop__row--collection, …) onto the stable data-testid / data-* hooks added in the prior commit — e.g. [data-testid="card"], [data-testid="cover-picker-tile"][data-selected="true"], [data-testid="search-pop-row"][data-kind="collection"]. Adds the three hooks the e2e flows still needed: - SellModal + MigrateModal dialogs: data-testid="modal" (parity with PrimaryListModal), so the secondary-listing / import flows can target the modal without .modal. - StoreSettings save button: data-testid="store-settings-save". Completes the classname decoupling (unit specs were migrated in the prior commit): tests no longer depend on styling class names, so the upcoming styled-components refactor won't break them. No behavior change. tsc, lint, unit suite (619) all green; every e2e spec passes in isolation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…nents # Conflicts: # app/e2e/collection.e2e.ts # app/e2e/credits.e2e.ts # app/e2e/search.e2e.ts # app/e2e/store-settings.e2e.ts # app/src/components/CollectionThumb.tsx # app/src/components/FittingRoom.tsx # app/src/pages/StoreSettings.tsx
Resolves conflicts from #112 (buy/cart UI fixes) against the data-testid work: - CreatorBadge: keep main's hidePrefix + the creator-name testid - NavBar: adopt main's new cart button (opens drawer) + subnav-cart / subnav-cart-badge testids - cart.e2e: adopt main's new drawer flow (go-to-cart link) Also fixes lint errors #112 introduced under the strict type-aware config so the tree stays 0/0: typed the resume-buy JSON.parse as CatalogItem, void-marked floating/misused promises in BuyModal & Cart, dropped an unnecessary CheckoutPhase assertion, and added navigate to a useCallback dep list.
Codifies the convention behind the styled-components test migration: tests target elements via stable data-testid / data-* attributes, never presentational class names.
Member
Author
|
@decentraland-bot review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Groundwork for the styled-components refactor: today both the unit specs and the e2e suite select DOM by CSS class name (.card, .spinner-box--column, .cover-picker__tile.is-selected, …). Once styling moves to styled-components those class names become generated hashes, which would break every test. This PR migrates the whole test surface onto stable data-testid / data-* hooks so the refactor won't touch tests.
Commits
Verification
No behavior change — this is test/instrumentation only.