kibana/packages/kbn-journeys
Dzmitry Lemechko 8be528efb3
[kbn/journeys] fix hanging on telemetry call & improve logging (#175194)
## Summary

This PR fixes the issue causing (mostly) [login
journey](https://buildkite.com/elastic/kibana-single-user-performance/builds/12398#018d1149-cc2e-4591-a61c-176768081e2c)
stuck for 14 min waiting for Telemetry call response.


<img width="964" alt="Screenshot 2024-01-22 at 11 12 24"
src="8cadc2ec-ee84-42f6-8a0c-ad949367429c">

I believe the issue was in how we handle the Observables for request
events. I added extra comment in the particular code change.

I no longer can reproduce it, all the events are reported correctly:
<img width="964" alt="image"
src="fa2c4b27-dcf2-480b-a07f-aeb23045149a">

Logs cleaning is to log in console only performance metrics event but
not all EBT elements. Also not to report some browser errors that not
Kibana specific.


Testing:

run the following script 3-4 times
```
PERFORMANCE_ENABLE_TELEMETRY=1 node scripts/run_performance.js --journey-path x-pack/performance/journeys/login.ts
```

- script is completed without delays (e.g. doesn't hang on after hook in
TEST phase)
- telemetry requests are logged with correct counter and all finished,
e.g. `Waiting for telemetry request #2 to complete` is followed by
`Telemetry request #2 complete`
- only events started with `Report event "performance_metric"` are in
console output
2024-01-22 18:18:10 +01:00
..
journey [kbn/journeys] fix hanging on telemetry call & improve logging (#175194) 2024-01-22 18:18:10 +01:00
services [kbn/journeys] fix hanging on telemetry call & improve logging (#175194) 2024-01-22 18:18:10 +01:00
index.ts Enable APM for ES when running performance journeys (#155195) 2023-04-20 16:26:48 +02:00
jest.config.js [ftr] add first-class support for playwrite journeys (#140680) 2022-09-22 01:06:46 -07:00
kibana.jsonc [codeowners] add appex-qa for ftr-related packages (#155230) 2023-05-24 08:53:09 +02:00
package.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
README.mdx [ftr] add first-class support for playwrite journeys (#140680) 2022-09-22 01:06:46 -07:00
tsconfig.json [On-Week] Hot update of APM/EBT labels (#157093) 2023-08-31 14:36:20 +02:00

---
id: kibDevDocsOpsJourneys
slug: /kibana-dev-docs/ops/journeys
title: Journeys
description: A new style of functional test, focused on performance testing for now
tags: ['kibana', 'dev', 'contributor', 'operations', 'performance', 'functional', 'testing']
---

Journeys are a slightly newer take on Functional Tests, currently powered by [playwright](https://playwright.dev/docs).

A Journey is a single pathway through Kibana and looks something like this:

```ts
import { Journey } from '@kbn/journeys';
import { subj } from '@kbn/test-subj-selector';

export const journey = new Journey({
  esArchives: [ ... ],
  kbnArchives: [ ... ],
  scalabilitySetup: { ... },
})
  .step('Go to Discover Page', async ({ page, kbnUrl }) => {
    await page.goto(kbnUrl.get(`/app/discover`));
    await page.waitForSelector(subj('discoverDocTable'));
  })

  .step('Expand the first document', async ({ page }) => {
    const expandButtons = page.locator(subj('docTableExpandToggleColumn'));
    await expandButtons.first().click();
    await page.locator('text="Expanded document"');
  });
```