Skip to content

[Discover] [Metrics] Add tier 2 journeys for Metrics in Discover E2E#255036

Merged
justinkambic merged 64 commits intoelastic:mainfrom
justinkambic:5219/e2e-tier-2-coverage
Mar 18, 2026
Merged

[Discover] [Metrics] Add tier 2 journeys for Metrics in Discover E2E#255036
justinkambic merged 64 commits intoelastic:mainfrom
justinkambic:5219/e2e-tier-2-coverage

Conversation

@justinkambic
Copy link
Copy Markdown
Contributor

@justinkambic justinkambic commented Feb 26, 2026

Summary

Related to https://github.com/elastic/observability-dev/issues/5219.

Implements Tier 2 E2E coverage for Discover Metrics journeys, aligned with the existing metrics_experience test architecture and config pattern.

Adds two new parallel Scout specs in metrics_experience:

  • query_kickstart.spec.ts: validates recommended-query kickstart behavior from the ES|QL help flow, with environment-aware handling when Search all metrics is unavailable and Search all fields is shown.
  • breakdown_by_dimension.spec.ts: validates that selecting “Breakdown by dimension” from the field list is reflected in the metrics toolbar and preserves metrics grid rendering.

This patch introduces coverage for the two unblocked journeys, but does not yet implement the "switch between tabs" third journey, which is blocked by #251637.

Test Plan

Validated via Scout metrics parallel config:

node scripts/scout.js run-tests --arch stateful --domain classic --config src/platform/plugins/shared/discover/test/scout/ui/metrics_experience_parallel.playwright.config.ts

Result on latest run:

All tests pass: 36 passed, 8 skipped, 0 failed. Exit code 0.

…eakdown flow. Add metrics-experience Scout coverage for ES|QL recommended-query kickstart and field-list breakdown-by-dimension journeys. Extend Scout page objects/constants with stable helpers and selectors so the new tests run reliably across the metrics parallel suite.
@justinkambic justinkambic self-assigned this Feb 26, 2026
@justinkambic justinkambic added release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels Team:obs-exploration Observability Exploration team v9.4.0 labels Feb 26, 2026
@lucaslopezf
Copy link
Copy Markdown
Contributor

Thanks Justin!! Just FYI: I've marked the task as blocked by this PR
to avoid too many conflicts or duplicate work (it’s ready, but I’m pending resolution of this, which is the more important one, and I’m also expecting feedback from the AppEx team). Besides that, we can move forward with this PR since I don’t see many conflicts later, but only after merging the flaky one, as I believe it’s a common issue affecting the entire E2E metrics stack

- Moved recommended ESQL query handling and sidebar breakdown field methods from DiscoverApp to DiscoverActions for better separation of concerns.
- Updated tests to utilize the new DiscoverActions class for running recommended queries and adding breakdown fields.
- Ensured that the DiscoverActions class is properly integrated into the existing test fixtures and page objects.
- Removed fallback query handling from the runRecommendedEsqlQuery method for simplification.
- Updated related tests to reflect the changes in the query execution logic.
- Cleaned up constants by removing unused SEARCH_ALL_FIELDS_FALLBACK label.

This refactor enhances the clarity and maintainability of the code.
@justinkambic justinkambic marked this pull request as ready for review March 10, 2026 15:27
@justinkambic justinkambic requested a review from a team as a code owner March 10, 2026 15:27
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-exploration-team (Team:obs-exploration)

@lucaslopezf
Copy link
Copy Markdown
Contributor

/flaky scoutConfig:src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts:30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11041

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x30

@justinkambic
Copy link
Copy Markdown
Contributor Author

I pushed a change that I thought was minor but seems to have broken the test. Working on a fix, will push again soon.

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#11041

[❌] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 0/30 tests passed.

see run history

- Introduced RECOMMENDED_QUERY_TAGS constant to enhance query handling.
- Updated DiscoverActions to include a timeout for query visibility checks.
- Modified query_kickstart.spec to utilize the new RECOMMENDED_QUERY_TAGS for improved test accuracy.
@justinkambic justinkambic force-pushed the 5219/e2e-tier-2-coverage branch from 300941d to 9d54490 Compare March 10, 2026 17:27
@justinkambic
Copy link
Copy Markdown
Contributor Author

