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(item): migrate tests to playwright #25479

Merged
merged 37 commits into from
Jun 29, 2022
Merged

test(item): migrate tests to playwright #25479

merged 37 commits into from
Jun 29, 2022

Conversation

sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Jun 15, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe): Test migrations

What is the current behavior?

Item tests are written in Puppeteer.

Issue URL: N/A

What is the new behavior?

Migrates tests to Playwright

  • Removes flaky exception fallback test for item counter
  • Introduces new option to setIonViewport that allows resizing the horizontal size of the viewport to match the scroll contents (for niche tests like the form test for item).

Does this introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions bot added the package: core @ionic/core package label Jun 15, 2022
Copy link
Contributor Author

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

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

Need to update alignment tests so that the ion-datetime has a fixed date (prevent it from defaulting to today).

Also need to check how to resize the viewport correctly to accommodate the "form" screenshot tests, which have a large horizontal viewport.

@sean-perkins sean-perkins marked this pull request as ready for review June 15, 2022 18:25
@sean-perkins sean-perkins requested a review from a team as a code owner June 15, 2022 18:25
Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

Great job!

@@ -27,7 +27,7 @@
<ion-list-header>Leading Icons</ion-list-header>
<ion-item>
<ion-icon slot="start" name="time"></ion-icon>
<ion-datetime display-format="DDDD MMMM D YYYY hh:mm:ss a" value="2019-10-01T15:43:40.394Z"></ion-datetime>
<ion-datetime value="2019-10-01T15:43:40.394Z"></ion-datetime>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to use ion-datetime here? Wondering if we can use something else instead to make the screenshots a bit smaller

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't believe so, I can swap those out with inputs 👍

core/src/utils/test/playwright/playwright-declarations.ts Outdated Show resolved Hide resolved

await page.setIonViewport();

await page.click('text=Edit');
Copy link
Contributor

Choose a reason for hiding this comment

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

~ Might be better to use a more stable selector, like an ID.

import { test } from '@utils/test/playwright';

test.describe('item: inputs', () => {
test('should not have visual regressions', async ({ page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

At least one of the datetimes is missing entirely here:

  • core/src/components/item/test/inputs/item.e2e.ts-snapshots/item-inputs-ios-rtl-Mobile-Firefox-linux.png
  • core/src/components/item/test/inputs/item.e2e.ts-snapshots/item-inputs-md-ltr-Mobile-Safari-linux.png
  • core/src/components/item/test/inputs/item.e2e.ts-snapshots/item-inputs-md-rtl-Mobile-Safari-linux.png

You may need to do await page.waitForSelector('.datetime-ready')?

Copy link
Contributor

@averyjohnston averyjohnston left a comment

Choose a reason for hiding this comment

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

Great work! Better to deal with all that now, than later when the test would inevitably start flaking on us 🤭

@sean-perkins sean-perkins merged commit 7ac215b into main Jun 29, 2022
@sean-perkins sean-perkins deleted the FW-1214 branch June 29, 2022 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants