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

@ -45,7 +45,7 @@ test.describe('select: basic', () => {
animations: 'disabled',
});
const alert = await page.locator('ion-alert');
const alert = page.locator('ion-alert');
await alert.evaluate((el: HTMLIonAlertElement) => el.dismiss());
await ionDismiss.next();
@ -65,7 +65,7 @@ test.describe('select: basic', () => {
animations: 'disabled',
});
const actionSheet = await page.locator('ion-action-sheet');
const actionSheet = page.locator('ion-action-sheet');
await actionSheet.evaluate((el: HTMLIonActionSheetElement) => el.dismiss());
await ionDismiss.next();

View File

@ -7,8 +7,8 @@ test.describe('select: compare-with', () => {
await page.goto('/src/components/select/test/compare-with');
const multipleSelect = await page.locator('#multiple');
const singleSelect = await page.locator('#single');
const multipleSelect = page.locator('#multiple');
const singleSelect = page.locator('#single');
await expect(multipleSelect).toHaveJSProperty('value', [
{

View File

@ -8,7 +8,7 @@ test.describe.skip('select: async', () => {
await page.goto(`/src/components/select/test/legacy/async`);
const selectValueSet = await page.spyOnEvent('selectValueSet');
const select = await page.locator('#default');
const select = page.locator('#default');
await selectValueSet.next();

View File

@ -44,7 +44,7 @@ test.describe('select: basic', () => {
`select-alert-diff-${page.getSnapshotSettings()}.png`
);
const alert = await page.locator('ion-alert');
const alert = page.locator('ion-alert');
await alert.evaluate((el: HTMLIonAlertElement) => el.dismiss());
await ionDismiss.next();
@ -64,7 +64,7 @@ test.describe('select: basic', () => {
`select-action-sheet-diff-${page.getSnapshotSettings()}.png`
);
const actionSheet = await page.locator('ion-action-sheet');
const actionSheet = page.locator('ion-action-sheet');
await actionSheet.evaluate((el: HTMLIonActionSheetElement) => el.dismiss());
await ionDismiss.next();

View File

@ -7,8 +7,8 @@ test.describe('select: compare-with', () => {
await page.goto('/src/components/select/test/legacy/compare-with');
const multipleSelect = await page.locator('#multiple');
const singleSelect = await page.locator('#single');
const multipleSelect = page.locator('#multiple');
const singleSelect = page.locator('#single');
await expect(multipleSelect).toHaveJSProperty('value', [
{

View File

@ -10,7 +10,7 @@ test.describe('select: standalone', () => {
await ionAlertDidPresent.next();
const alert = await page.locator('ion-alert');
const alert = page.locator('ion-alert');
await alert.evaluate((el: HTMLIonAlertElement) => el.dismiss());
await ionAlertDidDismiss.next();