kibana/test/analytics
Alejandro Fernández Haro a5f5d8682e
[EBT] Add flush method and call it during stop (#144925)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Resolves https://github.com/elastic/kibana/issues/140521
2022-11-16 14:48:11 +01:00
..
fixtures/plugins [EBT] Add flush method and call it during stop (#144925) 2022-11-16 14:48:11 +01:00
services [EBT] Better FTR helper APIs (#135298) 2022-06-29 14:11:13 +02:00
tests [EBT] Add flush method and call it during stop (#144925) 2022-11-16 14:48:11 +01:00
config.ts [EBT] Better FTR helper APIs (#135298) 2022-06-29 14:11:13 +02:00
README.md [EBT] Better FTR helper APIs (#135298) 2022-06-29 14:11:13 +02:00

FTR tests for the core.analytics service

This suite allows us to test the event-based telemetry client provided by the core.analytics service.

How to add my own tests

Implement your own tests in the tests/instrumented_events/(from_the_browser|from_the_server)/ directory and list it in the tests/instrumented_events/(from_the_browser|from_the_server)/index.ts file.

There are 2 FTR helpers to allow you to retrieve the generated events:

  1. For events generated in the UI, you can use kibana_ebt_ui to retrieve the events.
  2. For events generated in the server, you can use the kibana_ebt_server helper.

The API is the same for both of them:

// To retrieve 2 events of type "my-event-type"
const events = await getService('kibana_ebt_ui').getEvents(2, { eventTypes: ['my-event-type'] });
expect(events).to...

If you are reusing these helpers in another suite, please remember to make sure to optIn via await getService('kibana_ebt_ui').setOptIn(true);

Refer to EBTHelpersContract for more details about the existing APIs and all the options they accept.