/flaky scoutConfig:src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts:30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11045

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#11045

[❌] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 0/30 tests passed.

see run history

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11138

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#11138

[❌] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 23/30 tests passed.

see run history

@justinkambic
Copy link
Copy Markdown
Contributor Author

This PR is failing the flaky test runner. It looks like the majority of the failures took place due to grid.spec.ts.

Failure example.

setCommonlyUsedTime does not wait for the search to finish after changing the time range. When Discover re-executes the ES|QL query, fetchParams.timeRange changes, triggering useFetchMetricsData to call executeFetch().

  • The useAsyncFn hook (from react-use) resets value to undefined when a new async call begins.
  • This causes metricItems to become [] (via value?.metricItems ?? [] at line 109 of use_fetch_metrics_data.ts).
  • In MetricsExperienceGrid (line 117), the condition metricItems.length === 0 && isDiscoverLoading becomes true.
  • The grid is completely unmounted from the DOM and replaced with <EmptyState>.
  • The default 10s Playwright timeout is insufficient for the re-fetch to complete in CI.

We did not modify this file as part of this set of changes. Should I try to modify the file in here to prevent the flakiness?

@justinkambic
Copy link
Copy Markdown
Contributor Author

/flaky scoutConfig:src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts:30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11140

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x30

@elastic elastic deleted a comment from kibanamachine Mar 18, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#11140

[❌] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 26/30 tests passed.

see run history

@lucaslopezf
Copy link
Copy Markdown
Contributor

/flaky scoutConfig:src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts:30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11145

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x30

@lucaslopezf
Copy link
Copy Markdown
Contributor

This PR is failing the flaky test runner. It looks like the majority of the failures took place due to grid.spec.ts.

Failure example.

setCommonlyUsedTime does not wait for the search to finish after changing the time range. When Discover re-executes the ES|QL query, fetchParams.timeRange changes, triggering useFetchMetricsData to call executeFetch().

  • The useAsyncFn hook (from react-use) resets value to undefined when a new async call begins.
  • This causes metricItems to become [] (via value?.metricItems ?? [] at line 109 of use_fetch_metrics_data.ts).
  • In MetricsExperienceGrid (line 117), the condition metricItems.length === 0 && isDiscoverLoading becomes true.
  • The grid is completely unmounted from the DOM and replaced with <EmptyState>.
  • The default 10s Playwright timeout is insufficient for the re-fetch to complete in CI.

We did not modify this file as part of this set of changes. Should I try to modify the file in here to prevent the flakiness?

Not related with this PR, fixed here

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#11145

[✅] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 30/30 tests passed.

see run history

…queries

- Removed unnecessary visibility check for the panel title button.
- Simplified the wait for the panel title button to use a direct locator call.
- Improved code clarity and efficiency in handling recommended queries.
- Removed unnecessary visibility check for the breakdown button.
- Streamlined the process of clicking on fields and handling the field popover.
- Improved code clarity and efficiency in the Discover app's interaction logic.
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

cc @justinkambic

@justinkambic
Copy link
Copy Markdown
Contributor Author

/flaky scoutConfig:src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts:30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11161

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#11161

[✅] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 30/30 tests passed.

see run history

@justinkambic justinkambic merged commit da2bcdd into elastic:main Mar 18, 2026
18 checks passed
@kibanamachine kibanamachine added backport:skip This PR does not require backporting and removed backport:version Backport to applied version labels labels Mar 18, 2026
mbondyra added a commit to mbondyra/kibana that referenced this pull request Mar 19, 2026
…d_agent_navigation2

