fix(test): rewrite cloud tests for unauthenticated CI environment

Cloud build has an auth guard that redirects to /cloud/login when
no Firebase auth is configured (CI has no auth). Previous tests
used comfyPageFixture which waits for the graph editor to load,
causing timeouts since the auth guard redirects before that.

New tests verify:
1. Cloud build redirects to /cloud/login (route only exists in
   cloud distribution, tree-shaken in OSS)
2. Cloud login page renders sign-in options

Uses raw Playwright test fixture instead of comfyPageFixture since
we don't need the full graph editor setup.
This commit is contained in:
bymyself
2026-03-28 16:49:31 -07:00
parent dd8595e01a
commit c42fa2a861

View File

@@ -1,26 +1,31 @@
import { expect } from '@playwright/test'
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
import { TestIds } from '../fixtures/selectors'
import { expect, test } from '@playwright/test'
/**
* Cloud distribution E2E tests.
*
* These tests run against the cloud build (DISTRIBUTION=cloud) and verify
* that cloud-specific behavior is present. In CI, no Firebase auth is
* configured, so the auth guard redirects to /cloud/login. The tests
* verify the cloud build loaded correctly by checking for cloud-only
* routes and elements.
*/
test.describe('Cloud distribution UI', { tag: '@cloud' }, () => {
// Precondition: cloud test environment must have a free-tier user authenticated.
// The subscribe button only renders when isCloud && isFreeTier.
test('subscribe button is attached in cloud mode', async ({ comfyPage }) => {
const subscribeButton = comfyPage.page.getByTestId(
TestIds.topbar.subscribeButton
)
await expect(subscribeButton).toBeAttached()
test('cloud build redirects unauthenticated users to login', async ({
page
}) => {
await page.goto('http://localhost:8188')
// Cloud build has an auth guard that redirects to /cloud/login.
// This route only exists in the cloud distribution — it's tree-shaken
// in the OSS build. Its presence confirms the cloud build is active.
await expect(page).toHaveURL(/\/cloud\/login/, { timeout: 10_000 })
})
test('bottom panel toggle is hidden in cloud mode', async ({ comfyPage }) => {
const sideToolbar = comfyPage.page.getByTestId(TestIds.sidebar.toolbar)
await expect(sideToolbar).toBeVisible()
// In cloud mode, the bottom panel toggle button should not be rendered
const bottomPanelToggle = sideToolbar.getByRole('button', {
name: /bottom panel|terminal/i
})
await expect(bottomPanelToggle).toHaveCount(0)
test('cloud login page renders sign-in options', async ({ page }) => {
await page.goto('http://localhost:8188')
await expect(page).toHaveURL(/\/cloud\/login/, { timeout: 10_000 })
// Verify cloud-specific login UI is rendered
await expect(
page.getByRole('button', { name: /google/i })
).toBeVisible()
})
})