Skip to content

test(textarea): refine testing suite - #8130

Draft
dariusbercea-sage wants to merge 1 commit into
masterfrom
FE-6517
Draft

test(textarea): refine testing suite#8130
dariusbercea-sage wants to merge 1 commit into
masterfrom
FE-6517

Conversation

@dariusbercea-sage

Copy link
Copy Markdown
Contributor

Proposed behaviour

Removes a number of Playwright tests that duplicate either Jest or Chromatic ones for the Simple Color Picker component

Current behaviour

There are a number of tests that exist in different forms in all the testing suites we do(Jest, Playwright, Chromatic) which cause a prolonged time of execution for no additional value.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

This should decrease the time of execution without compromising testing and coverage

Testing instructions

Make sure the Playwright tests pass

nineteen88
nineteen88 previously approved these changes Aug 12, 2026
@paulrobinson88
paulrobinson88 self-requested a review August 13, 2026 07:04

@paulrobinson88 paulrobinson88 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Darius, we've cleared up alot of snapshots and pw tests here, just some queries from me around some which have been removed. Thanks

Comment thread src/components/textarea/textarea.pw.tsx Outdated
});
});

test("should render with required prop", async ({ mount, page }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment: I think we could probably remove this by just adding a required prop to one of the snapshots currently taken like validation

await expect(characterCount(page)).not.toBeInViewport();
});

test("visually hidden character count of 5 should be rendered", async ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question: Do we have this covered elsewhere? Specifically the hidden character count.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it's covered by
it("renders a visually hidden hint with id generated via guid") in jest

});
});

test(`should verify expandable Textarea shrinks back to original height when lines are removed`, async ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question: Do we have this covered elsewhere?

expect(callbackCount).toEqual(1);
});

test("should call onBlur callback when a blur event is triggered", async ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question: Do we have this covered elsewhere?

expect(callbackCount).toEqual(1);
});

test("should call onClick callback when a click event is triggered", async ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment: I can't see this covered in Jest and we don't appear to have an interaction story, we may want to add this back in.

expect(callbackCount).toEqual(1);
});

test("should call onMouseDown callback when a mousedown event is triggered", async ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment: I can't see this covered in Jest and we don't appear to have an interaction story, we may want to add this back in.

const keysToTrigger = ["Enter", "Space"];

keysToTrigger.forEach((key) => {
test(`should call onKeyDown callback when ${key} key is triggered`, async ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment: I can't see this covered in Jest and we don't appear to have an interaction story, we may want to add this back in.

});

testData.forEach((placeholder) => {
test(`should render with placeholder prop set to ${placeholder}`, async ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment: It looks like Jest covers the placeholder being disabled and not rendering but not when it's passed, either we can add it to Jest or maybe add as a prop to one of the stories captured by Chromatic.

test(textarea): fixed lint

test(textarea): addressed comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants