Skip to content

Commit f13e1d4

Browse files
fix: use tapRedirectButton XPath approach for CI release build compat (MMQA-1721)
The runScript/cssSelector approach fails on CI release builds because the browser-webview view isn't recognized as a WebView with JS enabled. Switch to tapRedirectButton which uses XPath tap — same pattern that works for the ENS test on CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9d76a9d commit f13e1d4

2 files changed

Lines changed: 1 addition & 17 deletions

File tree

tests/page-objects/Browser/ExternalWebsites/RedirectWebsite.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,6 @@ class RedirectWebsite {
1717
);
1818
await redirectButton.tap(); // Click button to redirect to portfolio.metamask.io website
1919
}
20-
21-
/**
22-
* Navigate to a target URL via JavaScript injection in the WebView.
23-
* Use this instead of tapRedirectButton when Detox WebView tap causes
24-
* ReactContext crashes during cross-origin navigations.
25-
*/
26-
async navigateToTargetUrl(targetUrl: string): Promise<void> {
27-
const body = web(by.id(BrowserViewSelectorsIDs.BROWSER_WEBVIEW_ID)).element(
28-
by.web.cssSelector('body'),
29-
);
30-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
31-
await (body as any).runScript(
32-
`(el) => { window.location.href = '${targetUrl}'; }`,
33-
);
34-
}
3520
}
3621

3722
export default new RedirectWebsite();

tests/smoke/wallet/browser/browser-navigation.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ describe(SmokeWalletPlatform('Browser Navigation'), () => {
163163
},
164164
);
165165

166-
const targetUrl = `${getDappUrl(1)}/redirect-target.html`;
167-
await RedirectWebsite.navigateToTargetUrl(targetUrl);
166+
await RedirectWebsite.tapRedirectButton();
168167
await Assertions.expectElementToHaveText(
169168
Browser.urlInputBoxID,
170169
getOriginFromURL(getDappUrl(1)),

0 commit comments

Comments
 (0)