fix: CI test failures for DetailView $expand params and PivotTable error state assertion#949
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ble error state timing Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes CI test regressions caused by PR #944’s DetailView $expand/findOne() signature change and a race condition in PivotTable error-state assertions.
Changes:
- Update
RecordDetailEdittests to assertfindOne(objectName, id, undefined)(third arg reserved for$expandparams). - Fix PivotTable error-state test gating by checking
querySelector(...)result is notnullinsidewaitFor.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/console/src/tests/RecordDetailEdit.test.tsx | Updates findOne call assertions to match new 3-arg signature used by DetailView. |
| packages/plugin-dashboard/src/tests/ObjectPivotTable.test.tsx | Fixes waitFor assertion to properly wait for the error element to exist (handles querySelector returning null). |
| await waitFor(() => { | ||
| const errorEl = container.querySelector('[data-testid="pivot-error"]'); | ||
| expect(errorEl).toBeDefined(); | ||
| expect(errorEl).not.toBeNull(); | ||
| }); |
There was a problem hiding this comment.
In this file, waitFor blocks that rely on container.querySelector(...) should not assert with toBeDefined(), because querySelector returns null on miss and null is still “defined” (so the callback can pass immediately and not actually wait). This hunk fixes the error-state case, but the same pattern still exists in the loading-skeleton and empty-state tests above; those should be updated to assert not.toBeNull() (or use toBeInTheDocument() if jest-dom matchers are available) so the waitFor actually gates on DOM presence.
Three CI test failures introduced by PR #944's DetailView
$expandchanges.RecordDetailEdit.test.tsx —
DetailViewnow passesparams(even whenundefined) as third arg tofindOne(). Updated assertions to match the new call signature:ObjectPivotTable.test.tsx —
querySelectorreturnsnullon miss, notundefined.toBeDefined()always passed, sowaitFornever actually waited for the error state to render — classic race condition in CI.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.