test(advanced-color-picker): refine testing suite#7772
test(advanced-color-picker): refine testing suite#7772paulrobinson88 wants to merge 2 commits intomasterfrom
Conversation
82f9ce5 to
5970de5
Compare
| test("renders with aria-describedby prop", () => { | ||
| render(<ControlledColorPicker open aria-describedby="test-id" />); | ||
|
|
||
| expect(screen.getByRole("dialog")).toHaveAttribute( |
There was a problem hiding this comment.
| expect(screen.getByRole("dialog")).toHaveAttribute( | |
| expect(screen.getByRole("dialog")).toHaveAccessibleDescription( |
| test("renders with aria-labelledby prop", () => { | ||
| render(<ControlledColorPicker open aria-labelledby="test-label" />); | ||
|
|
||
| expect(screen.getByRole("dialog")).toHaveAttribute( |
There was a problem hiding this comment.
| expect(screen.getByRole("dialog")).toHaveAttribute( | |
| expect(screen.getByRole("dialog")).toHaveAccessibleName( |
5970de5 to
1b63ea9
Compare
There was a problem hiding this comment.
This is not required as focus is set when the button is clicked.
| @@ -273,4 +257,4 @@ | |||
| }); | |||
|
|
|||
| purpleChecked.focus(); | |||
There was a problem hiding this comment.
This is not required as focus is set when the call to action button was clicked.
There was a problem hiding this comment.
I initially removed this but the interaction test failed in the pipeline, possibly a timing issue since manually testing and closing it does focus the purple colour but specifically focusing does seem to resolve. The tests did pass in the published Chromatic build and locally though 🤷
| }); | ||
|
|
||
| purpleChecked.focus(); | ||
| await waitFor(() => expect(purpleChecked).toHaveFocus()); |
There was a problem hiding this comment.
This should not be the final assertion. The test is incomplete and does not test the prop. The restoreFocusOnClose prop should return focus to the call to action initial trigger button when the colour picker is closed. There should be a test here that checks that when the colour picker is closed, focus is returned to the initial call to action button.
1478f4c
1b63ea9 to
1478f4c
Compare
1478f4c to
ab6796d
Compare
Proposed behaviour
Removed flaky and duplicate tests from the Playwright file to improve stability and run times for the
Advanced Color Pickercomponent.Amended Interaction tests to cover off aspects which weren't covered in Jest or Playwright.
Current behaviour
The Playwright test file contains a number of tests which are covered in either Jest or Storybook interactions.
Checklist
d.tsfile added or updated if requiredQA
Additional context
Testing instructions
Check Storybook interactions pass and work as intended.