From 39bd20f8721029c744eb5b7fbeb8ce2f4e03b794 Mon Sep 17 00:00:00 2001 From: Noel Light-Hilary Date: Sun, 25 Aug 2024 13:39:23 +0100 Subject: [PATCH] Remove weird, superfluous type hedging on IonicComponent `selector` --- e2e/src/helpers/ionic-component.ts | 10 +++------- e2e/src/helpers/ionic-input.ts | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/e2e/src/helpers/ionic-component.ts b/e2e/src/helpers/ionic-component.ts index bf7d56d..2ccb5a3 100644 --- a/e2e/src/helpers/ionic-component.ts +++ b/e2e/src/helpers/ionic-component.ts @@ -1,15 +1,11 @@ export class IonicComponent { - constructor(public selector: string | WebdriverIO.Element) { + constructor(public selector: string) { } get $() { return async ({ IonicPage }) => { - if (typeof this.selector === 'string') { - const activePage = await IonicPage.active(); - return activePage.$(this.selector); - } - - return this.selector; + const activePage = await IonicPage.active(); + return activePage.$(this.selector); }; } } diff --git a/e2e/src/helpers/ionic-input.ts b/e2e/src/helpers/ionic-input.ts index 1f84c51..c4f9e92 100644 --- a/e2e/src/helpers/ionic-input.ts +++ b/e2e/src/helpers/ionic-input.ts @@ -11,7 +11,7 @@ export class IonicInput extends IonicComponent { value: string, { visibilityTimeout = 5000 }: ElementActionOptions = {} ) { - const el = await Ionic$.$(this.selector as string); + const el = await Ionic$.$(this.selector); await el.waitForDisplayed({ timeout: visibilityTimeout }); const ionTags = ['ion-input', 'ion-textarea']; @@ -24,7 +24,7 @@ export class IonicInput extends IonicComponent { } async getValue({ visibilityTimeout = 5000 }: ElementActionOptions = {}) { - const el = await Ionic$.$(this.selector as string); + const el = await Ionic$.$(this.selector); await el.waitForDisplayed({ timeout: visibilityTimeout }); const ionTags = ['ion-input', 'ion-textarea'];