tldraw/e2e/test/helpers/ui/minimap.ts
Orange Mug 2dbfda1285
Added initial webdriver tests (#1337)
Adds webdriver tests for testing from a users perspective via browser
actions. We currently support local test runners for a bunch of actions
on desktop `chrome`/`firefox`/`edge`/`safari` on macos.

We also have a browserstack runner which we'll enable in another PR.

### Release Note

- Adds initial webdriver tests
2023-05-09 20:21:45 +00:00

45 lines
955 B
TypeScript

import { wd } from './app'
export function $element() {
return $(wd('minimap'))
}
export async function zoomIn() {
const button = wd(`minimap.zoom-in`)
const toggle = wd(`minimap.toggle`)
if (await $(button).isExisting()) {
await $(button).click()
} else if (await $(wd(`minimap.toggle`)).isExisting()) {
await $(toggle).click()
await $(button).click()
}
return this
}
export async function zoomOut() {
const button = wd(`minimap.zoom-out`)
const toggle = wd(`minimap.toggle`)
if (await $(button).isExisting()) {
await $(button).click()
} else if (await $(wd(`minimap.toggle`)).isExisting()) {
await $(toggle).click()
await $(button).click()
}
return this
}
export async function menuButton() {
return await $(wd('minimap.zoom-menu'))
}
export async function menu(path: string[] = []) {
await $(wd('minimap.zoom-menu')).click()
for await (const item of path) {
await $(wd(`minimap.zoom-menu.${item}`)).click()
}
}