-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Scout] add maps test #204607
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
wayneseymour
merged 72 commits into
elastic:main
from
wayneseymour:add-scout-maps-tests
Jan 30, 2025
Merged
[Scout] add maps test #204607
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
31b2141
[Scout] add maps test
wayneseymour 0fdce95
Update first test
wayneseymour ee4c4d8
Try to add simple rendering wait and some cleanup.
wayneseymour bdca4db
drop pause
wayneseymour 8e66b0d
Drop tag and unskip test by changing auth to admin instead of viewer …
wayneseymour ddc0c25
one more
wayneseymour 6b88e36
one more
wayneseymour c2cd3a5
Apply suggestions from code review
wayneseymour 7e5dfb0
update owners
wayneseymour 56d1cb1
drop one line methods per dima
wayneseymour 8e43cfa
Drop fixtures in maps plugin, add gis page object to scout core
wayneseymour dfc483e
Drop what I think is a duplicate test and use variables to assist wit…
wayneseymour 19412a2
gis -> maps_page
wayneseymour ac59432
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour c8c4559
Add owners back
wayneseymour 1530071
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 6b95148
update docss
wayneseymour e5781f7
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 015fc4d
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 579a17b
move to new home
wayneseymour 361e760
lint
wayneseymour 3a3f6b9
fixup
wayneseymour da95304
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 32de1d1
fixup test name
wayneseymour 486b81c
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour f132623
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour e0cc6ce
Drop per cr with Dima
wayneseymour fb2aa58
I think I've addressed all the cr comments
wayneseymour 10bc54e
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour a63378c
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 909e2ee
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour c55e2d1
Update .github/CODEOWNERS
wayneseymour d2c8a8a
fixup per cr
wayneseymour 1e95b03
Merge branch 'add-scout-maps-tests' of github.com:wayneseymour/kibana…
wayneseymour c28e1b0
run scout maps tests on ci
wayneseymour be61a92
run in DA, not just stateful
wayneseymour dca9cb1
loginAsPrivilegedUser
wayneseymour 061d572
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 1b1e68e
one it block
wayneseymour ad23686
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 12e9420
terse
wayneseymour 42928b7
well this syntax worked on my local, even at slow 4g
wayneseymour f5f0d87
chore: update lazy PO util types
nickofthyme 24c1a11
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour f7e8c58
lower retry count per cr
wayneseymour 72c5fee
Apply suggestions from code review
wayneseymour 64de577
Some changes after my chat with Nick P. Thanks for the help Nick!
wayneseymour 54c23af
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour c1962a1
fixup types
wayneseymour f068aa8
docs
wayneseymour 54b3f58
fix test
wayneseymour b6b6d2b
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 2115c29
Add renderable page per cr.
wayneseymour d9c5f41
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour 3e18266
add a retry polling fn,
wayneseymour 5fd214d
goto->gotoNewMap(); supports loading a new map, without any saved obj…
wayneseymour 51f57f5
add expectation method for listing page, use it in gotoNewMap().
wayneseymour 0ce72dc
drop retryForSuccess
wayneseymour fc8c091
drop log
wayneseymour be36ffb
drop
wayneseymour a71a2b9
add msgs in case of failure.
wayneseymour 04863f6
clean up
wayneseymour d61a874
more cleanup
wayneseymour 78bede6
Merge branch 'main' into add-scout-maps-tests
elasticmachine 89b5d46
fixup nav
wayneseymour 7c058c4
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour f358e07
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour acddda0
fixup per cr
wayneseymour d05d39a
fixup per cr
wayneseymour e26299c
more cleanup
wayneseymour 75ce98a
Merge branch 'main' into add-scout-maps-tests
dmlemeshko 51f27b3
Merge branch 'main' into add-scout-maps-tests
elasticmachine 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
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
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
18 changes: 18 additions & 0 deletions
18
packages/kbn-scout/src/playwright/page_objects/maps_page.ts
nickofthyme marked this conversation as resolved.
Show resolved
Hide 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,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", 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 { ScoutPage } from '..'; | ||
|
|
||
| export class MapsPage { | ||
| constructor(private readonly page: ScoutPage) {} | ||
|
|
||
| async gotoNewMap() { | ||
| await this.page.gotoApp('maps/map'); | ||
| } | ||
| } |
43 changes: 43 additions & 0 deletions
43
packages/kbn-scout/src/playwright/page_objects/renderable_page.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", 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 { ScoutPage, expect } from '..'; | ||
|
|
||
| export class RenderablePage { | ||
| constructor(private readonly page: ScoutPage) {} | ||
|
|
||
| async waitForRender(count: number = 1): Promise<void> { | ||
| await expect(async () => await renderWait(count, this.page)).toPass({ | ||
| timeout: 10_000, | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| const RENDER_COMPLETE_SELECTOR = '[data-render-complete="true"]'; | ||
| const RENDER_COMPLETE_PENDING_SELECTOR = '[data-render-complete="false"]'; | ||
| const DATA_LOADING_SELECTOR = '[data-loading]'; | ||
|
|
||
| async function renderWait(count: number, page: ScoutPage) { | ||
| const renderCompleteLocator = page.locator(RENDER_COMPLETE_SELECTOR); | ||
| const renderPendingDataTitleLocator = page | ||
| .locator(RENDER_COMPLETE_PENDING_SELECTOR) | ||
| .and(page.locator('data-title')); | ||
| const loadingLocator = page.locator(DATA_LOADING_SELECTOR); | ||
|
|
||
| await renderCompleteLocator.waitFor({ timeout: 1000 }); | ||
| const completedElementsCount = await renderCompleteLocator.count(); | ||
|
|
||
| if (completedElementsCount < count) | ||
| throw new Error( | ||
| `${completedElementsCount} elements completed rendering, still waiting on a total of ${count} - ${await renderPendingDataTitleLocator.all()}` | ||
| ); | ||
|
|
||
| const loadingCount = await loadingLocator.count(); | ||
| if (loadingCount > 0) throw new Error(`${loadingCount} elements still loading contents`); | ||
| } |
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
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,22 @@ | ||
| ## How to run tests | ||
|
|
||
| You can drop the following in your terminal. | ||
|
|
||
| ```bash | ||
| run_tests() { | ||
| local suit_name=$1 | ||
| local config_path=$2 | ||
| local run_mode=$3 | ||
|
|
||
| echo "--- $suit_name ($run_mode) UI Tests" | ||
| if ! node scripts/scout run-tests "$run_mode" --config "$config_path"; then | ||
| echo "$suit_name: failed" | ||
| else | ||
| echo "$suit_name: passed" | ||
| fi | ||
| } | ||
|
|
||
| for run_mode in "--stateful" "--serverless=es" "--serverless=oblt" "--serverless=security"; do | ||
| run_tests "Maps" "x-pack/platform/plugins/shared/maps/ui_tests/playwright.config.ts" "$run_mode" | ||
| done | ||
| ``` |
11 changes: 11 additions & 0 deletions
11
x-pack/platform/plugins/shared/maps/ui_tests/fixtures/constants.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,11 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| export const VISIBLE_CHROME = 'kbnAppWrapper visibleChrome'; | ||
| export const HIDDEN_CHROME = 'kbnAppWrapper hiddenChrome'; | ||
| export const FULL_SCREEN_MODE = 'mapsFullScreenMode'; | ||
| export const EXIT_FULL_SCREEN = 'exitFullScreenModeButton'; |
13 changes: 13 additions & 0 deletions
13
x-pack/platform/plugins/shared/maps/ui_tests/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,13 @@ | ||
| /* | ||
| * 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'; | ||
|
|
||
| // eslint-disable-next-line import/no-default-export | ||
| export default createPlaywrightConfig({ | ||
| testDir: './tests', | ||
| }); | ||
nickofthyme marked this conversation as resolved.
Show resolved
Hide resolved
|
||
54 changes: 54 additions & 0 deletions
54
x-pack/platform/plugins/shared/maps/ui_tests/tests/full_screen_mode.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,54 @@ | ||
| /* | ||
| * 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, tags, test } from '@kbn/scout'; | ||
| import { | ||
| VISIBLE_CHROME, | ||
| HIDDEN_CHROME, | ||
| FULL_SCREEN_MODE, | ||
| EXIT_FULL_SCREEN, | ||
| } from '../fixtures/constants'; | ||
|
|
||
| test.describe( | ||
| 'Maps', | ||
| { | ||
| tag: tags.DEPLOYMENT_AGNOSTIC, | ||
| }, | ||
| () => { | ||
| test.beforeEach(async ({ browserAuth, pageObjects }) => { | ||
| await browserAuth.loginAsViewer(); | ||
| await pageObjects.maps.gotoNewMap(); | ||
| await pageObjects.renderable.waitForRender(); | ||
| }); | ||
|
|
||
| test('Full screen mode', async ({ page }) => { | ||
| const fullScreenBtn = page.getByTestId(FULL_SCREEN_MODE); | ||
| const exitFullScreenBtn = page.getByTestId(EXIT_FULL_SCREEN); | ||
| const visibleChrome = page.getByTestId(VISIBLE_CHROME); | ||
| const hiddenChrome = page.getByTestId(HIDDEN_CHROME); | ||
| const baseMapBtn = page.getByRole('button', { name: 'Basemap' }); | ||
|
|
||
| await expect(fullScreenBtn).toBeVisible(); | ||
| await expect(exitFullScreenBtn).not.toBeVisible(); | ||
| await expect(visibleChrome).toBeVisible(); | ||
| await expect(hiddenChrome).not.toBeVisible(); | ||
| await expect(baseMapBtn).toBeVisible(); | ||
|
|
||
| await fullScreenBtn.click(); | ||
|
|
||
| await expect(fullScreenBtn).not.toBeVisible(); | ||
| await expect(exitFullScreenBtn).toBeVisible(); | ||
| await expect(visibleChrome).not.toBeVisible(); | ||
| await expect(hiddenChrome).toBeVisible(); | ||
| await expect(baseMapBtn).toBeVisible(); | ||
|
|
||
| await exitFullScreenBtn.click(); | ||
|
|
||
| await expect(fullScreenBtn).toBeVisible(); | ||
| }); | ||
| } | ||
| ); |
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.