test(many): replace waitForSelector with waitFor (#28888)

Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

There are some tests that use Playwright's `waitForSelector`
[function](https://playwright.dev/docs/api/class-page#page-wait-for-selector).
However, Playwright has informed the community to not use this function
by labeling it as
[discouraged](https://playwright.dev/docs/api/class-page#page-wait-for-selector).

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Replaced `waitForSelector` with the
[recommended](https://playwright.dev/docs/api/class-page#page-wait-for-selector)
`waitFor`
[function](https://playwright.dev/docs/api/class-locator#locator-wait-for).

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

N/A
This commit is contained in:
Maria Hutt
2024-01-26 08:32:40 -08:00
committed by GitHub
parent ddd8b92235
commit 2a3c26e44d
25 changed files with 126 additions and 126 deletions

View File

@ -15,7 +15,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
});
test('should switch to a date-only view when the date button is clicked', async ({ page }) => {
const datetime = page.locator('ion-datetime');
@ -45,7 +45,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('Jan 1, 2022');
await expect(page.locator('#time-button')).toContainText('6:30 AM');
@ -58,7 +58,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('January 2022');
await expect(page.locator('#time-button')).toBeHidden();
@ -71,7 +71,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('2022');
await expect(page.locator('#time-button')).toBeHidden();
@ -84,7 +84,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('January');
await expect(page.locator('#time-button')).toBeHidden();
@ -97,7 +97,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#time-button')).toContainText('6:30 AM');
await expect(page.locator('#date-button')).toBeHidden();
@ -110,7 +110,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
const datetime = page.locator('ion-datetime');
const dateTarget = page.locator('#date-button');
@ -135,7 +135,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('January 2022');
await expect(page.locator('#time-button')).toBeHidden();
@ -153,7 +153,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('2022');
await expect(page.locator('#time-button')).toBeHidden();
@ -169,7 +169,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
/**
* The entire text reads 1 ene 2022, but some browsers will add
@ -187,7 +187,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#time-button')).toContainText('16:30');
});
@ -199,7 +199,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
const timeTarget = page.locator('#time-button');
await expect(timeTarget).toContainText('6:30');
@ -223,7 +223,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('Jan 1, 2022 6:30 AM');
await expect(page.locator('#time-button')).not.toBeVisible();
@ -238,7 +238,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('Jan 1, 2022 6:30 AM');
await expect(page.locator('#time-button')).not.toBeVisible();

View File

@ -11,7 +11,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toBeDisabled();
await expect(page.locator('#time-button')).toBeDisabled();
@ -24,7 +24,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
const datetimeButton = page.locator('ion-datetime-button');
await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-disabled`));

View File

@ -20,7 +20,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toContainText('3 days');
});
@ -32,7 +32,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toHaveText('0 days');
});
@ -49,7 +49,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toHaveText('Jun 1, 2022');
});
@ -69,7 +69,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toHaveText('Selected: 3');
});
@ -86,7 +86,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
const datetime = page.locator('ion-datetime');
const ionValueChange = await page.spyOnEvent('ionValueChange');
@ -111,7 +111,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
`,
config
);
await page.waitForSelector('.datetime-ready');
await page.locator('.datetime-ready').waitFor();
await expect(page.locator('#date-button')).toHaveText('Jun 1, 2022');
await expect(page.locator('#time-button')).toHaveText('4:30 PM');