* commit '9289d6b5502db245e645e190b0246554396c6c20': (34 commits)
  [api-docs] 2026-03-19 Daily api_docs build (elastic#258471)
  [Shared UX][DateRangePicker] Missing parts (elastic#258229)
  [Dashboard] Keep pinned_panels separate in read response (elastic#258444)
  Move inheritance: true to top level in .coderabbit.yml (elastic#258461)
  [DOCS] 9.3.2 Kibana release notes (elastic#257332)
  adds routing accept metric attribute to the cps metric (elastic#258168)
  [ML] AI/Inference Connector creation: use 'location' field to correctly set provider config  (elastic#250838)
  [Lens] Add e2e test for legend list layout (elastic#258160)
  [SigEvents] Convert feature duplication evaluators to createPrompt pattern (elastic#256534)
  Add actionable-obs author to .coderabbit.yml (elastic#257922)
  [DOCS] 9.2.7 Kibana release notes (elastic#257331)
  Grant Serverless editor/viewer access to ES v2 indices (elastic#258384)
  [SigEvents][Evals] Rename terminology for KI features and KI queries (elastic#258361)
  [EDR Workflows][Osquery] Add shared table toolbar components and redesign saved queries list (elastic#258394)
  [Automatic Import V2] Upload samples using an existing index (elastic#258074)
  Add GET /inference_features route to expose feature registry (elastic#258044)
  fix additional fields not included (elastic#257625)
  [Discover] [Metrics] Add tier 2 journeys for Metrics in Discover E2E (elastic#255036)
  [Lens as code] Support correct X-Axis types in ES|QL visualizations (elastic#258159)
  Update APM (main) (elastic#254880)
  ...
flash1293 pushed a commit to flash1293/kibana that referenced this pull request Mar 19, 2026
…lastic#255036)

## Summary

Related to elastic/observability-dev#5219.

Implements Tier 2 E2E coverage for Discover Metrics journeys, aligned
with the existing metrics_experience test architecture and config
pattern.

Adds two new parallel Scout specs in metrics_experience:

- `query_kickstart.spec.ts`: validates recommended-query kickstart
behavior from the ES|QL help flow, with environment-aware handling when
Search all metrics is unavailable and Search all fields is shown.
- `breakdown_by_dimension.spec.ts`: validates that selecting “Breakdown
by dimension” from the field list is reflected in the metrics toolbar
and preserves metrics grid rendering.

This patch introduces coverage for the two unblocked journeys, but does
not yet implement the "switch between tabs" third journey, which is
blocked by elastic#251637.

## Test Plan
Validated via Scout metrics parallel config:
```
node scripts/scout.js run-tests --arch stateful --domain classic --config src/platform/plugins/shared/discover/test/scout/ui/metrics_experience_parallel.playwright.config.ts
```

Result on latest run:
```
All tests pass: 36 passed, 8 skipped, 0 failed. Exit code 0.
```

---------

Co-authored-by: Lucas Francisco López <lucaslopezf@gmail.com>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
…lastic#255036)

## Summary

Related to elastic/observability-dev#5219.

Implements Tier 2 E2E coverage for Discover Metrics journeys, aligned
with the existing metrics_experience test architecture and config
pattern.

Adds two new parallel Scout specs in metrics_experience:

- `query_kickstart.spec.ts`: validates recommended-query kickstart
behavior from the ES|QL help flow, with environment-aware handling when
Search all metrics is unavailable and Search all fields is shown.
- `breakdown_by_dimension.spec.ts`: validates that selecting “Breakdown
by dimension” from the field list is reflected in the metrics toolbar
and preserves metrics grid rendering.

This patch introduces coverage for the two unblocked journeys, but does
not yet implement the "switch between tabs" third journey, which is
blocked by elastic#251637.

## Test Plan
Validated via Scout metrics parallel config:
```
node scripts/scout.js run-tests --arch stateful --domain classic --config src/platform/plugins/shared/discover/test/scout/ui/metrics_experience_parallel.playwright.config.ts
```

Result on latest run:
```
All tests pass: 36 passed, 8 skipped, 0 failed. Exit code 0.
```

---------

Co-authored-by: Lucas Francisco López <lucaslopezf@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-exploration Observability Exploration team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants