-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ObsUX][Infra] Create e2e Scout structure #244879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d55223d
chore: create scout structure for infra
rmyz 5d25a1c
Merge branch 'main' into 210177-infra-create-scout-structure
rmyz 428efc8
change order
rmyz 9aeffc3
Merge branch 'main' into 210177-infra-create-scout-structure
rmyz 99aee67
Merge branch 'main' into 210177-infra-create-scout-structure
rmyz 1229635
Merge branch 'main' into 210177-infra-create-scout-structure
rmyz f483558
fix
rmyz 1e3742d
Merge branch 'main' into 210177-infra-create-scout-structure
rmyz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
x-pack/solutions/observability/plugins/infra/test/scout/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # How to run tests | ||
|
|
||
| First start the servers: | ||
|
|
||
| ```bash | ||
| // ESS | ||
| node scripts/scout.js start-server --stateful | ||
|
|
||
| // Serverless | ||
| node scripts/scout.js start-server --serverless=[es|oblt|security] | ||
| ``` | ||
|
|
||
| Then you can run the parallel tests in another terminal: | ||
|
|
||
| ```bash | ||
| // ESS | ||
| npx playwright test --config x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts --project=local --grep @ess | ||
|
|
||
| // Serverless | ||
| npx playwright test --project local --config x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts --grep @svlOblt | ||
| ``` | ||
|
|
||
| Test results are available in `x-pack/solutions/observability/plugins/infra/test/scout/ui/output` |
43 changes: 43 additions & 0 deletions
43
x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import type { | ||
| ObltPageObjects, | ||
| ObltTestFixtures, | ||
| ObltWorkerFixtures, | ||
| KibanaUrl, | ||
| } from '@kbn/scout-oblt'; | ||
| import { test as base, createLazyPageObject } from '@kbn/scout-oblt'; | ||
| import { InventoryPage } from './page_objects/inventory'; | ||
|
|
||
| export interface ExtendedScoutTestFixtures extends ObltTestFixtures { | ||
| pageObjects: ObltPageObjects & { | ||
| inventoryPage: InventoryPage; | ||
| }; | ||
| } | ||
|
|
||
| export const test = base.extend<ExtendedScoutTestFixtures, ObltWorkerFixtures>({ | ||
| pageObjects: async ( | ||
| { | ||
| pageObjects, | ||
| page, | ||
| kbnUrl, | ||
| }: { | ||
| pageObjects: ExtendedScoutTestFixtures['pageObjects']; | ||
| page: ExtendedScoutTestFixtures['page']; | ||
| kbnUrl: KibanaUrl; | ||
| }, | ||
| use: (pageObjects: ExtendedScoutTestFixtures['pageObjects']) => Promise<void> | ||
| ) => { | ||
| const extendedPageObjects = { | ||
| ...pageObjects, | ||
| inventoryPage: createLazyPageObject(InventoryPage, page, kbnUrl), | ||
| }; | ||
|
|
||
| await use(extendedPageObjects); | ||
| }, | ||
| }); |
17 changes: 17 additions & 0 deletions
17
...ck/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt'; | ||
|
|
||
| export class InventoryPage { | ||
| constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {} | ||
|
|
||
| async goto() { | ||
| await this.page.goto(`${this.kbnUrl.app('metrics')}/inventory`); | ||
| await this.page.testSubj.waitForSelector('infraMetricsPage'); | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { createPlaywrightConfig } from '@kbn/scout-oblt'; | ||
|
|
||
| export default createPlaywrightConfig({ | ||
| testDir: './parallel_tests', | ||
| workers: 2, | ||
| runGlobalSetup: true, | ||
| }); | ||
12 changes: 12 additions & 0 deletions
12
x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/global_setup.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { globalSetupHook } from '@kbn/scout-oblt'; | ||
|
|
||
| globalSetupHook('Ingest data to Elasticsearch', { tag: ['@ess', '@svlOblt'] }, async ({}) => { | ||
jennypavlova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return; | ||
| }); | ||
18 changes: 18 additions & 0 deletions
18
...ions/observability/plugins/infra/test/scout/ui/parallel_tests/inventory/inventory.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { expect } from '@kbn/scout-oblt'; | ||
| import { test } from '../../fixtures'; | ||
|
|
||
| test.describe('Infrastructure Inventory', { tag: ['@ess', '@svlOblt'] }, () => { | ||
| test('Page should load', async ({ pageObjects: { inventoryPage }, browserAuth, page }) => { | ||
| await browserAuth.loginAsViewer(); | ||
| await inventoryPage.goto(); | ||
|
|
||
| await expect(page.getByTestId('breadcrumb last')).toHaveText('Infrastructure inventory'); | ||
jennypavlova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
| }); | ||
9 changes: 9 additions & 0 deletions
9
x-pack/solutions/observability/plugins/infra/test/scout/ui/tsconfig.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "extends": "@kbn/tsconfig-base/tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "target/types" | ||
| }, | ||
| "include": ["**/*"], | ||
| "kbn_references": ["@kbn/scout-oblt"], | ||
| "exclude": ["target/**/*"] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.