Skip to content

Conversation

pan-kot
Copy link
Member

@pan-kot pan-kot commented Oct 20, 2025

Description

The PR fixes some of the tests that were muted for React 18.

How has this been tested?

  • The flaky tests have been run over 100 times in the dry-run to ensure stability.
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.16%. Comparing base (041d9eb) to head (d155d92).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3947      +/-   ##
==========================================
- Coverage   97.17%   97.16%   -0.01%     
==========================================
  Files         854      854              
  Lines       24983    24978       -5     
  Branches     8801     8800       -1     
==========================================
- Hits        24276    24271       -5     
+ Misses        701      659      -42     
- Partials        6       48      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

const [readyItems, setReadyItems] = useState(memoItems);
const [delayedItems, setReadyItems] = useState(memoItems);
const readyItems = settings.manualServerMock ? memoItems : delayedItems;
useEffect(() => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This useEffect is firing an extra time during integ tests when run with React 18 + strict-mode, thus enforcing the loading state after the items are already resolved. The updated code avoids that effect as unnecessary as its only purpose is to imitate a server-side delay for manual tests.

);

(process.env.REACT_VERSION !== '18' ? test : test.skip)(
test(
Copy link
Member Author

Choose a reason for hiding this comment

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

This test is now working thanks to the changes to the test page.

return marks.filter(m => m.detail?.source === 'awsui');
let awsuiMarks: PerformanceMark[] = [];
await page.waitForAssertion(async () => {
await new Promise(r => setTimeout(r, 200));
Copy link
Member Author

Choose a reason for hiding this comment

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

This timeout is likely causing issues. Increasing it three-fold reduces flakiness, but the waitForAssertion seems to do a better job.

);

(process.env.REACT_VERSION !== '18' ? test : test.skip)(
test(
Copy link
Member Author

@pan-kot pan-kot Oct 20, 2025

Choose a reason for hiding this comment

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

This test was flaky, but I wasn't able to reproduce the failures when running it 100 times in a loop. I tried running it with visualRefresh=true and visualRefresh=false.

expect(role).toEqual('region');
expect(ariaLabelledby).not.toBeFalsy();
await expect(page.getElementsText(`#${ariaLabelledby}`)).resolves.toEqual([tableHeading]);
await expect(page.getElementsText(`#${CSS.escape(ariaLabelledby)}`)).resolves.toEqual([tableHeading]);
Copy link
Member Author

Choose a reason for hiding this comment

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

When React 18+ is used, we use the React's useId() function to generate unique IDs (used for ARIA labelled-by). However, that function produces ids with colons (":") that cause an invalid selector error unless escaped.

@pan-kot pan-kot marked this pull request as ready for review October 20, 2025 12:49
@pan-kot pan-kot requested a review from a team as a code owner October 20, 2025 12:49
@pan-kot pan-kot requested review from gethinwebster and removed request for a team October 20, 2025 12:49
@gethinwebster gethinwebster requested review from a team and removed request for a team and gethinwebster October 20, 2025 12:52
@gethinwebster gethinwebster requested a review from patrixd October 20, 2025 12:52
@pan-kot pan-kot requested review from a team and jperals and removed request for a team and patrixd October 23, 2025 15:32
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