Skip to content

Commit 534c23d

Browse files
yngrdynCAWilson94
authored andcommitted
[onboarding] k8 e2e stop relying on panel id (elastic#234451)
onboarding ensemble test [were failing](https://github.com/elastic/ensemble/actions/runs/17572338291/attempts/1) due to us relying in the id panel of the dashboard to assert data was ingested. This PR aims to make the test more robust by localising the specific panel using css selectors. In addition I improved the `README` and added some hints for local runs in `x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/stateful/kubernetes_otel.spec.ts`
1 parent 269b8e0 commit 534c23d

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,10 @@ ARTIFACTS_FOLDER = ./.playwright
2121
# Assuming the working directory is the root of the Kibana repo
2222
npx playwright test -c ./x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/playwright.config.ts --project stateful --reporter list --headed
2323
```
24-
1. Once the test reaches one of the required manual steps, like executing auto-detect command snippet, do the step manually.
25-
2. The test will proceed once the manual step is done.
24+
For running a specific test, use the following command
25+
```
26+
npx playwright test -c ./x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/playwright.config.ts --reporter list --headed x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/stateful/$
27+
```
28+
29+
2. Once the test reaches one of the required manual steps, like executing auto-detect command snippet, do the step manually.
30+
3. The test will proceed once the manual step is done.

x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/stateful/kubernetes_otel.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import { assertEnv } from '../lib/assert_env';
1212
import { OtelKubernetesOverviewDashboardPage } from './pom/pages/otel_kubernetes_overview_dashboard.page';
1313
import { ApmServiceInventoryPage } from './pom/pages/apm_service_inventory.page';
1414

15+
/**
16+
* In case you need to run this test locally, you can use https://github.com/elastic/oblt-reference-stack
17+
* to spin up a local k8s cluster with the required resources.
18+
*/
19+
1520
test.beforeEach(async ({ page }) => {
1621
await page.goto(`${process.env.KIBANA_BASE_URL}/app/observabilityOnboarding`);
1722
});

x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/stateful/pom/pages/otel_kubernetes_overview_dashboard.page.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,16 @@ import { expect, type Page, type Locator } from '@playwright/test';
1010
export class OtelKubernetesOverviewDashboardPage {
1111
page: Page;
1212

13-
private readonly nodesPanelValue: Locator;
13+
private readonly metricPanelValues: Locator;
1414

1515
constructor(page: Page) {
1616
this.page = page;
1717

18-
this.nodesPanelValue = this.page.locator(
19-
`#panel-6119419c-1899-4765-aed4-c050cde4c30a .echMetricText__value`
20-
);
18+
this.metricPanelValues = this.page.locator(`[id^=panel] .echMetricText__value`);
2119
}
2220

2321
async assertNodesPanelNotEmpty() {
24-
await expect(this.nodesPanelValue).toBeVisible();
25-
expect(await this.nodesPanelValue.textContent()).toMatch(/\d+/);
22+
await expect(this.metricPanelValues.first()).toBeVisible();
23+
expect(await this.metricPanelValues.first().textContent()).toMatch(/\d+/);
2624
}
2725
}

0 commit comments

Comments
 (0)