Skip to content

Commit

Permalink
[8.11] [ftr] fix url check by excluding port (#168112) (#168128)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.11`:
- [[ftr] fix url check by excluding port
(#168112)](#168112)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-05T16:28:46Z","message":"[ftr]
fix url check by excluding port (#168112)\n\n##
Summary\r\n\r\nAddressing MKI `commonPage.navigateToUrl()` failures when
`actualUrl`\r\ncontains port value.\r\n\r\n```\r\n✖ fail: Serverless
Common UI - Management Data View Management disables scripted fields
Scripted fields tab is missing\r\n--\r\n  | │ Error: retry.try timeout:
Error: expected
https://bk-serverless-ftr-185-elasticsearch-e79c7a.kb.eu-west-1.aws.qa.elastic.cloud/app/management/kibana/dataViews.includes(https://bk-serverless-ftr-185-elasticsearch-e79c7a.kb.eu-west-1.aws.qa.elastic.cloud:443/app/management/kibana/dataViews)\r\n```\r\n\r\nWorks
both on MKI and local serverless
run.","sha":"6301dc83843d2fad546a02edcef68ad9a6715937","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","FTR","v8.9.3","v8.12.0","v8.11.1"],"number":168112,"url":"https://github.com/elastic/kibana/pull/168112","mergeCommit":{"message":"[ftr]
fix url check by excluding port (#168112)\n\n##
Summary\r\n\r\nAddressing MKI `commonPage.navigateToUrl()` failures when
`actualUrl`\r\ncontains port value.\r\n\r\n```\r\n✖ fail: Serverless
Common UI - Management Data View Management disables scripted fields
Scripted fields tab is missing\r\n--\r\n  | │ Error: retry.try timeout:
Error: expected
https://bk-serverless-ftr-185-elasticsearch-e79c7a.kb.eu-west-1.aws.qa.elastic.cloud/app/management/kibana/dataViews.includes(https://bk-serverless-ftr-185-elasticsearch-e79c7a.kb.eu-west-1.aws.qa.elastic.cloud:443/app/management/kibana/dataViews)\r\n```\r\n\r\nWorks
both on MKI and local serverless
run.","sha":"6301dc83843d2fad546a02edcef68ad9a6715937"}},"sourceBranch":"main","suggestedTargetBranches":["8.9","8.11"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168112","number":168112,"mergeCommit":{"message":"[ftr]
fix url check by excluding port (#168112)\n\n##
Summary\r\n\r\nAddressing MKI `commonPage.navigateToUrl()` failures when
`actualUrl`\r\ncontains port value.\r\n\r\n```\r\n✖ fail: Serverless
Common UI - Management Data View Management disables scripted fields
Scripted fields tab is missing\r\n--\r\n  | │ Error: retry.try timeout:
Error: expected
https://bk-serverless-ftr-185-elasticsearch-e79c7a.kb.eu-west-1.aws.qa.elastic.cloud/app/management/kibana/dataViews.includes(https://bk-serverless-ftr-185-elasticsearch-e79c7a.kb.eu-west-1.aws.qa.elastic.cloud:443/app/management/kibana/dataViews)\r\n```\r\n\r\nWorks
both on MKI and local serverless
run.","sha":"6301dc83843d2fad546a02edcef68ad9a6715937"}},{"branch":"8.11","label":"v8.11.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <[email protected]>
  • Loading branch information
kibanamachine and dmlemeshko authored Oct 5, 2023
1 parent 6a19c59 commit 6518d71
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export class CommonPageObject extends FtrService {
private readonly defaultTryTimeout = this.config.get('timeouts.try');
private readonly defaultFindTimeout = this.config.get('timeouts.find');

private getUrlWithoutPort(urlStr: string) {
const url = new URL(urlStr);
url.port = '';
return url.toString();
}

/**
* Logins to Kibana as default user and navigates to provided app
* @param appUrl Kibana URL
Expand Down Expand Up @@ -121,8 +127,13 @@ export class CommonPageObject extends FtrService {
throw new Error(msg);
}

if (ensureCurrentUrl && !currentUrl.includes(appUrl)) {
throw new Error(`expected ${currentUrl}.includes(${appUrl})`);
if (ensureCurrentUrl) {
const actualUrl = this.getUrlWithoutPort(currentUrl);
const expectedUrl = this.getUrlWithoutPort(appUrl);

if (!actualUrl.includes(expectedUrl)) {
throw new Error(`expected ${actualUrl}.includes(${expectedUrl})`);
}
}
});
}
Expand Down

0 comments on commit 6518d71

Please sign in to comment.