diff --git a/e2e/pages/BasePage.ts b/e2e/pages/BasePage.ts index 57e5bac..3f1925b 100644 --- a/e2e/pages/BasePage.ts +++ b/e2e/pages/BasePage.ts @@ -26,7 +26,34 @@ export class BasePage { async click(element: WebdriverIOElement, timeout: number = 10000): Promise { await element.waitForDisplayed({ timeout }); - await element.click(); + + // Dismiss language modal if present (can block interactions on BrowserStack) + await this.dismissLanguageModal(); + + // Use touch actions directly for BrowserStack compatibility + // BrowserStack sometimes doesn't register regular clicks on real devices + const location = await element.getLocation(); + const size = await element.getSize(); + const x = location.x + (size.width / 2); + const y = location.y + (size.height / 2); + + await this.driver.performActions([ + { + type: 'pointer', + id: 'finger1', + parameters: { pointerType: 'touch' }, + actions: [ + { type: 'pointerMove', duration: 0, x: Math.round(x), y: Math.round(y) }, + { type: 'pointerDown', button: 0 }, + { type: 'pause', duration: 150 }, + { type: 'pointerUp', button: 0 }, + ], + }, + ]); + await this.driver.releaseActions(); + + // Small pause after click to let UI respond + await this.driver.pause(300); } async isDisplayed(element: WebdriverIOElement): Promise { @@ -78,10 +105,14 @@ export class BasePage { await this.dismissExternalApps(); if (await this.isOnHomePage()) { + await this.dismissLanguageModal(); return; } await this.driver.activateApp(APP_PACKAGE_NAME); + + // Dismiss language modal that may appear on fresh installs (BrowserStack) + await this.dismissLanguageModal(); const homePageLoaded = await this.isOnHomePage(); if (homePageLoaded) { @@ -90,6 +121,9 @@ export class BasePage { await this.driver.pressKeyCode(4); + // Dismiss language modal again after navigation + await this.dismissLanguageModal(); + // Excessive timeout to ensure home page is loaded. Team will need to improve performance. await this.homeButton.waitForDisplayed({ timeout: 40000 }); }