Skip to content

test(e2e): testids on login form + Sidebar help/settings; migrate auth + help-drawer specs - #378

Merged
krisarmstrong merged 1 commit into
mainfrom
ci/e2e-login-and-helpdrawer-testids
May 30, 2026
Merged

test(e2e): testids on login form + Sidebar help/settings; migrate auth + help-drawer specs#378
krisarmstrong merged 1 commit into
mainfrom
ci/e2e-login-and-helpdrawer-testids

Conversation

@krisarmstrong

Copy link
Copy Markdown
Collaborator

Replaces the brittle role/text regex selectors in auth.spec.ts (13
sites) and help-drawer.spec.ts (8 sites) with stable testids. The
login form's getByLabel(/username|password/i) and getByRole('button',
{ name: /sign in/i }) selectors break under es and under strict mode
when other "Sign" buttons render (e.g. "Sign out"); the help-drawer
specs used a dialog-name regex /help.*documentation/i that won't
survive any i18n translation.

UI changes (small, additive):

  • App.tsx login form: add data-testid="login-title" on the dialog
    h2, login-username, login-password, and login-submit on the
    matching input/button. Mirrors the seed login surface shape.

  • Sidebar.tsx FooterIconButton: optional 'data-testid'?: string
    prop, forwarded to the rendered . Help and Settings call
    sites pass sidebar-help-button and sidebar-settings-button.

Spec changes:

  • auth.spec.ts: 4 tests migrated to login-title / login-username /
    login-password / login-submit. The existing [data-testid= "logout-button"] reference stays — that testid already ships on
    main.
  • help-drawer.spec.ts: 4 tests migrated to sidebar-help-button +
    help-drawer + help-drawer-close (the latter two already ship per
    HelpDrawer.tsx after stem PR-C feat(help): surface version in HelpDrawer header (in-app About) #372).

Stem E2E plan S2 of 3.

…h + help-drawer specs

Replaces the brittle role/text regex selectors in auth.spec.ts (13
sites) and help-drawer.spec.ts (8 sites) with stable testids. The
login form's getByLabel(/username|password/i) and getByRole('button',
{ name: /sign in/i }) selectors break under es and under strict mode
when other "Sign" buttons render (e.g. "Sign out"); the help-drawer
specs used a dialog-name regex /help.*documentation/i that won't
survive any i18n translation.

UI changes (small, additive):

  - App.tsx login form: add `data-testid="login-title"` on the dialog
    h2, `login-username`, `login-password`, and `login-submit` on the
    matching input/button. Mirrors the seed login surface shape.

  - Sidebar.tsx FooterIconButton: optional `'data-testid'?: string`
    prop, forwarded to the rendered <button>. Help and Settings call
    sites pass `sidebar-help-button` and `sidebar-settings-button`.

Spec changes:

  - auth.spec.ts: 4 tests migrated to login-title / login-username /
    login-password / login-submit. The existing `[data-testid=
    "logout-button"]` reference stays — that testid already ships on
    main.
  - help-drawer.spec.ts: 4 tests migrated to sidebar-help-button +
    help-drawer + help-drawer-close (the latter two already ship per
    HelpDrawer.tsx after stem PR-C #372).

Stem E2E plan S2 of 3.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@krisarmstrong
krisarmstrong enabled auto-merge (squash) May 30, 2026 14:49
@github-actions

Copy link
Copy Markdown
Contributor

License Compliance Report

All dependencies pass license compliance checks

Go Dependencies

  • Unknown: 31 package(s)
  • MIT: 26 package(s)
  • BSD-3-Clause: 16 package(s)
  • Apache-2.0: 11 package(s)
  • BSD-2-Clause: 1 package(s)

npm Dependencies

See full report in workflow artifacts

Allowed Licenses: MIT, Apache-2.0, BSD-*, ISC, CC0-1.0, MPL-2.0
Forbidden: GPL, AGPL, SSPL (strong copyleft)

@krisarmstrong
krisarmstrong merged commit eccc6cc into main May 30, 2026
40 of 44 checks passed
@krisarmstrong
krisarmstrong deleted the ci/e2e-login-and-helpdrawer-testids branch May 30, 2026 15:27
krisarmstrong added a commit that referenced this pull request May 30, 2026
stem CI on the post-#380 main run failed with strict-mode violations
on every E2E test that calls page.getByTestId('sidebar-help-button'),
page.getByTestId('sidebar-history-button'), or page.getByTestId(
'sidebar-settings-button') — each resolving to 2 elements.

Root cause: SidebarLayout mounts SidebarBody twice as two
aside-wrapped copies of the same `body` element — a mobile copy
(`lg:hidden`) and a desktop copy (`hidden lg:flex`). The
responsive classes only toggle CSS display, not React mount, so
both copies live in the DOM regardless of viewport. SidebarFooter
inside that body emits five sidebar-*-button testids; every one of
them therefore appears twice in the DOM.

Fix: thread a `surfaceTestIds: boolean` through SidebarBody →
SidebarFooter. The mobile aside receives `body(false)`, the
desktop aside receives `body(true)`. Mobile copies drop the
sidebar-*-button data-testid attributes; desktop copies keep them.
Playwright's default 1280x720 viewport lands on the desktop aside,
so existing specs (auth, help-drawer, result-history, smoke) work
unchanged.

This is a UI-side fix rather than a test-side `.locator(':visible')`
workaround because:
  - The duplication is a UI bug that existed before E2E touched it
    (the mobile-and-desktop dual-mount predates testid migration).
  - Filtering by `:visible` in every spec would mask future genuine
    dup-testid mistakes elsewhere in the app.
  - Strict-mode is a feature we want to keep on, not work around.

No spec changes — the existing `getByTestId('sidebar-help-button')`
lookups now resolve to exactly one element. The previous "all
E2E Browser Tests pass" runs (before merge of #377/#378/#379)
were coincidental: those PRs added the testids without yet
triggering the dup; the smoke rewrite in #380 added more lookups,
which surfaced the strict-mode violation.

A follow-up will audit whether seed/niac sidebars have the same
dual-mount pattern (likely yes for seed since the layout shape is
shared); fixes there will land separately.

Co-authored-by: Kris Armstrong <kris.armstrong@icloud.com>
krisarmstrong added a commit that referenced this pull request May 30, 2026
)

Mirror of seed PR #1301 — one fragile site in stem/ui/e2e/auth.
spec.ts:24:

  await expect(page.getByText(/invalid|error|failed/i))
    .toBeVisible();

The /invalid|error|failed/i regex is brittle under es locale and
under copy churn. Replaced with getByRole alert. stem's login
surface (see PR #378 / S2) has role=alert on the error display.

Co-authored-by: Kris Armstrong <kris.armstrong@icloud.com>
krisarmstrong added a commit that referenced this pull request May 30, 2026
…tch (#387)

Brittleness fix #18 of the i18n-fragile-selector sweep.

Eight stem action-button selectors used language-specific regex.
Migrated to stable testids by adding three new testid surfaces in
the UI and migrating five spec files.

UI changes:
  - ConfirmModal.tsx: data-testid="confirm-modal-confirm" and
    "confirm-modal-cancel" on the two buttons.
  - HelpDrawer.tsx: data-testid="help-drawer-tab-tests",
    "help-drawer-tab-tutorials", and "help-drawer-tab-glossary"
    on the three tab buttons.

Spec migrations (8 sites across 5 files):
  - role-chip-backend.spec.ts:71,109 /switch role/i
    -> confirm-modal-confirm (the Switch role button is the
    confirm button of a ConfirmModal launched after clicking a
    RoleChip)
  - help-drawer-smoke.spec.ts:30 /open help/i
    -> sidebar-help-button (testid added in stem PR-S2 #378)
  - help-drawer-smoke.spec.ts:43 /^glossary$/i
    -> help-drawer-tab-glossary (new)
  - settings-drawer-module.spec.ts:26 /open settings/i
    -> sidebar-settings-button (testid from PR-S2 #378)
  - settings-drawer-module.spec.ts:28 dialog name=/settings/i
    -> getByTestId('settings-drawer')
  - reflector-platform-guard.spec.ts:46 /switch to test master/i
    -> role-chip-test-master (existing RoleChip.tsx testid)
  - dashboard.spec.ts:52 /start|stop/i
    -> reflector-start-button (ReflectorPage.tsx:295 testid)

Net: -8 i18n-fragile button selector sites. stem button-regex
count drops by 8.

Co-authored-by: Kris Armstrong <kris.armstrong@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant