Tldraw/e2e/test/helpers/ui/tools.ts

22 wiersze
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
}