From 92d09f2ea153bad4ddd97d7514076ff0046c3601 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 1 Sep 2023 08:50:03 -0700 Subject: [PATCH] Clean up, fix errors, add todo --- test/playwright/TestUtils.ts | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/test/playwright/TestUtils.ts b/test/playwright/TestUtils.ts index 357a5dd3..c18426c9 100644 --- a/test/playwright/TestUtils.ts +++ b/test/playwright/TestUtils.ts @@ -39,8 +39,7 @@ type EnsureAsync = T extends PromiseLike ? T : Promise; type EnsureAsyncProperties = { [Key in keyof T]: EnsureAsync }; - -type PromisifyMethods = { +type EnsureAsyncMethods = { [K in keyof T]: T[K] extends (...args: infer Args) => infer Return ? (...args: Args) => Promise : T[K]; @@ -54,7 +53,7 @@ type PromisifyMethods = { type PlaywrightApiProxy = ( // Interfaces that the proxy implements as async EnsureAsyncProperties> & - PromisifyMethods> & + EnsureAsyncMethods> & // Interfaces that the proxy implements as is (exclude async/custom) Omit ); @@ -66,7 +65,26 @@ interface ITerminalProxyCustomMethods { type TerminalProxyAsyncPropOverrides = 'cols' | 'rows' | 'modes'; type TerminalProxyAsyncMethodOverrides = 'hasSelection' | 'getSelection' | 'getSelectionPosition' | 'registerMarker'; -type TerminalProxyCustomOverrides = 'buffer'; +type TerminalProxyCustomOverrides = 'buffer' | ( + // TODO: Review and implement below if needed + 'element' | + 'textarea' | + 'markers' | + 'unicode' | + 'parser' | + 'options' | + 'onWriteParsed' | + 'open' | + 'attachCustomKeyEventHandler' | + 'registerLinkProvider' | + 'registerCharacterJoiner' | + 'deregisterCharacterJoiner' | + 'registerDecoration' | + 'selectLines' | + 'refresh' | + 'clearTextureAtlas' | + 'loadAddon' +); export class TerminalProxy implements ITerminalProxyCustomMethods, PlaywrightApiProxy { constructor(private readonly _page: Page) { } @@ -213,7 +231,7 @@ export class TerminalProxy implements ITerminalProxyCustomMethods, PlaywrightApi } } -class TerminalBufferNamespaceProxy implements PlaywrightApiProxy { +class TerminalBufferNamespaceProxy implements PlaywrightApiProxy { private _onBufferChange = new EventEmitter(); public readonly onBufferChange = this._onBufferChange.event;