/**
 * Test script for the Oni Overlays API, tests the Show / Hide functions.
 */ import * as React from "react" ; import * as assert from "assert" ; import * as os from "os" ; import * as path from "path" ; import * as Oni from "oni-api" ; import { createNewFile } from "./Common" ; const getOverlayElements = ( ) => { return document . querySelectorAll ( ".test-automation-overlay" ) ; } ; export const test = async ( oni ) => { await oni . automation . waitForEditors ( ) ; await createNewFile ( "js" , oni ) ; const oniAsAny = oni ; const overlays = oniAsAny . overlays ; const overlay = overlays . createItem ( ) ; overlay . setContents ( < div className = "test-automation-overlay" / > ) ; overlay . show ( ) ; await oni . automation . waitFor ( ( ) => getOverlayElements ( ) . length === 1 ) ; overlay . hide ( ) ; await oni . automation . waitFor ( ( ) => getOverlayElements ( ) . length === 0 ) ; } ;