Fix flaky BrowserSimulation test: async timing in ObjectForm field validation#373
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add findOne method to MockDataSource - Increase timeout for form field loading to 15 seconds - Wrap each field label check in waitFor to handle async rendering - Fixes "expected 0 to be greater than 0" assertion error for Date field Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Reduce initial timeout from 15s to 10s - Use Promise.all to check all field labels concurrently instead of sequentially - Improves test execution time while maintaining reliability Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Add expectLabelToExist helper function to reduce code duplication - Improves readability and maintainability - All tests still passing Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
✅ All checks passed!
|
210b295
into
copilot/update-kernel-to-latest-version
There was a problem hiding this comment.
Pull request overview
This PR fixes a flaky test in the CI pipeline that was failing due to race conditions in async form rendering. The test was checking for form field labels before they were fully rendered, causing intermittent failures with "expected 0 to be greater than 0" errors.
Changes:
- Added missing
findOnemethod to MockDataSource to complete the DataSource interface implementation - Increased timeout from 5s to 10s and converted sequential field checks to concurrent Promise.all for better async handling
- Extracted
expectLabelToExisthelper function to eliminate code duplication
| } | ||
| return { data: [] }; | ||
| } | ||
| async findOne(objectName: string, id: string) { |
There was a problem hiding this comment.
The findOne method signature should match the DataSource interface exactly. The interface defines id parameter as string | number, but the mock only accepts string. While this works for current tests, it could cause type errors if future tests pass numeric IDs. Consider updating the signature to match the interface.
| async findOne(objectName: string, id: string) { | |
| async findOne(objectName: string, id: string | number) { |
The
Scenario 4: Object Create Formtest was failing in CI withexpected 0 to be greater than 0when checking for the Date field label. The test was racing against async form rendering (client init + schema fetch + field generation).Changes
MockDataSource interface completion
findOnemethod required by DataSource interfaceAsync timing adjustments
Promise.all(reduces max wait from 35s → 10s)Code quality
expectLabelToExisthelper to eliminate duplicationAll changes are test-only. No production code modified.
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.