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

# Backport

This will backport the following commits from `main` to `8.12`:
- [[FTR] Fix URL checks in navigateToApp
(#176546)](https://github.com/elastic/kibana/pull/176546)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Robert
Oskamp","email":"robert.oskamp@elastic.co"},"sourceCommit":{"committedDate":"2024-02-09T08:15:18Z","message":"[FTR]
Fix URL checks in navigateToApp (#176546)\n\n## Summary\r\n\r\nThis PR
fixes the URL check for successful navigation in the
`common`\r\nPageObject `navigateToApp`
method.","sha":"736af7b0e07512b7797e3759d076dbcebbb55b64","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:prev-minor","v8.13.0","v8.12.2"],"title":"[FTR]
Fix URL checks in
navigateToApp","number":176546,"url":"https://github.com/elastic/kibana/pull/176546","mergeCommit":{"message":"[FTR]
Fix URL checks in navigateToApp (#176546)\n\n## Summary\r\n\r\nThis PR
fixes the URL check for successful navigation in the
`common`\r\nPageObject `navigateToApp`
method.","sha":"736af7b0e07512b7797e3759d076dbcebbb55b64"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/176546","number":176546,"mergeCommit":{"message":"[FTR]
Fix URL checks in navigateToApp (#176546)\n\n## Summary\r\n\r\nThis PR
fixes the URL check for successful navigation in the
`common`\r\nPageObject `navigateToApp`
method.","sha":"736af7b0e07512b7797e3759d076dbcebbb55b64"}},{"branch":"8.12","label":"v8.12.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
This commit is contained in:
Kibana Machine 2024-02-09 05:18:15 -05:00 committed by GitHub
parent 20f8b18501
commit 1ba3eee76b
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);
}