kibana/test/analytics/README.md
Spencer c8f83ed2eb
Move real plugins out of 'fixtures' dirs (#148756)
The location of plugins was previously somewhat irrelevant, but as we
move into packages it's more important that we can find all plugins in
the repository, and we would like to be able to do that without needing
to maintain a manifest somewhere to accomplish this. In order to make
this possible we plan to find any plugin/package by spotting all
kibana.json files which are not "fixtures". This allows plugin-like code
(but not actual plugin code) to exist for testing purposes, but it must
be within some form of "fixtures" directory, and any plugin that isn't
in a fixtures directory will be automatically pulled into the system
(though test plugins, examples, etc. will still only be loaded when the
plugin's path is passed via `--plugin-path`, the system will know about
them and use that knowledge for other things).

Since this is just a rename Operations will review and merge by EOD Jan
12th unless someone has a blocking concern.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-12 12:38:49 -07:00

1.1 KiB

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.