Commit 799f6f1
[APM][Scout] Stabilize service map embeddable test panel time range (#268459)
## Summary
Fixes the flaky **Service map embeddable** Scout test by removing the
implicit dependency on wall-clock drift between global setup and test
execution.
### Why it was flaky
- Global setup ingests \`serviceMapMultiEnv\` synthtrace data at
\`now-15m..now\` (anchored to the moment global setup runs).
- The Service Map embeddable factory hard-codes a panel-level default
\`time_range: { from: 'now-15m', to: 'now' }\` that overrides the
dashboard's range, and that range **cannot be configured from the
editor flyout** at panel creation time.
- For the panel's window to contain the synth window, the entire
parallel suite (global setup + everything that runs before this spec)
has to complete in well under ~15 minutes. Once the cumulative
\`testNow - setupNow\` drift exceeds the 15-minute panel window, the
synth data slides fully outside the panel's range and
\`service-map-test\`:
- disappears from the \`/internal/apm/suggestions\` response → the
\`apmServiceMapEditorServiceNameComboBox\` option never appears →
\`selectSingleOption\` times out (the original failure in #265639), or
- is still selectable but the rendered service map shows
"No services available" → the
\`serviceMapNode-service-service-map-test\` visibility assertion
times out.
### Why we have to use the edit flow
The editor flyout exposes only \`service_name\`, \`environment\` and
\`kuery\`; it has no UI for \`time_range\`. The factory always seeds the
new panel with the 15-minute default, so the only way to widen the
panel's queried window is the dashboard-level **Customize panel** flow
*after* the panel exists. To make that widened window actually take
effect for the suggestions endpoint, we then have to re-open the editor
in **edit** mode — \`onEdit\` passes
\`timeRangeManager.api.timeRange\$.getValue()\` (now 24h) into the
flyout, so the combo boxes' suggestions are resolved in the wider
window. We can't apply the filters first and widen later, because the
first \`selectSingleOption\` is exactly what was failing.
### What changed
\`x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/service_map/service_map_embeddable.spec.ts\`:
1. Add the Service Map panel **without filters** (just save the empty
editor) → panel exists with the factory's default 15-minute custom
range and the \`CUSTOM_TIME_RANGE_BADGE\` is asserted.
2. Open the **Customize panel** flyout, ensure the custom time range
toggle is on, set the panel's range to **Last 24 hours** via the
panel-scoped \`superDatePicker\` quick menu, save.
3. Re-open the editor in **edit** mode via
\`embeddablePanelAction-editPanel\` and apply
\`service_name\` / \`environment\` / \`kuery\`. With the 24h panel
range, the \`apmServiceMapEditorServiceNameComboBox\` reliably
resolves \`service-map-test\` even with realistic setup-to-test
delay.
4. The remaining assertions (visibility, popover, maximize, fills,
disable-custom-time-range, View full service map) run against the
24h panel range, so they no longer depend on the 15-minute synth
window aligning with wall-clock \"now\".
\`global.setup.ts\` is unchanged — synth still ingests at
\`now-15m..now\`. 24h easily covers any realistic delay between global
setup and this spec running.
## References
Closes #265639
## Test plan
- [ ] CI green
- [ ] Local run: \`npx playwright test --config
x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts
--project local --grep stateful-classic
x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/service_map/service_map_embeddable.spec.ts\`
- [ ] Repeat-each smoke (\`--repeat-each=10\`) to confirm flake is gone
Made with [Cursor](https://cursor.com)
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 2051ced commit 799f6f1
1 file changed
Lines changed: 42 additions & 4 deletions
File tree
- x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/service_map
Lines changed: 42 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
76 | 117 | | |
77 | 118 | | |
78 | 119 | | |
| |||
114 | 155 | | |
115 | 156 | | |
116 | 157 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | 158 | | |
121 | 159 | | |
122 | 160 | | |
| |||
0 commit comments