Skip to content

feat(dash0): locate e2e and showcase elements by data-testid, with lint rules - #672

Merged
fclairamb merged 27 commits into
mainfrom
chore/testid-locators-spec
Oct 25, 2026
Merged

fclairamb merged 27 commits into
mainfrom
chore/testid-locators-spec

Conversation

@fclairamb

@fclairamb fclairamb commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Implements specs/done/2026/10/2026-10-25-01-testid-locators-e2e-showcase.md: e2e and showcase specs locate elements by data-testid, and two lint rules keep it that way.

What changed

  • New ESLint rule no-text-locators (e2e/**, showcase/**): getByText, getByPlaceholder, getByLabel, :has-text, text= and hasText are reported. getByRole stays allowed. Text stays as an assertion (toHaveText) on a testid element.
  • New ESLint rule require-testid-on-interactive (src/**/*.tsx): an interactive element without data-testid is reported. A spread prop counts as satisfied. 674 existing violations are baselined in eslint-suppressions.json (it only shrinks). The text-locator baseline is empty.
  • Tests for both rules, including a baseline test (a baselined violation passes, the same line in a new file fails).
  • About 150 e2e spec files and the showcase specs moved to getByTestId. About 100 testids and a few data-* attributes added in src (and one in status0, status-custom-css).
  • Every active breadcrumb leaf now carries aria-current="page" (src/routes/orgs/$org.tsx). No layout change.
  • Toast assertions use [data-sonner-toaster].
  • The rule is written in web/dash0/AGENTS.md.

Checks

  • Full dash0 Playwright on a side-car: 976 passed, 0 failed, 15 skipped. status0: 113 passed.
  • lint:e2e, typecheck:e2e, test:unit (2733), lint-back green. 35 src ESLint errors are the same as on main.
  • Not run: Postgres, the showcase recordings (their locators were checked against src and the passing specs that use the same ids).
  • Testids are not stripped from the production bundle: about 45 KB raw before gzip.
  • One make test failure in the first gate run could not be reproduced (two reruns and a third full run are green).

Decided by autopilot

  • Spec 2026-10-25-01-testid-locators-e2e-showcase: open questions were already settled in the spec (getByRole stays allowed). No other answer adopted.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.71%. Comparing base (e53c2b5) to head (449c500).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #672      +/-   ##
==========================================
- Coverage   89.71%   89.71%   -0.01%     
==========================================
  Files        1291     1291              
  Lines      131644   131644              
==========================================
- Hits       118105   118102       -3     
- Misses      13530    13533       +3     
  Partials        9        9              

see 17 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

fclairamb added a commit that referenced this pull request Oct 25, 2026
Fixes the flaky Postgres scenario test `TestIncidentOpenAndClose`, which
failed on #672 (a markdown-only PR) waiting for `incident.escalated`.

## Root cause

The scenario servers share one database. When a scenario finished, its
cleanup canceled its job worker while one of its runners was inside
`claimNextJob`, holding the escalation job's row (`FOR UPDATE SKIP
LOCKED`). database/sql rolls a transaction back as soon as its context
is canceled. So COMMIT failed with `sql: transaction has already been
committed or rolled back` (the line in the CI log) and the job went back
to pending.

The other runners had woken on the same `job.created` signal and skipped
the locked row. `nextPendingWait` only looked at future jobs
(`scheduled_at > now`), so they slept the 5-minute fallback while a due
job sat in the queue. The webhook never arrived within the test's 15 s.
Production hits the same thing when a replica stops mid-claim during a
rolling deploy.

## Fix (`server/internal/jobs/jobsvc/service.go`)

- `nextPendingWait` now counts due pending jobs too. The existing 250 ms
floor turns them into a prompt retry, which is what spec 2026-09-25-07
item 2 intended.
- `claimNextJob` returns `ctx.Err()` when its context was canceled. A
shutdown mid-claim now stops the runner cleanly, instead of logging
"Error processing job" and backing off.

The test timeout is unchanged.

## Tests

- `TestClaimRollbackDoesNotStrandDueJob_Postgres` (new, embedded
Postgres) covers two cases: a due job behind another transaction's row
lock, and a claim canceled after its UPDATE. It fails without the fix
and logs the exact CI error.
- `TestNextPendingWaitFloorsAndCaps` gets a SQLite case for a due job.
- `make test` is green, the `scenario` package passed 5/5 with
`SP_TEST_REQUIRE_POSTGRES=1`, and golangci-lint reports 0 issues. `make
test-postgres` is green locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
@fclairamb
fclairamb force-pushed the chore/testid-locators-spec branch from 70d91b5 to 2dc8cb3 Compare October 25, 2026 15:52
@fclairamb
fclairamb force-pushed the chore/testid-locators-spec branch from 510c9f4 to 1990716 Compare October 25, 2026 15:52
fclairamb and others added 14 commits October 25, 2026 17:17
…testid

Add no-text-locators (e2e, showcase) and require-testid-on-interactive
(src) with existing violations baselined in eslint-suppressions.json.
Migrate the three showcase text locators.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…by text, role or label: move them to data-testid

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fclairamb added a commit that referenced this pull request Oct 25, 2026
Raises backend test coverage (spec `2026-10-23-03-coverage-90`). Moved
here from #672, where it did not belong.

## What changed
- About 30 new `*_cover_test.go` files: pkg/cli, auth (passkey, OAuth),
discord, slack, mcp, jobtypes, models, checkerdef, cmd/devloop, db
contract (`update_every_field`).
- `testsupport/errmap.go` and `testsupport/fault.go` (`SweepFresh`) to
drive error paths.
- Coverage floor 87 (CI, `scripts/coverage.sh`, `codecov.yml`). Local
measure: 88.5%, CI reads about 1 point lower.
- Wiki: `wiki/testing/test-layers.md`, `wiki/testing/coverage.md`.
- Fix: `slack/events.go` built its `Handler` without `cfg`, so
`link_shared` panicked on a nil config
(`TestLinkSharedUnfurlsOwnLinks`).

## Open
The spec asked for 90%. It stopped at 88.5% after 3 attempts. The spec
is still in `specs/todos/` until that is decided.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
fclairamb and others added 5 commits October 25, 2026 17:58
…rch e2e locate by data-testid

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…2e locate by data-testid

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…cators baseline

Adds data-testid and data-* name attributes on the elements the specs
targeted (breadcrumb leaf gets aria-current=page, status0 custom css
style, sidebar group labels, dns record rows, resource rows, etc.).
Toast assertions use [data-sonner-toaster].

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fclairamb and others added 6 commits October 25, 2026 18:49
…by text, role or label: move them to data-testid

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
integrations: the recent-notifications event cell carries data-testid and
data-event-type, and the spec asserts that the incident.resolved cell does
not render the raw key, instead of no td.font-mono anywhere.
notification-detail: match code elements by substring, as hasText did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…by text, role or label: move them to data-testid

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fclairamb fclairamb changed the title docs: spec for data-testid locators in e2e and showcase feat(dash0): locate e2e and showcase elements by data-testid, with lint rules Oct 25, 2026
@fclairamb
fclairamb merged commit 1aceb52 into main Oct 25, 2026
35 checks passed
@fclairamb
fclairamb deleted the chore/testid-locators-spec branch October 25, 2026 18:59
fclairamb added a commit that referenced this pull request Oct 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.42.0](v0.41.0...v0.42.0)
(2026-10-26)


### Features

* **ai:** hold auto-applied repairs to the previous version's hosts (+
scan specs) ([#663](#663))
([37966e2](37966e2))
* **api:** cursors on the events and incidents APIs
([#640](#640))
([bbd32b9](bbd32b9))
* **auth:** ask the default admin for a real email on first login
([#673](#673))
([e92e608](e92e608))
* **checks:** offer to resolve open incidents when a check is disabled
([#648](#648))
([9553cdc](9553cdc))
* **dash0:** locate e2e and showcase elements by data-testid, with lint
rules ([#672](#672))
([1aceb52](1aceb52))
* **mcp:** bound tool string inputs and disclose side effects
([#644](#644))
([22039c7](22039c7))
* **notifications:** ntfy notifications link to the incident
([#639](#639))
([e466060](e466060))


### Bug Fixes

* **ai:** hold AI loops to the check's hosts after a real-secrets run
([#646](#646))
([7cf836d](7cf836d))
* **ai:** hold every scheduled repair-auto run to its granted hosts
([#683](#683))
([ae9d0ef](ae9d0ef))
* **ai:** hold the repair: auto host grant when the script or env holds
a reference ([#678](#678))
([de4e718](de4e718))
* **auth:** redirect provider logins with an unknown org to the login
page instead of raw JSON
([#676](#676))
([6c4b4fd](6c4b4fd))
* custom-domain status assets, CSS sample, incident header, check scroll
([#689](#689))
([cdd89e0](cdd89e0))
* dashboard down count, mobile event log, browser retry, async report
test send ([#680](#680))
([f53c99b](f53c99b))
* **deps:** update github.com/dop251/goja digest to 1622cea
([#654](#654))
([70d3bfb](70d3bfb))
* **deps:** update github.com/dop251/goja digest to 2921f52
([#685](#685))
([8186068](8186068))
* **deps:** update github.com/dop251/goja digest to 2a9269b
([#668](#668))
([e536f52](e536f52))
* **deps:** update github.com/dop251/goja digest to 3c7039f
([#651](#651))
([bd93ee7](bd93ee7))
* **deps:** update github.com/dop251/goja digest to 6ace4dd
([#652](#652))
([0d7366c](0d7366c))
* **deps:** update github.com/dop251/goja digest to 6b6a90e
([#687](#687))
([4774086](4774086))
* **deps:** update go dependencies (non-major)
([#638](#638))
([b8453fb](b8453fb))
* **deps:** update go dependencies (non-major)
([#649](#649))
([296ecdf](296ecdf))
* **deps:** update go dependencies (non-major)
([#656](#656))
([9aef341](9aef341))
* **deps:** update module github.com/clickhouse/clickhouse-go/v2 to
v2.50.0 ([#688](#688))
([dbced61](dbced61))
* **deps:** update module github.com/gosnmp/gosnmp to v1.47.0
([#659](#659))
([575e17f](575e17f))
* **deps:** update module github.com/oapi-codegen/oapi-codegen/v2 to
v2.8.1 ([#661](#661))
([aa91cb6](aa91cb6))
* **deps:** update module github.com/ohler55/ojg to v1.28.8
([#675](#675))
([5666052](5666052))
* **deps:** update module github.com/posthog/posthog-go to v1.36.2
([#650](#650))
([fb01ef8](fb01ef8))
* **jobs:** retry a due job promptly when its claim rolls back
([#674](#674))
([f0edadd](f0edadd))
* **log:** drop error=&lt;nil&gt; from successful HTTP request logs
([#664](#664))
([4579f59](4579f59))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant