Skip to content
Merged
Show file tree
Hide file tree
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 Dec 17, 2024
0fdce95
Update first test
wayneseymour Dec 18, 2024
ee4c4d8
Try to add simple rendering wait and some cleanup.
wayneseymour Dec 18, 2024
bdca4db
drop pause
wayneseymour Dec 18, 2024
8e66b0d
Drop tag and unskip test by changing auth to admin instead of viewer …
wayneseymour Dec 18, 2024
ddc0c25
one more
wayneseymour Dec 18, 2024
6b88e36
one more
wayneseymour Dec 18, 2024
c2cd3a5
Apply suggestions from code review
wayneseymour Dec 18, 2024
7e5dfb0
update owners
wayneseymour Dec 18, 2024
56d1cb1
drop one line methods per dima
wayneseymour Dec 19, 2024
8e43cfa
Drop fixtures in maps plugin, add gis page object to scout core
wayneseymour Dec 19, 2024
dfc483e
Drop what I think is a duplicate test and use variables to assist wit…
wayneseymour Dec 19, 2024
19412a2
gis -> maps_page
wayneseymour Dec 19, 2024
ac59432
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 3, 2025
c8c4559
Add owners back
wayneseymour Jan 3, 2025
1530071
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 3, 2025
6b95148
update docss
wayneseymour Jan 3, 2025
e5781f7
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 7, 2025
015fc4d
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 7, 2025
579a17b
move to new home
wayneseymour Jan 8, 2025
361e760
lint
wayneseymour Jan 9, 2025
3a3f6b9
fixup
wayneseymour Jan 9, 2025
da95304
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 9, 2025
32de1d1
fixup test name
wayneseymour Jan 9, 2025
486b81c
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 10, 2025
f132623
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 13, 2025
e0cc6ce
Drop per cr with Dima
wayneseymour Jan 13, 2025
fb2aa58
I think I've addressed all the cr comments
wayneseymour Jan 13, 2025
10bc54e
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 15, 2025
a63378c
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 17, 2025
909e2ee
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 21, 2025
c55e2d1
Update .github/CODEOWNERS
wayneseymour Jan 21, 2025
d2c8a8a
fixup per cr
wayneseymour Jan 21, 2025
1e95b03
Merge branch 'add-scout-maps-tests' of github.com:wayneseymour/kibana…
wayneseymour Jan 21, 2025
c28e1b0
run scout maps tests on ci
wayneseymour Jan 21, 2025
be61a92
run in DA, not just stateful
wayneseymour Jan 22, 2025
dca9cb1
loginAsPrivilegedUser
wayneseymour Jan 22, 2025
061d572
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 23, 2025
1b1e68e
one it block
wayneseymour Jan 23, 2025
ad23686
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 23, 2025
12e9420
terse
wayneseymour Jan 23, 2025
42928b7
well this syntax worked on my local, even at slow 4g
wayneseymour Jan 23, 2025
f5f0d87
chore: update lazy PO util types
nickofthyme Jan 23, 2025
24c1a11
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 24, 2025
f7e8c58
lower retry count per cr
wayneseymour Jan 24, 2025
72c5fee
Apply suggestions from code review
wayneseymour Jan 24, 2025
64de577
Some changes after my chat with Nick P. Thanks for the help Nick!
wayneseymour Jan 24, 2025
54c23af
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 27, 2025
c1962a1
fixup types
wayneseymour Jan 27, 2025
f068aa8
docs
wayneseymour Jan 27, 2025
54b3f58
fix test
wayneseymour Jan 27, 2025
b6b6d2b
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 27, 2025
2115c29
Add renderable page per cr.
wayneseymour Jan 27, 2025
d9c5f41
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 28, 2025
3e18266
add a retry polling fn,
wayneseymour Jan 28, 2025
5fd214d
goto->gotoNewMap(); supports loading a new map, without any saved obj…
wayneseymour Jan 28, 2025
51f57f5
add expectation method for listing page, use it in gotoNewMap().
wayneseymour Jan 28, 2025
0ce72dc
drop retryForSuccess
wayneseymour Jan 28, 2025
fc8c091
drop log
wayneseymour Jan 28, 2025
be36ffb
drop
wayneseymour Jan 28, 2025
a71a2b9
add msgs in case of failure.
wayneseymour Jan 28, 2025
04863f6
clean up
wayneseymour Jan 28, 2025
d61a874
more cleanup
wayneseymour Jan 29, 2025
78bede6
Merge branch 'main' into add-scout-maps-tests
elasticmachine Jan 29, 2025
89b5d46
fixup nav
wayneseymour Jan 29, 2025
7c058c4
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 29, 2025
f358e07
Merge branch 'main' of github.com:elastic/kibana into add-scout-maps-…
wayneseymour Jan 29, 2025
acddda0
fixup per cr
wayneseymour Jan 29, 2025
d05d39a
fixup per cr
wayneseymour Jan 29, 2025
e26299c
more cleanup
wayneseymour Jan 29, 2025
75ce98a
Merge branch 'main' into add-scout-maps-tests
dmlemeshko Jan 30, 2025
51f27b3
Merge branch 'main' into add-scout-maps-tests
elasticmachine Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .buildkite/scripts/steps/functional/scout_ui_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ run_tests() {

EXIT_CODE=0

# Discovery Enhanced
# Discovery Enhanced && Maps
for run_mode in "--stateful" "--serverless=es" "--serverless=oblt" "--serverless=security"; do
run_tests "Discovery Enhanced: Parallel Workers" "x-pack/platform/plugins/private/discover_enhanced/ui_tests/parallel.playwright.config.ts" "$run_mode"
run_tests "Discovery Enhanced" "x-pack/platform/plugins/private/discover_enhanced/ui_tests/playwright.config.ts" "$run_mode"
run_tests "Maps" "x-pack/platform/plugins/shared/maps/ui_tests/playwright.config.ts" "$run_mode"
done

# Observability Onboarding
Expand All @@ -36,4 +37,4 @@ for run_mode in "--stateful" "--serverless=oblt"; do
done


exit $EXIT_CODE
exit $EXIT_CODE
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,7 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql
/.eslintignore @elastic/kibana-operations

# QA - Appex QA
/x-pack/platform/plugins/shared/maps/ui_tests @elastic/appex-qa # temporarily
/x-pack/platform/plugins/private/discover_enhanced/ui_tests/ @elastic/appex-qa # temporarily
/x-pack/test/functional/fixtures/package_registry_config.yml @elastic/appex-qa # No usages found
/x-pack/test/functional/fixtures/kbn_archiver/packaging.json @elastic/appex-qa # No usages found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('createPlaywrightConfig', () => {
serversConfigDir: SCOUT_SERVERS_ROOT,
[VALID_CONFIG_MARKER]: true,
screenshot: 'only-on-failure',
testIdAttribute: 'data-test-subj',
trace: 'on-first-retry',
});
expect(config.globalSetup).toBeUndefined();
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-scout/src/playwright/config/create_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function createPlaywrightConfig(options: ScoutPlaywrightOptions): Playwri
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
testIdAttribute: 'data-test-subj',
serversConfigDir: SCOUT_SERVERS_ROOT,
[VALID_CONFIG_MARKER]: true,
/* Base URL to use in actions like `await page.goto('/')`. */
Expand Down
6 changes: 6 additions & 0 deletions packages/kbn-scout/src/playwright/page_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ import { DashboardApp } from './dashboard_app';
import { DatePicker } from './date_picker';
import { DiscoverApp } from './discover_app';
import { FilterBar } from './fiter_bar';
import { MapsPage } from './maps_page';
import { RenderablePage } from './renderable_page';
import { createLazyPageObject } from './utils';

