-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(e2e): provide tests for controls
- Loading branch information
1 parent
e1c9ecf
commit 00f7785
Showing
22 changed files
with
235 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 |
---|---|---|
|
@@ -33,3 +33,4 @@ components/*.d.ts | |
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ | ||
tests/downloads |
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
Binary file added
BIN
+262 KB
tests/__screenshots__/controls.test.ts/ol-attribution-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+253 KB
tests/__screenshots__/controls.test.ts/ol-context-menu-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.01 KB
tests/__screenshots__/controls.test.ts/ol-control-bar-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+259 KB
tests/__screenshots__/controls.test.ts/ol-fullscreen-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+246 KB
...s/__screenshots__/controls.test.ts/ol-layerswitcher-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+262 KB
...creenshots__/controls.test.ts/ol-layerswitcherimage-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+264 KB
...s/__screenshots__/controls.test.ts/ol-mouseposition-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+283 KB
tests/__screenshots__/controls.test.ts/ol-overviewmap-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+259 KB
tests/__screenshots__/controls.test.ts/ol-printdialog-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+260 KB
tests/__screenshots__/controls.test.ts/ol-rotate-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+259 KB
tests/__screenshots__/controls.test.ts/ol-scaleline-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+240 KB
tests/__screenshots__/controls.test.ts/ol-search-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+198 KB
tests/__screenshots__/controls.test.ts/ol-swipe-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+260 KB
tests/__screenshots__/controls.test.ts/ol-toggle-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+260 KB
...s/__screenshots__/controls.test.ts/ol-videorecorder-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+117 KB
tests/__screenshots__/controls.test.ts/ol-zone-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+259 KB
tests/__screenshots__/controls.test.ts/ol-zoom-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+262 KB
tests/__screenshots__/controls.test.ts/ol-zoomslider-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+258 KB
tests/__screenshots__/controls.test.ts/ol-zoomtoextent-control-should-render-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,230 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
import { MapPage } from "./MapPage"; | ||
|
||
test.describe("ol-control-bar", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/controlbar/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await expect(page.locator(".ol-bar")).toHaveScreenshot({ | ||
timeout: 3000, | ||
}); | ||
}); | ||
}); | ||
|
||
test.describe("ol-attribution-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/attribution/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-context-menu-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/contextmenu/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await page.locator("canvas").click({ button: "right" }); | ||
await map.page.waitForSelector(".ol-ctx-menu-container"); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-fullscreen-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/fullscreen/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-layerswitcher-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/layerswitcher/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.page.locator(".ol-layerswitcher").click(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-layerswitcherimage-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/layerswitcherimage/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.page.locator(".ol-layerswitcher-image").click(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-mouseposition-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/mouseposition/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
|
||
// Get the bounding box of the canvas | ||
const boundingBox = await map.canvasBBox(); | ||
if (boundingBox) { | ||
const newX = boundingBox.x + 10; | ||
const newY = boundingBox.y + 20; | ||
await page.mouse.move(newX, newY); | ||
} else { | ||
console.error("Canvas element not found or not visible"); | ||
} | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-overviewmap-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/overviewmap/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-printdialog-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/printdialog/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-rotate-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/rotate/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-search-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/search/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.page.locator(".ol-search button").click(); | ||
await map.page.locator(".ol-search input").pressSequentially("B"); | ||
await map.waitMs(100); // search is debounced | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-scaleline-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/scaleline/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-swipe-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/swipe/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-toggle-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/toggle/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-videorecorder-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/videorecorder/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
|
||
test("should record and download", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/videorecorder/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
const downloadPromise = page.waitForEvent("download"); | ||
await map.page.getByTitle("start video").click(); | ||
await map.waitMs(100); | ||
await map.page.getByTitle("pause").click(); | ||
await map.waitMs(100); | ||
await map.page.getByTitle("resume").click(); | ||
await map.waitMs(100); | ||
await map.page.getByTitle("stop").click(); | ||
const download = await downloadPromise; | ||
await download.saveAs("tests/downloads/" + download.suggestedFilename()); | ||
}); | ||
}); | ||
|
||
test.describe("ol-zone-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/zone/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.page.locator(".ol-control.ol-mapzone").nth(1).click(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-zoom-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/zoom/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-zoomslider-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/zoomslider/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); | ||
|
||
test.describe("ol-zoomtoextent-control", () => { | ||
test("should render", async ({ page }) => { | ||
const map = new MapPage(page); | ||
await map.goto("/componentsguide/mapcontrols/zoomtoextent/"); | ||
await map.waitUntilReady(); | ||
await map.waitUntilCanvasLoaded(); | ||
await map.checkCanvasScreenshot(); | ||
}); | ||
}); |