feat(simulation): add literal screen text matching (#36085)
This commit is contained in:
@@ -104,6 +104,10 @@ export function state(harness: Harness) {
|
||||
}
|
||||
}
|
||||
|
||||
export function matches(harness: Pick<Harness, "screen">, text: string) {
|
||||
return harness.screen().includes(text)
|
||||
}
|
||||
|
||||
export async function screenshot(harness: Harness, name?: string) {
|
||||
await harness.renderOnce()
|
||||
const image = SimulationPng.screenshot(harness.renderer)
|
||||
|
||||
@@ -21,6 +21,8 @@ async function handle(
|
||||
case "ui.state": {
|
||||
return SimulationActions.state(harness)
|
||||
}
|
||||
case "ui.matches":
|
||||
return SimulationActions.matches(harness, request.params.text)
|
||||
case "ui.recording.finish":
|
||||
if (!finishRecording) throw new Error("UI recording is not available")
|
||||
return finishRecording()
|
||||
|
||||
Reference in New Issue
Block a user