test(many): do not await page.locator (#27267)

Issue number: N/A

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- 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. -->

`page.locator` is synchronous, but we were `await`ing the calls:
https://playwright.dev/docs/api/class-page#page-locator

We were also doing `page.locator(...).click()` when we can just do
`page.click([selector])` directly,

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

- Removes `await` usage from `page.locator`
- Removes `page.locator().click()` usage in favor of `page.click()`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
This commit is contained in:
Liam DeBeasi
2023-04-25 08:26:17 -04:00
committed by GitHub
parent c267b43396
commit 0ac451998c
27 changed files with 96 additions and 96 deletions

View File

@ -17,7 +17,7 @@ test.describe('loading: basic', () => {
await expect(page).toHaveScreenshot(`loading-${screenshotModifier}-diff-${page.getSnapshotSettings()}.png`);
const loading = await page.locator('ion-loading');
const loading = page.locator('ion-loading');
await loading.evaluate((el: HTMLIonLoadingElement) => el.dismiss());
await ionLoadingDidDismiss.next();
@ -51,7 +51,7 @@ test.describe('loading: basic', () => {
await ionLoadingDidPresent.next();
const loading = await page.locator('ion-loading');
const loading = page.locator('ion-loading');
await expect(loading).toHaveAttribute('data-testid', 'basic-loading');
});
});
@ -63,7 +63,7 @@ test.describe('loading: basic', () => {
await ionLoadingDidPresent.next();
const button = await page.locator('ion-loading ion-button');
const button = page.locator('ion-loading ion-button');
if (browserName === 'webkit') {
await page.keyboard.down('Alt');

View File

@ -15,7 +15,7 @@ test.describe('loading: standalone', () => {
await expect(page).toHaveScreenshot(`loading-standalone-diff-${page.getSnapshotSettings()}.png`);
const loading = await page.locator('ion-loading');
const loading = page.locator('ion-loading');
await loading.evaluate((el: HTMLIonLoadingElement) => el.dismiss());
await ionLoadingDidDismiss.next();