export interface PageObjects {
datePicker: DatePicker;
discover: DiscoverApp;
dashboard: DashboardApp;
filterBar: FilterBar;
maps: MapsPage;
renderable: RenderablePage;
}

/**
Expand All @@ -33,6 +37,8 @@ export function createCorePageObjects(page: ScoutPage): PageObjects {
dashboard: createLazyPageObject(DashboardApp, page),
discover: createLazyPageObject(DiscoverApp, page),
filterBar: createLazyPageObject(FilterBar, page),
maps: createLazyPageObject(MapsPage, page),
renderable: createLazyPageObject(RenderablePage, page),
// Add new page objects here
};
}
18 changes: 18 additions & 0 deletions packages/kbn-scout/src/playwright/page_objects/maps_page.ts
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 packages/kbn-scout/src/playwright/page_objects/renderable_page.ts
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`);
}
8 changes: 4 additions & 4 deletions packages/kbn-scout/src/playwright/page_objects/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import { ScoutPage } from '../../fixtures';
* in certain test scenarios.
*
* @param PageObjectClass - The page object class to be instantiated lazily.
* @param scoutPage - ScoutPage instance, that extendes the Playwright `page` fixture and passed to the page object class constructor.
* @param scoutPage - ScoutPage instance, that extends the Playwright `page` fixture and passed to the page object class constructor.
* @param constructorArgs - Additional arguments to be passed to the page object class constructor.
* @returns A proxy object that behaves like an instance of the page object class, instantiating it on demand.
*/
export function createLazyPageObject<T extends object>(
PageObjectClass: new (page: ScoutPage, ...args: any[]) => T,
export function createLazyPageObject<T extends object, Args extends any[]>(
PageObjectClass: new (page: ScoutPage, ...args: Args) => T,
scoutPage: ScoutPage,
...constructorArgs: any[]
...constructorArgs: Args
): T {
let instance: T | null = null;
return new Proxy({} as T, {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-scout/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"@kbn/mock-idp-utils",
"@kbn/test-subj-selector",
"@kbn/scout-info",
"@kbn/scout-reporting"
"@kbn/scout-reporting",
]
}
6 changes: 4 additions & 2 deletions x-pack/platform/plugins/shared/maps/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"public/**/*",
"server/**/*",
"server/config.ts",
"../../../../../typings/**/*"
"../../../../../typings/**/*",
"ui_tests/**/*",
],
"kbn_references": [
"@kbn/core",
Expand Down Expand Up @@ -90,7 +91,8 @@
"@kbn/embeddable-enhanced-plugin",
"@kbn/presentation-containers",
"@kbn/field-utils",
"@kbn/react-hooks"
"@kbn/react-hooks",
"@kbn/scout",
],
"exclude": [
"target/**/*",
Expand Down
22 changes: 22 additions & 0 deletions x-pack/platform/plugins/shared/maps/ui_tests/README.md
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
```
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';
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',
});
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();
});
}
);