-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e06d6a
commit c75ecd1
Showing
6 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,20 @@ | ||
## How to run tests | ||
First start the servers with | ||
|
||
```bash | ||
// ESS | ||
node scripts/scout_start_servers.js --stateful | ||
// Serverless | ||
node scripts/scout_start_servers.js --serverless=es | ||
``` | ||
|
||
Then you can run the tests multiple times in another terminal with: | ||
|
||
```bash | ||
// ESS | ||
npx playwright test --config x-pack/plugins/maps/ui_tests/playwright.config.ts --grep @ess | ||
// Serverless | ||
npx playwright test --config x-pack/plugins/maps/ui_tests/playwright.config.ts --grep @svlSearch // @svlOblt, @svlSecurity | ||
``` | ||
|
||
Test results are available in `x-pack/plugins/maps/ui_tests/output` |
This file contains 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,44 @@ | ||
/* | ||
* 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 { | ||
test as base, | ||
PageObjects, | ||
createLazyPageObject, | ||
ScoutTestFixtures, | ||
ScoutWorkerFixtures, | ||
} from '@kbn/scout'; | ||
import { GisPage } from './page_objects'; | ||
|
||
export interface ExtendedScoutTestFixtures extends ScoutTestFixtures { | ||
pageObjects: PageObjects & { | ||
gis: GisPage; | ||
}; | ||
} | ||
|
||
export const test = base.extend<ExtendedScoutTestFixtures, ScoutWorkerFixtures>({ | ||
pageObjects: async ( | ||
{ | ||
pageObjects, | ||
page, | ||
}: { | ||
pageObjects: ExtendedScoutTestFixtures['pageObjects']; | ||
page: ExtendedScoutTestFixtures['page']; | ||
}, | ||
use: (pageObjects: ExtendedScoutTestFixtures['pageObjects']) => Promise<void> | ||
) => { | ||
const extendedPageObjects = { | ||
...pageObjects, | ||
gis: createLazyPageObject(GisPage, page), | ||
}; | ||
|
||
await use(extendedPageObjects); | ||
}, | ||
}); | ||
|
||
// export * as testData from './constants'; | ||
// export * as assertionMessages from './assertion_messages'; |
28 changes: 28 additions & 0 deletions
28
x-pack/plugins/maps/ui_tests/fixtures/page_objects/gis_page.ts
This file contains 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,28 @@ | ||
/* | ||
* 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 { ScoutPage} from '@kbn/scout'; | ||
|
||
export class GisPage { | ||
constructor(private readonly page: ScoutPage) {} | ||
|
||
async fullScreenModeMenuItemExists() { | ||
await this.page.testSubj.locator('mapsFullScreenMode').waitFor({ state: 'visible' }); | ||
} | ||
|
||
async clickFullScreenMode() { | ||
await this.page.testSubj.click('mapsFullScreenMode') | ||
} | ||
|
||
async clickExitFullScreenTextButton() { | ||
await this.page.testSubj.click('exitFullScreenModeText'); | ||
} | ||
|
||
async goto() { | ||
await this.page.gotoApp('maps'); | ||
} | ||
} |
This file contains 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 @@ | ||
export { GisPage } from './gis_page'; |
This file contains 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', | ||
}); |
33 changes: 33 additions & 0 deletions
33
x-pack/plugins/maps/ui_tests/tests/full_screen_mode.spec.ts
This file contains 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,33 @@ | ||
/* | ||
* 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 } from '@kbn/scout'; | ||
import { test } from '../fixtures'; | ||
|
||
test.describe('maps full screen mode', { tag: tags.ESS_ONLY } , () => { | ||
test.beforeEach(async ({ browserAuth, pageObjects }) => { | ||
await browserAuth.loginAsViewer(); | ||
await pageObjects.gis.goto(); | ||
}); | ||
test('full screen button should exist', async ({ pageObjects}) => { | ||
await pageObjects.gis.fullScreenModeMenuItemExists(); | ||
}); | ||
test('full screen mode hides the kbn app wrapper', async ({ page, pageObjects }) => { | ||
expect(await page.testSubj.locator('kbnAppWrapper visibleChrome').waitFor({state: 'visible'})); | ||
await pageObjects.gis.clickFullScreenMode(); | ||
expect(await page.testSubj.locator('kbnAppWrapper hiddenChrome').waitFor({state: 'visible'})); | ||
await pageObjects.gis.clickExitFullScreenTextButton(); | ||
expect(await page.testSubj.locator('kbnAppWrapper visibleChrome').waitFor({state: 'visible'})); | ||
}); | ||
test.skip('layer control is visible', async ({ page }) => { | ||
expect(await page.testSubj.locator('addLayerButton').waitFor({state: 'visible'})); | ||
}); | ||
// test('displays exit full screen logo button', async ({ page }) => { | ||
// }); | ||
// test('exits when the text button is clicked on', async ({ page }) => { | ||
// }); | ||
}); |