Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(table): add screenshot tests using reusable test code #954

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

max-umain
Copy link
Collaborator

@max-umain max-umain commented Dec 20, 2024

Describe pull-request

Adds screenshot tests for table in lightmode and darkmode, using the reusable test code.

Issue Linking:

Jira:

  • CDEP-3664 (I believe this is covered in the default tests)
  • CDEP-3665 (covered in batch, filtering and sorting tests)
  • CDEP-3666 (covered in editing/body-input-wrapper tests (specifically interaction-hover.e2e.ts))
  • CDEP-3667 (covered in expandable-row and expandable-row-expanded tests)
  • CDEP-3668 (I believe this is covered in filtering or column-filtering tests)
  • CDEP-3669 (covered in the multiselect tests)
  • CDEP-3670 (covered in the pagination tests)
  • I believe CDEP-3671 is not covered in any test
  • I believe CDEP-3672 is not covered in any test
  • CDEP-3673 (covered in the sorting tests)
  • CDEP-3674 (covered in the zebra-mode tests)

How to test

  1. Run npm run test
  2. Visually inspect the files generated by the tests

Checklist before submission

  • I have added unit tests for my changes (if applicable)
  • All existing tests pass
  • I have updated the documentation (if applicable)
  • Not breaking production behavior
  • Behavior available in storybook with documented descriptions (if applicable)
  • npm run build-all without errors

Suggested test steps

  • Browser testing (Chrome, Safari, Firefox)
  • Keyboard operability
  • Interactive elements have labels.
  • Storybook controls
  • Design/controls/props is aligned with other components
  • Dark/light mode and variants
  • Input fields – values should be displayed properly
  • Events

Screenshots

Not applicable

Additional context

There's a lot of files changed in this PR. However, they are all for the same component, and most of the changes are new images for lightmode and darkmode with primary and secondary mode variant. Let me know if it's too much and I'll make multiple PRs of it.

Also, for the following test files

  • table/table/test/column-filtering/header-input-wrapper/interaction-focus.e2e.ts
  • table/table/test/editing/body-input-wrapper/interaction-focus.e2e.ts
  • table/table/test/editing/body-input-wrapper/interaction-hover.e2e.ts

they all have a test that checks the color of an element. This doesn't work when the mode or mode variant changes, because that also changes the color. So, I simply skip that check when we have a configuration. Let me know if this is also important to do for the different modes and mode variants.

Also, I noticed that in the zebra-mode tests, the zebra-mode coloring doesn't work for secondary mode variant with darkmode.

Copy link
Contributor

github-actions bot commented Dec 20, 2024

Playwright test results

passed  667 passed
skipped  1 skipped

Details

stats  668 tests across 145 suites
duration  1 minute, 44 seconds
commit  a5ba538

Skipped tests

src/components/table/table/test/expandable-row-autocollapse/expandable-row-autocollapse.e2e.ts › tds-table-expandable-row-autoCollapse › NEEDS FIXING: expanding one row collapses the others when autoCollapse is true

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-954.d3fazya28914g3.amplifyapp.com

@max-umain max-umain changed the base branch from develop to test/reusable-code-for-tests December 20, 2024 12:00
Copy link
Collaborator

@ckrook ckrook left a comment

Choose a reason for hiding this comment

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

It looks to me that the test here does not generate the correct screenshot in secondary.
The component works as expected in Storybook. So we need to address this faulty screenshot.

ckrook
ckrook previously approved these changes Dec 20, 2024
Copy link
Collaborator

@ckrook ckrook left a comment

Choose a reason for hiding this comment

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

Other then the zebra-mode screenshot in darkmode, it looks good

@ckrook ckrook self-requested a review December 20, 2024 12:49
@ckrook ckrook dismissed their stale review December 20, 2024 13:26

Removing my approval until we know how to handle zebra-mode screenshots

Copy link
Contributor

@nathalielindqvist nathalielindqvist left a comment

Choose a reason for hiding this comment

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

Each test suite has multiple renditions of the component in primary light mode, should we adress this? Apart from that this PR is incredibly complex to review since it covers close to, if not all, tests written for the Table component. Breaking out the tickets in Jira to only cover one aspect at the time, such as filtering, batch, multis election etc., was an attempt at bringing down the complexity level to make it easier to review. Having them all covered in one PR is very challenging and delays the review process quite a bit. For future reference it would be very appreciated if PRs could be kept sleek so we all can work efficiently together, even if the majority of the files changed are screenshots :)

@max-umain max-umain force-pushed the test/table-new-screenshot-tests branch from f954cc9 to 7f707dc Compare January 14, 2025 14:56
@ckrook ckrook merged commit b20d19b into test/reusable-code-for-tests Jan 15, 2025
2 checks passed
@ckrook ckrook deleted the test/table-new-screenshot-tests branch January 15, 2025 14:04
max-umain added a commit that referenced this pull request Jan 28, 2025
* test: add testConfiguration file with reusable test code

* test: change testConfiguration function parameter name

* test: remove undefined test configuration from testConfiguration.ts

* test: improve setupPage and getTestDescribeText

* test(tooltip): add screenshot tests using reusable test code (#960)

* test(tooltip): use reusable test code for lightmode and darkmode screenshot tests

* test(tooltip): move non-screenshot tests to not run for all style configurations

* test(toggle): add screenshot tests using reusable test code (#959)

* test(toggle): add screenshot tests using reusable test code

* test(toggle): move non-screenshot tests to not run for all style configurations

* test(toggle): remove old screenshots

* test(slider): add screenshot tests using reusable test code (#953)

* test(toast): add screenshot tests using reusable test code (#958)

* test(textarea): add screenshot tests using reusable test code (#957)

* test(text-field): add screenshot tests using reusable test code (#956)

* test(side-menu): add screenshot tests using reusable test code (#952)

* test(radio-button): add screenshot tests using reusable test code (#951)

* test(popover menu): add screenshot tests using reusable test code (#950)

* test(popover-canvas): add screenshot tests using reusable test code (#949)

* test(message): add screenshot tests using reusable test code (#948)

* test(chip): add screenshot tests using reusable test code (#947)

* test(link): add screenshot tests using reusable test code (#946)

* test(header): add screenshot tests using reusable test code (#945)

* test(footer): add screenshot tests using reusable test code (#944)

* test(dropdown): improved and added more screenshot tests with reusable test code (#943)

* test(datetime): update and improve lightmode and darkmode screenshot tests, with reusable test code (#942)

* test(checkbox): more and improved screenshot tests using reusable test code (#941)

* test(card): use reusable test code for lightmode and darkmode screenshot tests (#940)

* test(button): new and improved screenshot tests with reusable test code (#938)

* test(breadcrumbs): improved screenshot tests with reusable code (#937)

* test(banner): improved and more screenshot tests with reusable code (#936)

* test(accordion): more screenshot tests with reusable code (#935)

* test(tabs): add screenshot tests using reusable test code (#955)

* test(table): add screenshot tests using reusable test code (#954)

* test: make testConfiguration.ts more general

* test(stepper): add screenshot tests using reusable test code (#971)

* test(modal): add screenshot tests using reusable test code (#970)

* test(divider): add screenshot tests using reusable test code (#969)

* test(block): add screenshot tests using reusable test code (#968)

* test(spinner): add screenshot tests using reusable test code (#972)

* test(dropdown): update screenshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants