From 179b8c22a9d583bcbb62fbdf00c9a49b0773f926 Mon Sep 17 00:00:00 2001 From: bymyself Date: Sun, 5 Jan 2025 11:03:07 -0700 Subject: [PATCH] [BrowserTest] Refactor test fixtures (#2165) --- browser_tests/fixtures/ComfyPage.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/browser_tests/fixtures/ComfyPage.ts b/browser_tests/fixtures/ComfyPage.ts index 77f397c9f1..89128a995e 100644 --- a/browser_tests/fixtures/ComfyPage.ts +++ b/browser_tests/fixtures/ComfyPage.ts @@ -27,6 +27,11 @@ dotenv.config() type WorkspaceStore = ReturnType class ComfyMenu { + private _nodeLibraryTab: NodeLibrarySidebarTab | null = null + private _workflowsTab: WorkflowsSidebarTab | null = null + private _queueTab: QueueSidebarTab | null = null + private _topbar: Topbar | null = null + public readonly sideToolbar: Locator public readonly themeToggleButton: Locator public readonly saveButton: Locator @@ -40,19 +45,23 @@ class ComfyMenu { } get nodeLibraryTab() { - return new NodeLibrarySidebarTab(this.page) + this._nodeLibraryTab ??= new NodeLibrarySidebarTab(this.page) + return this._nodeLibraryTab } get workflowsTab() { - return new WorkflowsSidebarTab(this.page) + this._workflowsTab ??= new WorkflowsSidebarTab(this.page) + return this._workflowsTab } get queueTab() { - return new QueueSidebarTab(this.page) + this._queueTab ??= new QueueSidebarTab(this.page) + return this._queueTab } get topbar() { - return new Topbar(this.page) + this._topbar ??= new Topbar(this.page) + return this._topbar } async toggleTheme() {