Skip to content

[EDU-18407] test(cypress): add search E2E test suite#469

Open
PedroAntunesCosta wants to merge 30 commits into
mainfrom
test/edu-18407-search-e2e
Open

[EDU-18407] test(cypress): add search E2E test suite#469
PedroAntunesCosta wants to merge 30 commits into
mainfrom
test/edu-18407-search-e2e

Conversation

@PedroAntunesCosta
Copy link
Copy Markdown
Contributor

@PedroAntunesCosta PedroAntunesCosta commented May 27, 2026

What is the purpose of this pull request?

Adds a full Cypress E2E test suite for Help Center search, covering the
current Algolia path and stubbing the upcoming hybrid search (doctype filter)
path.

What problem is this solving?

EDU-18407 — Add Cypress search tests

No automated E2E coverage existed for the search feature. This PR closes
that gap so that the hybrid search rollout (EDU-17906, vtexdocs/helpcenter
PR #456) can land on a branch that already has passing search tests.

Changes

Config / infrastructure

  • cypress.config.cjs — adds env block with HYBRID_SEARCH_ENABLED flag; raises pageLoadTimeout to 60 s (Netlify preview cold-start fix, EDU-18407)
  • src/tests/cypress/support/commands.js — adds searchFor and submitSearch custom commands
  • .github/workflows/e2e-tests.yml — step summary updated to list search suites

New specs (all in src/tests/cypress/integration/)

File Tests Status
search-regression.cy.js 5 ✅ passing
search-results.cy.js 4 ✅ passing
search-autocomplete.cy.js 4 ✅ passing
search-locale.cy.js 3 (en, pt, es) ✅ passing
search-pagination.cy.js 3 ✅ passing
search-doctype-filter.cy.js 4 pending describe.skip — unblocked by vtexdocs/components PR #82

Bug fix (EDU-18495)

  • src/tests/cypress/integration/sidebar-navigation.cy.js — adds { force: true } to the EN sidebar .click() call to resolve a pre-existing animation flake (was 11/12; now 12/12 ✅)

Selector decisions

  • Search input: [data-cy="search"].first() — Algolia's SearchInput
    has no data-testid; .first() disambiguates the header vs
    hamburger-menu instance
  • Result cards: .searchCardTitle — stable class on SearchCard title Text
  • Doctype filter tabs: [data-testid="doctype-filter-tab*"] attributes —
    to be added to SearchFilterTabBar in vtexdocs/components PR Adjust pagination behavior #82

Known pending item

search-doctype-filter.cy.js runs as describe.skip (4 pending, CI green)
until vtexdocs/components PR #82 adds data-testid attributes to
SearchFilterTabBar. The full implementation is preserved on this branch
for reuse once those attributes land.

How to manually test

  1. Open a PR on this repo to trigger the E2E Tests workflow.
  2. Confirm CI shows: regression 5/5, results 4/4, autocomplete 4/4,
    locale 3/3, pagination 3/3, sidebar-navigation 12/12, doctype-filter 4 pending.
    Total: 40 passing, 4 pending, 0 failing.

Types of changes

  • Bug fix
  • New feature
  • Tests / CI
  • Breaking change

Adds HYBRID_SEARCH_ENABLED env var to cypress config and introduces
searchFor/submitSearch custom commands for the search test specs.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 27, 2026

Deploy Preview for leafy-mooncake-7c2e5e failed. Why did it fail? →

Name Link
🔨 Latest commit b104023
🔍 Latest deploy log https://app.netlify.com/projects/leafy-mooncake-7c2e5e/deploys/6a1e42278a61c900086311bf

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

This pull request does not contain a valid label. Please add one of the following labels: ['release-no', 'release-auto', 'release-patch', 'release-minor', 'release-major']

Covers five cases for search with hybrid flag OFF: input presence,
autocomplete dropdown, results URL, result card visibility, and no
hybrid-endpoint console errors.
@PedroAntunesCosta PedroAntunesCosta self-assigned this May 27, 2026
The search components use data-cy="search" (not data-testid="search-input")
and have no data-testid on the autocomplete dropdown or result cards.
Use structural selector for autocomplete items and .searchCardTitle for
result cards (stable className on SearchCard component).

Resolves B-1.
The search input (flex:0) is collapsed until its container is clicked.
Click the parent Flex container first to expand/focus before clear+type.
Also check container visibility in test 1 instead of the collapsed input.
@PedroAntunesCosta PedroAntunesCosta added the release-auto Automatic version bump label May 27, 2026
github-actions[bot]
github-actions Bot previously approved these changes May 27, 2026
The hamburger-menu component also renders a SearchInput in the DOM,
giving 2 [data-cy="search"] elements. Use .first() to target only
the header search input throughout searchFor, submitSearch, and spec.
github-actions[bot]
github-actions Bot previously approved these changes May 27, 2026
The Netlify preview can be slow after several tests run consecutively.
10s pageLoadTimeout is too tight; override to 30s for this spec's visit.
github-actions[bot]
github-actions Bot previously approved these changes May 27, 2026
- search-results.cy.js: 4 tests covering Enter/button submit, card href
  validity, and empty-state via intercept gating
- search-autocomplete.cy.js: 4 tests covering dropdown appearance,
  suggestion click navigation, outside-click dismiss, and See all results
- search-locale.cy.js: 3 tests (en/pt/es) verifying locale reflected in
  URL and results present after locale switch
- search-pagination.cy.js: 3 tests covering infinite-scroll load,
  duplicate-href check, and scroll-accumulation
- search-doctype-filter.cy.js: describe.skip skeleton pending EDU-18406

Selectors use confirmed classes (.searchCardTitle, [data-cy="search"])
from component source — no data-testid attrs exist in Algolia components.
github-actions[bot]
github-actions Bot previously approved these changes May 27, 2026
search-results: drop closest('a') href check — SearchCard wraps Flex not
  <a> with legacyBehavior, so no <a> ancestor exists on result cards
search-autocomplete: replace 'See all results' link check (unreliable,
  depends on Algolia returning >7 hits) with href check on first suggestion
  link (autocomplete items ARE real <a> tags)
search-locale: replace verifyLocale (URL check) with locale button check —
  router.push({pathname:'/search'}) does not preserve locale in the URL
search-pagination: replace closest('a') href uniqueness check with
  new-title-appeared check after scrolling
github-actions[bot]
github-actions Bot previously approved these changes May 27, 2026
cy.switchLocale from '/' gives URL '/pt' (no trailing slash), failing the
command's own include('/pt/') assertion before search is even submitted.
Locale-switching.cy.js works because it starts from an inner doc page.

Replace switchLocale + verifyLocale with direct visit to locale doc page
(/pt/docs/tutorials, /es/docs/tutorials) then submitSearch — same pattern
the existing locale-switching spec uses.
github-actions[bot]
github-actions Bot previously approved these changes May 27, 2026
Replaces describe.skip skeleton with four working tests targeting
SearchFilterTabBar. Viewport set to 1023px (tab bar hidden at >=1024px
per brand-ui 64em breakpoint). Depends on data-testid attributes to be
added to vtexdocs/components feat/hybrid-search branch per
temp/edu-18407/agent-prompt-add-filter-testids.md.
github-actions[bot]
github-actions Bot previously approved these changes May 27, 2026
github-actions[bot]
github-actions Bot previously approved these changes May 28, 2026
cy.on('window:console') is not a Cypress event — the handler never fired.
Replaced with cy.spy(win.console, 'error') via onBeforeLoad so the spy
is active before page JS executes. Test now manages its own cy.visit().
github-actions[bot]
github-actions Bot previously approved these changes May 28, 2026
… in URL (EDU-18407)

SearchInput has no submit button — Enter is the only submission mechanism
(confirmed in @vtexdocs/components search-box.tsx). Remove the via param and
its broken button branch. Replace the 'submits via search button' test with
'search URL includes the submitted keyword' (asserts keyword=orders in URL,
verifying the router query param name not already covered by the Enter test).
github-actions[bot]
github-actions Bot previously approved these changes May 29, 2026
…spec (EDU-18407)

All three scroll tests now gate on the Algolia network request via
cy.intercept/cy.wait('@algoliaNextPage') instead of fixed 1500ms delays.
github-actions[bot]
github-actions Bot previously approved these changes May 29, 2026
github-actions[bot]
github-actions Bot previously approved these changes May 29, 2026
Replace 5 inline .parent().parent().find('a') chains with a single
cy.getAutocompleteSuggestions() command. Fragility comment in
commands.js references pr-469-review.md Recommendation 5.
github-actions[bot]
github-actions Bot previously approved these changes Jun 1, 2026
MAX_ATTEMPTS 150 → 240 (240 × 10 s = 40 min).
Three consecutive V-16 CI runs failed at ~26 min with the deploy still
building — P99 worst case exceeds the old 25-min hard limit.
github-actions[bot]
github-actions Bot previously approved these changes Jun 1, 2026
…U-18407)

Adds a manual trigger so Cypress can run against a known-live preview URL
when Netlify builds are stuck or failing. Both wait steps are skipped on
workflow_dispatch; a resolve-url step picks the URL from the input or from
the normal wait-for-netlify-preview output depending on the trigger.

Also improves the timeout error message to use ::error:: annotation and
explain that it's an infrastructure issue with recovery options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-auto Automatic version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant