Skip to content

Commit

Permalink
[8.9] [Infra UI] Hosts view test: fix apm services link (#162147) (#1…
Browse files Browse the repository at this point in the history
…62216)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Infra UI] Hosts view test: fix apm services link
(#162147)](#162147)

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

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

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-07-19T08:30:43Z","message":"[Infra
UI] Hosts view test: fix apm services link (#162147)\n\nCloses
https://github.com/elastic/kibana/issues/162051\r\nCloses #159368\r\n##
Summary\r\n\r\nThis PR aims to make the APM services link test more
stable. For some\r\nreason, some of the query parameters are not present
in the URL the\r\nmoment we navigate but we can see in the screenshot
that the correct\r\ndates are applied (it could be that the moment we
load APM the URL is\r\nnot updated - when checking locally those
parameters exist in the URL)\r\n<img width=\"1612\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/14139027/2363108a-329e-4f28-a0d8-9f177d01d4ef\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"e98abd0fb5896b573de7ab811534d134d15d7cb9","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Infra
Monitoring
UI","release_note:skip","backport:prev-minor","v8.10.0"],"number":162147,"url":"https://github.com/elastic/kibana/pull/162147","mergeCommit":{"message":"[Infra
UI] Hosts view test: fix apm services link (#162147)\n\nCloses
https://github.com/elastic/kibana/issues/162051\r\nCloses #159368\r\n##
Summary\r\n\r\nThis PR aims to make the APM services link test more
stable. For some\r\nreason, some of the query parameters are not present
in the URL the\r\nmoment we navigate but we can see in the screenshot
that the correct\r\ndates are applied (it could be that the moment we
load APM the URL is\r\nnot updated - when checking locally those
parameters exist in the URL)\r\n<img width=\"1612\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/14139027/2363108a-329e-4f28-a0d8-9f177d01d4ef\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"e98abd0fb5896b573de7ab811534d134d15d7cb9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/162147","number":162147,"mergeCommit":{"message":"[Infra
UI] Hosts view test: fix apm services link (#162147)\n\nCloses
https://github.com/elastic/kibana/issues/162051\r\nCloses #159368\r\n##
Summary\r\n\r\nThis PR aims to make the APM services link test more
stable. For some\r\nreason, some of the query parameters are not present
in the URL the\r\nmoment we navigate but we can see in the screenshot
that the correct\r\ndates are applied (it could be that the moment we
load APM the URL is\r\nnot updated - when checking locally those
parameters exist in the URL)\r\n<img width=\"1612\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/14139027/2363108a-329e-4f28-a0d8-9f177d01d4ef\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"e98abd0fb5896b573de7ab811534d134d15d7cb9"}}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
jennypavlova and kibanamachine authored Jul 19, 2023
1 parent c4a5098 commit f071fb3
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions x-pack/test/functional/apps/infra/hosts_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const returnTo = async (path: string, timeout = 2000) =>
retry.waitForWithTimeout('returned to hosts view', timeout, async () => {
await browser.goBack();
await pageObjects.header.waitUntilLoadingHasFinished();
const currentUrl = await browser.getCurrentUrl();
return !!currentUrl.match(path);
});
Expand Down Expand Up @@ -313,35 +314,31 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});

it('should navigate to Uptime after click', async () => {
await pageObjects.infraHostsView.clickFlyoutUptimeLink();
const url = parse(await browser.getCurrentUrl());
describe('Flyout links', () => {
it('should navigate to Uptime after click', async () => {
await pageObjects.infraHostsView.clickFlyoutUptimeLink();
const url = parse(await browser.getCurrentUrl());

const search = 'search=host.name: "Jennys-MBP.fritz.box" OR host.ip: "192.168.1.79"';
const query = decodeURIComponent(url.query ?? '');
const search = 'search=host.name: "Jennys-MBP.fritz.box" OR host.ip: "192.168.1.79"';
const query = decodeURIComponent(url.query ?? '');

expect(url.pathname).to.eql('/app/uptime/');
expect(query).to.contain(search);
expect(url.pathname).to.eql('/app/uptime/');
expect(query).to.contain(search);

await returnTo(HOSTS_VIEW_PATH);
});

it('should navigate to APM services after click', async () => {
await pageObjects.infraHostsView.clickFlyoutApmServicesLink();
const url = parse(await browser.getCurrentUrl());

const query = decodeURIComponent(url.query ?? '');
await returnTo(HOSTS_VIEW_PATH);
});

const kuery = 'kuery=host.hostname:"Jennys-MBP.fritz.box"';
const rangeFrom = 'rangeFrom=2023-03-28T18:20:00.000Z';
const rangeTo = 'rangeTo=2023-03-28T18:21:00.000Z';
it('should navigate to APM services after click', async () => {
await pageObjects.infraHostsView.clickFlyoutApmServicesLink();
const url = parse(await browser.getCurrentUrl());
const query = decodeURIComponent(url.query ?? '');
const kuery = 'kuery=host.hostname:"Jennys-MBP.fritz.box"';

expect(url.pathname).to.eql('/app/apm/services');
expect(query).to.contain(kuery);
expect(query).to.contain(rangeFrom);
expect(query).to.contain(rangeTo);
expect(url.pathname).to.eql('/app/apm/services');
expect(query).to.contain(kuery);

await returnTo(HOSTS_VIEW_PATH);
await returnTo(HOSTS_VIEW_PATH);
});
});

describe('Processes Tab', () => {
Expand Down

0 comments on commit f071fb3

Please sign in to comment.