-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Lens] Init scout and add should display ES|QL conversion modal test
#249819
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 all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
29857d9
[Lens] Init scout
mariairiartef b0d1874
[Lens] Add initial test fixtures and tests for Lens functionality
mariairiartef ff30b78
Add test dashboard
mariairiartef a0a41c3
Merge branch 'main' into lens/init-scout
mariairiartef 9c505ea
Add dashboard app methods: switchToEditMode and openInLineEditor
mariairiartef ba56fa7
Changes from node scripts/lint_ts_projects --fix
kibanamachine d95df24
Fix eslint issue
mariairiartef a2fc983
Fix typo
mariairiartef e93e84f
Update readme file
mariairiartef 8a414ac
Remove unnecessary wait for edit button visibility in DashboardApp
mariairiartef 7cc9b0e
Move LensApp to share page objects folder
mariairiartef a9081a2
Update openInlineEditor method name
mariairiartef ff7897c
Skip Lens ES|QL test until issue 2740 is resolved
mariairiartef 0988a18
Merge branch 'main' into lens/init-scout
mariairiartef 5a78469
Fix typo
mariairiartef a74e3b4
Merge branch 'main' into lens/init-scout
mariairiartef 6775615
Unskip test and set feature flag via core plugin api
mariairiartef c2b5f5d
Remove journey
mariairiartef 309aec8
Merge branch 'main' into lens/init-scout
mariairiartef f53a308
Merge branch 'main' into lens/init-scout
mariairiartef c026ca7
Merge branch 'main' into lens/init-scout
mariairiartef 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ plugins: | |
| - transform | ||
| - fleet | ||
| - entity_store | ||
| - lens | ||
| disabled: | ||
|
|
||
| packages: | ||
|
|
||
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
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
26 changes: 26 additions & 0 deletions
26
src/platform/packages/shared/kbn-scout/src/playwright/page_objects/lens_app.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,26 @@ | ||
| /* | ||
| * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| import type { ScoutPage } from '..'; | ||
|
|
||
| export class LensApp { | ||
| constructor(private readonly page: ScoutPage) {} | ||
|
|
||
|
dmlemeshko marked this conversation as resolved.
|
||
| getConvertToEsqlButton() { | ||
| return this.page.getByRole('button', { name: 'Convert to ES|QL' }); | ||
| } | ||
|
|
||
| getConvertToEsqModal() { | ||
| return this.page.getByTestId('lnsConvertToEsqlModal'); | ||
| } | ||
|
|
||
| getConvertToEsqModalConfirmButton() { | ||
| return this.page.getByTestId('confirmModalConfirmButton'); | ||
| } | ||
| } | ||
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
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
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,15 @@ | ||
| # Lens Scout tests | ||
|
|
||
| This directory contains Scout tests for the Lens plugin. | ||
|
|
||
| ## Running the tests | ||
|
|
||
| ### Run server | ||
| ``` | ||
| node scripts/scout.js start-server --stateful | ||
| ``` | ||
|
|
||
| ### Run tests | ||
| ``` | ||
| npx playwright test --project local --grep @ess --config x-pack/platform/plugins/shared/lens/test/scout/ui/ --ui | ||
| ``` |
69 changes: 69 additions & 0 deletions
69
x-pack/platform/plugins/shared/lens/test/scout/ui/fixtures/esql_conversion_dashboard.json
|
mariairiartef marked this conversation as resolved.
|
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,69 @@ | ||
| { | ||
| "attributes": { | ||
| "allowHidden": false, | ||
| "fieldAttrs": "{}", | ||
| "fieldFormatMap": "{}", | ||
| "fields": "[]", | ||
| "name": "logstash-*", | ||
| "runtimeFieldMap": "{}", | ||
| "sourceFilters": "[]", | ||
| "timeFieldName": "@timestamp", | ||
| "title": "logstash-*" | ||
| }, | ||
| "coreMigrationVersion": "8.8.0", | ||
| "created_at": "2026-01-23T15:58:55.175Z", | ||
| "created_by": "u_EWATCHX9oIEsmcXj8aA1FkcaY3DE-XEpsiGTjrR2PmM_0", | ||
| "id": "7d4752fe-05bd-4472-9bcb-fb347412f558", | ||
| "managed": false, | ||
| "references": [], | ||
| "type": "index-pattern", | ||
| "typeMigrationVersion": "8.0.0", | ||
| "updated_at": "2026-01-23T15:58:55.175Z", | ||
| "updated_by": "u_EWATCHX9oIEsmcXj8aA1FkcaY3DE-XEpsiGTjrR2PmM_0", | ||
| "version": "WzI4LDFd" | ||
| } | ||
|
|
||
| { | ||
| "accessControl": { | ||
| "accessMode": "default", | ||
| "owner": "u_EWATCHX9oIEsmcXj8aA1FkcaY3DE-XEpsiGTjrR2PmM_0" | ||
| }, | ||
| "attributes": { | ||
| "controlGroupInput": { | ||
| "panelsJSON": "{}" | ||
| }, | ||
| "description": "", | ||
| "kibanaSavedObjectMeta": { | ||
| "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"}}" | ||
| }, | ||
| "optionsJSON": "{\"hidePanelTitles\":false,\"useMargins\":true,\"autoApplyFilters\":true,\"syncColors\":false,\"syncCursor\":true,\"syncTooltips\":false}", | ||
| "panelsJSON": "[{\"type\":\"lens\",\"embeddableConfig\":{\"enhancements\":{\"dynamicActions\":{\"events\":[]}},\"syncColors\":false,\"syncCursor\":true,\"syncTooltips\":false,\"filters\":[],\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"attributes\":{\"title\":\"\",\"visualizationType\":\"lnsMetric\",\"type\":\"lens\",\"references\":[{\"type\":\"index-pattern\",\"id\":\"7d4752fe-05bd-4472-9bcb-fb347412f558\",\"name\":\"indexpattern-datasource-layer-956270fb-67f2-4b48-a24d-333a205a1993\"}],\"state\":{\"visualization\":{\"layerId\":\"956270fb-67f2-4b48-a24d-333a205a1993\",\"layerType\":\"data\",\"metricAccessor\":\"940aaabc-f1f5-4a45-8d44-0dfeee27ee7a\",\"maxAccessor\":\"14999fb7-ede6-49d8-9ebd-eba41ae6e780\",\"showBar\":true,\"secondaryTrend\":{\"type\":\"none\"},\"secondaryLabelPosition\":\"before\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"datasourceStates\":{\"formBased\":{\"layers\":{\"956270fb-67f2-4b48-a24d-333a205a1993\":{\"columns\":{\"940aaabc-f1f5-4a45-8d44-0dfeee27ee7a\":{\"label\":\"Average of bytes\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"bytes\",\"isBucketed\":false,\"params\":{\"emptyAsNull\":true}},\"14999fb7-ede6-49d8-9ebd-eba41ae6e780\":{\"label\":\"Static value: 10000\",\"dataType\":\"number\",\"operationType\":\"static_value\",\"isBucketed\":false,\"params\":{\"value\":\"10000\",\"emptyAsNull\":true},\"references\":[]}},\"columnOrder\":[\"940aaabc-f1f5-4a45-8d44-0dfeee27ee7a\",\"14999fb7-ede6-49d8-9ebd-eba41ae6e780\"],\"incompleteColumns\":{},\"sampling\":1}}},\"indexpattern\":{\"layers\":{}},\"textBased\":{\"layers\":{}}},\"internalReferences\":[],\"adHocDataViews\":{}},\"version\":1}},\"panelIndex\":\"fb4626b8-d8ce-42d3-913a-081af94cfb51\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"fb4626b8-d8ce-42d3-913a-081af94cfb51\"}}]", | ||
| "timeRestore": false, | ||
| "title": "ES|QL Conversion Dashboard" | ||
| }, | ||
| "coreMigrationVersion": "8.8.0", | ||
| "created_at": "2026-01-23T16:04:55.656Z", | ||
| "created_by": "u_EWATCHX9oIEsmcXj8aA1FkcaY3DE-XEpsiGTjrR2PmM_0", | ||
| "id": "3cda479c-8797-4492-99f4-2259e1377f85", | ||
| "managed": false, | ||
| "references": [ | ||
| { | ||
| "id": "7d4752fe-05bd-4472-9bcb-fb347412f558", | ||
| "name": "fb4626b8-d8ce-42d3-913a-081af94cfb51:indexpattern-datasource-layer-956270fb-67f2-4b48-a24d-333a205a1993", | ||
| "type": "index-pattern" | ||
| } | ||
| ], | ||
| "type": "dashboard", | ||
| "typeMigrationVersion": "10.3.0", | ||
| "updated_at": "2026-01-23T16:04:55.656Z", | ||
| "updated_by": "u_EWATCHX9oIEsmcXj8aA1FkcaY3DE-XEpsiGTjrR2PmM_0", | ||
| "version": "WzM0LDFd" | ||
| } | ||
|
|
||
| { | ||
| "excludedObjects": [], | ||
| "excludedObjectsCount": 0, | ||
| "exportedCount": 2, | ||
| "missingRefCount": 0, | ||
| "missingReferences": [] | ||
| } |
12 changes: 12 additions & 0 deletions
12
x-pack/platform/plugins/shared/lens/test/scout/ui/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,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 { createPlaywrightConfig } from '@kbn/scout'; | ||
|
|
||
| export default createPlaywrightConfig({ | ||
| testDir: './tests', | ||
| }); | ||
|
Comment on lines
+10
to
+12
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since Lens support Spaces, is it possible to consider running tests in space isolation and in parallel? It will be ~30-40% faster based on current metrics. |
||
81 changes: 81 additions & 0 deletions
81
x-pack/platform/plugins/shared/lens/test/scout/ui/tests/esql_conversion.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,81 @@ | ||
| /* | ||
| * 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'; | ||
|
|
||
| import { test } from '@kbn/scout'; | ||
|
|
||
| const ES_ARCHIVES = { | ||
| LOGSTASH: 'x-pack/platform/test/fixtures/es_archives/logstash_functional', | ||
| }; | ||
|
|
||
| const DATA_VIEW_ID = { | ||
| LOGSTASH: 'logstash-*', | ||
| }; | ||
|
|
||
| const LOGSTASH_IN_RANGE_DATES = { | ||
| from: 'Sep 19, 2015 @ 06:31:44.000', | ||
| to: 'Sep 23, 2015 @ 18:31:44.000', | ||
| }; | ||
|
|
||
| const KBN_ARCHIVES = { | ||
| ESQL_CONVERSION_DASHBOARD: | ||
| 'x-pack/platform/plugins/shared/lens/test/scout/ui/fixtures/esql_conversion_dashboard.json', | ||
| }; | ||
| const ESQL_CONVERSION_DASHBOARD_TEST_ID = 'dashboardListingTitleLink-ES|QL-Conversion-Dashboard'; | ||
| const METRIC_VISUALIZATION_ID = 'fb4626b8-d8ce-42d3-913a-081af94cfb51'; | ||
|
|
||
| test.describe('Lens ES|QL', { tag: ['@ess'] }, () => { | ||
| test.beforeAll(async ({ esArchiver, kbnClient, uiSettings, apiServices }) => { | ||
| await apiServices.core.settings({ | ||
| 'feature_flags.overrides': { | ||
| 'lens.enable_esql_conversion': 'true', | ||
| }, | ||
| }); | ||
| await esArchiver.loadIfNeeded(ES_ARCHIVES.LOGSTASH); | ||
| await kbnClient.importExport.load(KBN_ARCHIVES.ESQL_CONVERSION_DASHBOARD); | ||
| await uiSettings.set({ | ||
| defaultIndex: DATA_VIEW_ID.LOGSTASH, | ||
| 'dateFormat:tz': 'UTC', | ||
| 'timepicker:timeDefaults': `{ "from": "${LOGSTASH_IN_RANGE_DATES.from}", "to": "${LOGSTASH_IN_RANGE_DATES.to}"}`, | ||
| }); | ||
| }); | ||
|
|
||
| test.afterAll(async ({ kbnClient, uiSettings }) => { | ||
| await uiSettings.unset('defaultIndex', 'dateFormat:tz', 'timepicker:timeDefaults'); | ||
| await kbnClient.savedObjects.cleanStandardList(); | ||
| }); | ||
|
|
||
| test('should display ES|QL conversion modal', async ({ browserAuth, page, pageObjects }) => { | ||
| await browserAuth.loginAsPrivilegedUser(); | ||
|
|
||
| const { dashboard, lens } = pageObjects; | ||
|
|
||
| // Navigate to the test dashboard | ||
| await dashboard.goto(); | ||
| await page.getByTestId(ESQL_CONVERSION_DASHBOARD_TEST_ID).click(); | ||
|
|
||
| // Verify dashboard loaded with the test visualization | ||
| await dashboard.waitForPanelsToLoad(1); | ||
|
|
||
| // Enter edit mode to access visualization actions | ||
| await dashboard.switchToEditMode(); | ||
|
|
||
| await dashboard.openInlineEditor(METRIC_VISUALIZATION_ID); | ||
|
|
||
| await lens.getConvertToEsqlButton().click(); | ||
|
|
||
| await expect(lens.getConvertToEsqModal()).toBeVisible(); | ||
|
|
||
| await lens.getConvertToEsqModalConfirmButton().click(); | ||
|
|
||
| await expect(lens.getConvertToEsqModal()).toBeHidden(); | ||
|
|
||
| // TODO: Add conversion assertions once logic is implemented (https://github.com/elastic/kibana/pull/248078) | ||
| // For now, this test only verifies the UI flow up to modal interaction | ||
| }); | ||
| }); |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Just a heads up, my PR #249233 is also adding a Lens object. Expect to see some changes in this page object if my PR is merged after yours (I'm hoping that's the case so you don't have to go through merge conflict resolution).