Files
orca/tests/e2e/helpers/sidebar-setup-prompt.ts

26 lines
1.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Page } from '@stablyai/playwright-test'
import { expect } from '@stablyai/playwright-test'
import { getRepoExecutionHostId } from '../../../src/shared/execution-host'
import { getRepoHostIdentityForParts } from '../../../src/shared/repository/repo-host-identity'
// Dismiss every loaded repo’s setup prompt through its action; workspace switches can re-inspect and show it between visibility checks.
export async function dismissSetupScriptPrompts(page: Page): Promise<void> {
const repos = await page.evaluate(() =>
(window.__store?.getState().repos ?? []).map((repo) => ({
id: repo.id,
connectionId: repo.connectionId ?? null,
executionHostId: repo.executionHostId ?? null
}))
)
const identities = repos.map((repo) =>
getRepoHostIdentityForParts(repo.id, getRepoExecutionHostId(repo))
)
await page.evaluate((keys) => {
const state = window.__store?.getState()
for (const key of keys) {
state?.dismissSetupScriptPrompt(key)
}
}, identities)
await expect(page.locator('[data-setup-script-prompt-layer]')).toHaveCount(0)
}