tldraw/e2e/test/helpers/ui/tools.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

21 lines
490 B
TypeScript

import { wd } from './app'
export function $element() {
return $(wd('tools'))
}
export async function click(toolName: string) {
// Check if `tools.mobile-more` exists
// Check ifisExisting()
const toolSelector = wd(`tools.${toolName}`)
const moreSelector = wd(`tools.more`)
if (await $(toolSelector).isExisting()) {
await $(toolSelector).click()
} else if (await $(moreSelector).isExisting()) {
await $(moreSelector).click()
await $(toolSelector).click()
}
return this
}