[FTR] Fix URL checks in navigateToApp (#176546)

## Summary

This PR fixes the URL check for successful navigation in the `common`
PageObject `navigateToApp` method.
This commit is contained in:
Robert Oskamp 2024-02-09 09:15:18 +01:00 committed by GitHub
parent 9591304b0d
commit 736af7b0e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -332,14 +332,16 @@ export class CommonPageObject extends FtrService {
}
currentUrl = (await this.browser.getCurrentUrl()).replace(/\/\/\w+:\w+@/, '//');
const decodedAppUrl = decodeURIComponent(appUrl);
const decodedCurrentUrl = decodeURIComponent(currentUrl);
const navSuccessful = currentUrl
const navSuccessful = decodedCurrentUrl
.replace(':80/', '/')
.replace(':443/', '/')
.startsWith(appUrl.replace(':80/', '/').replace(':443/', '/'));
.startsWith(decodedAppUrl.replace(':80/', '/').replace(':443/', '/'));
if (!navSuccessful) {
const msg = `App failed to load: ${appName} in ${this.defaultFindTimeout}ms appUrl=${appUrl} currentUrl=${currentUrl}`;
const msg = `App failed to load: ${appName} in ${this.defaultFindTimeout}ms appUrl=${decodedAppUrl} currentUrl=${decodedCurrentUrl}`;
this.log.debug(msg);
throw new Error(msg);
}