Skip to content

Commit

Permalink
[Infra UI] Hosts view test: fix apm services link (elastic#162147)
Browse files Browse the repository at this point in the history
Closes elastic#162051
Closes elastic#159368
## Summary

This PR aims to make the APM services link test more stable. For some
reason, some of the query parameters are not present in the URL the
moment we navigate but we can see in the screenshot that the correct
dates are applied (it could be that the moment we load APM the URL is
not updated - when checking locally those parameters exist in the URL)
<img width="1612" alt="image"
src="https://github.com/elastic/kibana/assets/14139027/2363108a-329e-4f28-a0d8-9f177d01d4ef">

---------

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit e98abd0)

# Conflicts:
#	x-pack/test/functional/apps/infra/hosts_view.ts
  • Loading branch information
jennypavlova committed Jul 19, 2023
1 parent 83d9c3d commit 51c93d5
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 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 ?? '');

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';
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 ?? '');
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 51c93d5

Please sign in to comment.