Module providing synthetic input and widget inspection utilities for driving the Lens Studio UI in integration tests.
// LensStudio:UiTest creates synthetic key/mouse events and dispatches them // to widgets — used to drive automated UI smoke tests. const UiTest = await import('LensStudio:UiTest'); const { Key, KeyboardModifier, IGui } = await import('LensStudio:Ui'); const gui = this.pluginSystem.findInterface(IGui) as IGui; if (Editor.isNull(gui)) { console.log('IGui unavailable; UiTest needs a running UI'); return; } const window = UiTest.mainWindow(gui); const event = UiTest.KeyEvent(UiTest.EventType.KeyPress, Key.Key_A, KeyboardModifier.NoModifier, 'a'); UiTest.sendEvent(window, event); UiTest.processEvents(100); console.log(`Sent KeyPress 'a' to main window (${UiTest.findChildren(window, 'Label').length} labels)`); Copy
// LensStudio:UiTest creates synthetic key/mouse events and dispatches them // to widgets — used to drive automated UI smoke tests. const UiTest = await import('LensStudio:UiTest'); const { Key, KeyboardModifier, IGui } = await import('LensStudio:Ui'); const gui = this.pluginSystem.findInterface(IGui) as IGui; if (Editor.isNull(gui)) { console.log('IGui unavailable; UiTest needs a running UI'); return; } const window = UiTest.mainWindow(gui); const event = UiTest.KeyEvent(UiTest.EventType.KeyPress, Key.Key_A, KeyboardModifier.NoModifier, 'a'); UiTest.sendEvent(window, event); UiTest.processEvents(100); console.log(`Sent KeyPress 'a' to main window (${UiTest.findChildren(window, 'Label').length} labels)`);
Module providing synthetic input and widget inspection utilities for driving the Lens Studio UI in integration tests.
Example