Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ftr] fix url check by excluding port #168112

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading