mirror of
https://github.com/rookiestar28/ComfyUI-OpenClaw.git
synced 2026-08-14 00:48:07 +00:00
test(e2e): wait for admin console binding
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { clickTab, mockComfyUiCore, waitForOpenClawReady } from '../utils/helpers.js';
|
||||
import {
|
||||
clickTab,
|
||||
mockComfyUiCore,
|
||||
waitForAdminConsoleReady,
|
||||
waitForOpenClawReady,
|
||||
} from '../utils/helpers.js';
|
||||
|
||||
const pendingApproval = {
|
||||
approval_id: 'apr-001',
|
||||
@@ -177,9 +182,10 @@ test.describe('Approvals surfaces', () => {
|
||||
await expect(page.locator('#apr-list .openclaw-list-item').first()).toContainText('apr-001');
|
||||
|
||||
await page.goto(new URL('/web/admin_console.html', baseURL).toString());
|
||||
await waitForAdminConsoleReady(page);
|
||||
await page.locator('#refreshApprovals').click();
|
||||
|
||||
await expect(page.locator('#approvalsList')).toContainText('apr-001');
|
||||
await expect(page.locator('#approvalsList')).toContainText('render_portrait');
|
||||
await expect(page.locator('#approvalsList')).toContainText('apr-001', { timeout: 15000 });
|
||||
await expect(page.locator('#approvalsList')).toContainText('render_portrait', { timeout: 15000 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
mockCompatApprovalsList,
|
||||
mockComfyUiCore,
|
||||
mockRemoteAdminBaseline,
|
||||
waitForAdminConsoleReady,
|
||||
waitForOpenClawReady,
|
||||
} from '../utils/helpers.js';
|
||||
|
||||
@@ -63,8 +64,9 @@ test.describe('Desktop host parity lane', () => {
|
||||
await expect(page.locator('body')).toHaveAttribute('data-openclaw-desktop-embedded-frontend', '1.43.18');
|
||||
await expect(page.locator('body')).toHaveAttribute('data-openclaw-desktop-frontend-parity', 'lagging');
|
||||
|
||||
await waitForAdminConsoleReady(page);
|
||||
await page.locator('#refreshApprovals').click();
|
||||
await expect(page.locator('#approvalsList')).toContainText('apr-r166-001');
|
||||
await expect(page.locator('#approvalsList')).toContainText('desktop_host_smoke');
|
||||
await expect(page.locator('#approvalsList')).toContainText('apr-r166-001', { timeout: 15000 });
|
||||
await expect(page.locator('#approvalsList')).toContainText('desktop_host_smoke', { timeout: 15000 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -627,6 +627,17 @@ export async function waitForOpenClawReady(page) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function waitForAdminConsoleReady(page) {
|
||||
const timeoutMs = resolveUiTimeoutMs();
|
||||
// IMPORTANT: admin_console.html exposes static buttons before its module
|
||||
// binds handlers; waiting here prevents Windows CI from losing early clicks.
|
||||
await page.waitForFunction(
|
||||
() => typeof document.getElementById('refreshApprovals')?.onclick === 'function',
|
||||
null,
|
||||
{ timeout: timeoutMs },
|
||||
);
|
||||
}
|
||||
|
||||
export async function clickTab(page, title) {
|
||||
const tab = page.locator('.openclaw-tab', { hasText: title });
|
||||
const timeoutMs = resolveUiTimeoutMs();
|
||||
|
||||
Reference in New Issue
Block a user