Skip to content

Commit 39ed1c0

Browse files
authored
[ObsUX][Infra] Create e2e Scout structure (#244879)
## Summary Closes #210177 This PR scaffolds the basic structure for E2E Scout tests for Infra plugin.
1 parent 60dfb0f commit 39ed1c0

File tree

8 files changed

+138
-1
lines changed

8 files changed

+138
-1
lines changed

.buildkite/scout_ci_config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ plugins:
55
- console
66
- discover_enhanced
77
- index_management
8+
- infra
89
- maps
910
- observability
1011
- observability_onboarding
1112
- painless_lab
1213
- profiling
1314
- security_solution
14-
- streams_app
1515
- slo
16+
- streams_app
1617
- workflows_extensions
1718
disabled:
1819

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# How to run tests
2+
3+
First start the servers:
4+
5+
```bash
6+
// ESS
7+
node scripts/scout.js start-server --stateful
8+
9+
// Serverless
10+
node scripts/scout.js start-server --serverless=[es|oblt|security]
11+
```
12+
13+
Then you can run the parallel tests in another terminal:
14+
15+
```bash
16+
// ESS
17+
npx playwright test --config x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts --project=local --grep @ess
18+
19+
// Serverless
20+
npx playwright test --project local --config x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts --grep @svlOblt
21+
```
22+
23+
Test results are available in `x-pack/solutions/observability/plugins/infra/test/scout/ui/output`
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import type {
9+
ObltPageObjects,
10+
ObltTestFixtures,
11+
ObltWorkerFixtures,
12+
KibanaUrl,
13+
} from '@kbn/scout-oblt';
14+
import { test as base, createLazyPageObject } from '@kbn/scout-oblt';
15+
import { InventoryPage } from './page_objects/inventory';
16+
17+
export interface ExtendedScoutTestFixtures extends ObltTestFixtures {
18+
pageObjects: ObltPageObjects & {
19+
inventoryPage: InventoryPage;
20+
};
21+
}
22+
23+
export const test = base.extend<ExtendedScoutTestFixtures, ObltWorkerFixtures>({
24+
pageObjects: async (
25+
{
26+
pageObjects,
27+
page,
28+
kbnUrl,
29+
}: {
30+
pageObjects: ExtendedScoutTestFixtures['pageObjects'];
31+
page: ExtendedScoutTestFixtures['page'];
32+
kbnUrl: KibanaUrl;
33+
},
34+
use: (pageObjects: ExtendedScoutTestFixtures['pageObjects']) => Promise<void>
35+
) => {
36+
const extendedPageObjects = {
37+
...pageObjects,
38+
inventoryPage: createLazyPageObject(InventoryPage, page, kbnUrl),
39+
};
40+
41+
await use(extendedPageObjects);
42+
},
43+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
9+
10+
export class InventoryPage {
11+
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}
12+
13+
async goto() {
14+
await this.page.goto(`${this.kbnUrl.app('metrics')}/inventory`);
15+
await this.page.testSubj.waitForSelector('infraMetricsPage');
16+
}
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { createPlaywrightConfig } from '@kbn/scout-oblt';
9+
10+
export default createPlaywrightConfig({
11+
testDir: './parallel_tests',
12+
workers: 2,
13+
runGlobalSetup: true,
14+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { globalSetupHook } from '@kbn/scout-oblt';
9+
10+
globalSetupHook('Ingest data to Elasticsearch', { tag: ['@ess', '@svlOblt'] }, async ({}) => {
11+
return;
12+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { expect } from '@kbn/scout-oblt';
9+
import { test } from '../../fixtures';
10+
11+
test.describe('Infrastructure Inventory', { tag: ['@ess', '@svlOblt'] }, () => {
12+
test('Page should load', async ({ pageObjects: { inventoryPage }, browserAuth, page }) => {
13+
await browserAuth.loginAsViewer();
14+
await inventoryPage.goto();
15+
16+
await expect(page.getByTestId('breadcrumb last')).toHaveText('Infrastructure inventory');
17+
});
18+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "@kbn/tsconfig-base/tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "target/types"
5+
},
6+
"include": ["**/*"],
7+
"kbn_references": ["@kbn/scout-oblt"],
8+
"exclude": ["target/**/*"]
9+
}

0 commit comments

Comments
 (0)