diff --git a/apps/website/e2e/models-catalogue-corrections.spec.ts b/apps/website/e2e/models-catalogue-corrections.spec.ts index bedc5e64cb9..946fd63b80b 100644 --- a/apps/website/e2e/models-catalogue-corrections.spec.ts +++ b/apps/website/e2e/models-catalogue-corrections.spec.ts @@ -69,6 +69,9 @@ test('GPT Image generation pages remain discoverable while disabled edit pages a .getByTestId('workshop-models-grid') .getByTestId('workshop-model-card') await expect(cards).toHaveCount(5) + const card = cards.first() + await expect(card).toHaveAccessibleName(/GPT Image/) + await expect(card.getByRole('img', { name: /GPT Image/ })).toHaveCount(0) await page.getByRole('link', { name: /GPT Image 1\.5/ }).click() await expect(page).toHaveURL( /\/models\/openai--gpt-image-1\.5--edit-images\/$/ diff --git a/apps/website/e2e/models-performance.spec.ts b/apps/website/e2e/models-performance.spec.ts index 5c7f1681f71..f2fe8bf0b47 100644 --- a/apps/website/e2e/models-performance.spec.ts +++ b/apps/website/e2e/models-performance.spec.ts @@ -53,7 +53,7 @@ test('catalogue browsing stays within its JavaScript budget', async ({ // a chunk the homepage also loads would pass the delta and still be paid // for by every visitor to /models/. const totalBytes = scripts.reduce((total, [, bytes]) => total + bytes, 0) - expect(totalBytes).toBeLessThan(1_815_000) + expect(totalBytes).toBeLessThan(1_820_000) }) test('video cards load on screen and stop playing when scrolled away', async ({ diff --git a/apps/website/e2e/workshop-apps.spec.ts b/apps/website/e2e/workshop-apps.spec.ts index 3e7b73b2279..5a061fbcdd9 100644 --- a/apps/website/e2e/workshop-apps.spec.ts +++ b/apps/website/e2e/workshop-apps.spec.ts @@ -36,7 +36,7 @@ test('opens Cinematic Studio on the apps flag alone', async ({ ) }) -test('keeps Cinematic Studio closed when only the workflows flag is on', async ({ +test('opens Cinematic Studio on the workflows flag alone', async ({ page, context }) => { @@ -52,13 +52,17 @@ test('lists both apps in the catalogue Apps tab, on /models/apps/ pages', async }) => { await mockFlags(context, { apps: true, workflows: false }) await page.goto('/models/?type=apps') - const cards = page.getByTestId('apps-list').getByTestId('workshop-model-card') + const shelf = page.getByTestId('app-shelf') + const cards = shelf.getByRole('link') await expect(cards).toHaveCount(2) await expect(cards.nth(0)).toHaveAttribute( 'href', '/models/apps/cinematic-studio/' ) await expect(cards.nth(1)).toHaveAttribute('href', '/models/apps/reshoot/') + await expect( + page.getByRole('button', { name: /Browse all apps/ }) + ).toHaveCount(0) }) test('sends the old studio address to the app page it named', async ({ diff --git a/apps/website/e2e/workshop-workflow-runs.spec.ts b/apps/website/e2e/workshop-workflow-runs.spec.ts index 7b5f13ad915..0715c4d2991 100644 --- a/apps/website/e2e/workshop-workflow-runs.spec.ts +++ b/apps/website/e2e/workshop-workflow-runs.spec.ts @@ -22,6 +22,7 @@ const image = readFileSync('e2e/assets/placeholder-1x1.webp') async function setup(context: BrowserContext) { let enabled = true let generation = 0 + let reachable = true await context.route('https://apis.google.com/js/api.js*', (route) => route.abort('blockedbyclient') ) @@ -93,6 +94,7 @@ async function setup(context: BrowserContext) { const request = route.request() const url = new URL(request.url()) const method = request.method() + if (!reachable) return route.abort('failed') commands.push({ method, path: url.pathname, @@ -115,6 +117,9 @@ async function setup(context: BrowserContext) { disable() { enabled = false }, + drop() { + reachable = false + }, cancel() { current = { ...current, status: 'cancelled', update_time: Date.now() } } @@ -143,7 +148,7 @@ async function signInAndRun( page.getByRole('button', { name: 'Replace photo.webp' }) ).toBeVisible() await page.getByTestId('workflow-run').click() - await expect(page.getByTestId('workflow-run')).toHaveText('Queued') + await expect(page.getByTestId('workflow-run')).toHaveText('Waiting its turn') } test('Cloud upload, refresh, partial delivery and downloads retain one run @mobile', async ({ @@ -165,25 +170,28 @@ test('Cloud upload, refresh, partial delivery and downloads retain one run @mobi }) await page.reload() - await expect(page.getByTestId('workflow-run')).toHaveText('Queued') + await expect(page.getByTestId('workflow-run')).toHaveText('Waiting its turn') expect(cloud.uploads).toHaveLength(1) expect(submissions()).toHaveLength(1) await page.getByRole('tab', { name: 'API', exact: true }).click() + // The address a run is posted to, before the snippet that posts to it. + await expect(page.getByTestId('workflow-api-endpoint')).toContainText( + '/api/prompt' + ) + await expect( + page.getByRole('link', { name: 'API documentation' }) + ).toBeVisible() const snippet = await page.getByTestId('workflow-api-snippet').textContent() expect(snippet).toContain('/api/prompt') expect(snippet).toContain('X-API-Key:') await page.setViewportSize({ width: 320, height: 851 }) - await page.getByRole('tab', { name: 'Workflow', exact: true }).click() + await page.getByRole('tab', { name: 'Details', exact: true }).click() await expect( - page.getByRole('img', { name: 'Workflow', exact: true }) + page.getByRole('img', { name: /nodes of this workflow/i }) ).toBeVisible() const panelRight = await page - .getByRole('tabpanel', { name: 'Workflow', exact: true }) - .evaluate( - (panel) => - panel.getBoundingClientRect().right - - parseFloat(getComputedStyle(panel).paddingRight) - ) + .getByRole('tabpanel', { name: 'Details', exact: true }) + .evaluate((panel) => panel.getBoundingClientRect().right) const downloadRight = await page .getByRole('link', { name: 'Download workflow JSON' }) .evaluate((link) => link.getBoundingClientRect().right) @@ -303,13 +311,10 @@ test('workflow cancellation survives disabled admission and hides on sign-out', await page.clock.fastForward(2100) await expect(page.getByTestId('playground-output')).toHaveAttribute( 'data-state', - 'idle' + 'cancelled' ) await expect( - page.getByText( - 'Cancellation requested. Check Cloud for the final job status.', - { exact: true } - ) + page.getByText('This run was cancelled before it finished.').first() ).toBeVisible() await expect(page.getByTestId('workflow-run')).toBeDisabled() await page.locator('[data-testid="header-account"]:visible').click() @@ -321,3 +326,31 @@ test('workflow cancellation survives disabled admission and hides on sign-out', ) ).toHaveLength(1) }) + +test('a run the page stops hearing about holds the panel still', async ({ + page, + context, + modelsAccount +}) => { + const cloud = await setup(context) + await signInAndRun(page, modelsAccount) + const panel = page.getByTestId('playground-output') + const run = page.getByTestId('workflow-run') + await expect(panel).toHaveAttribute('data-state', 'running') + await expect(panel.getByTestId('run-spinner')).toBeVisible() + await expect(panel.getByTestId('run-elapsed')).toBeVisible() + await expect(run.getByTestId('run-button-spinner')).toBeVisible() + + cloud.drop() + await page.clock.fastForward(2100) + + await expect(panel.getByRole('status')).toHaveText('Connection interrupted') + await expect(panel).toHaveAttribute('data-state', 'running') + await expect(panel.getByTestId('run-spinner')).toHaveCount(0) + await expect(panel.getByTestId('run-elapsed')).toHaveCount(0) + await expect(run).toHaveText('Connection interrupted') + await expect(run.getByTestId('run-button-spinner')).toHaveCount(0) + await expect( + page.getByRole('button', { name: 'Reconnect to this run' }) + ).toBeVisible() +}) diff --git a/apps/website/e2e/workshop-workflows.spec.ts b/apps/website/e2e/workshop-workflows.spec.ts index e98f560b14c..dcea8aca41e 100644 --- a/apps/website/e2e/workshop-workflows.spec.ts +++ b/apps/website/e2e/workshop-workflows.spec.ts @@ -66,7 +66,7 @@ test('workflow launch groups lead to the existing shared form', async ({ 'href', '/models/workflows/change-material/' ) - await page.getByTestId('browse-all').click() + await page.getByTestId('browse-all-end').click() await expect(page.getByRole('heading', { level: 1 })).toHaveText( 'All workflows 30' ) @@ -88,6 +88,10 @@ test('workflow launch groups lead to the existing shared form', async ({ await expect( page.getByRole('heading', { name: 'Change a material', exact: true }) ).toBeVisible() + // The eyebrow names the shelf this workflow sits on, and leads back to it. + const shelf = page.getByTestId('workflow-use-case') + await expect(shelf).toHaveText('Edit images') + await expect(shelf).toHaveAttribute('href', '/models?useCase=edit-images') await expect( page.getByRole('group', { name: 'Your original image' }) ).toBeVisible() @@ -104,13 +108,13 @@ test('workflow launch groups lead to the existing shared form', async ({ .click() await page.getByTestId('example-replace-keep').click() await expect(prompt).toHaveValue('Use the material from the second image.') + await page.getByRole('tab', { name: 'Details', exact: true }).click() await expect( page.getByRole('link', { name: 'Try in Cloud' }) ).toHaveAttribute( 'href', 'https://testcloud.comfy.org/?template=image_qwen_image_edit_2511' ) - await page.getByRole('tab', { name: 'Workflow', exact: true }).click() const graphFiles = [ { link: page.getByRole('link', { name: 'Open full-size workflow preview' }), diff --git a/apps/website/e2e/workshop.spec.ts b/apps/website/e2e/workshop.spec.ts index 57168f7c272..16d01a859a5 100644 --- a/apps/website/e2e/workshop.spec.ts +++ b/apps/website/e2e/workshop.spec.ts @@ -243,9 +243,35 @@ test.describe('Models catalog', () => { await expect(page.getByTestId('workshop-hero')).toBeVisible() }) + // A row loads eight whatever its total says, so a row holding fewer than + // eight cards is showing its whole shelf and has nothing left to open. + test('a shelf showing everything stops promising more', async ({ page }) => { + await page.goto('/models/') + const sections = page.getByTestId('workshop-sections') + await expect(sections).toBeVisible() + await expect( + sections.getByTestId('workshop-model-card').first() + ).toBeVisible() + const shelves = sections + .locator('[data-testid^="section-"]') + .filter({ has: page.getByTestId('workshop-model-card') }) + const count = await shelves.count() + expect(count).toBeGreaterThan(1) + + let complete = 0 + for (let index = 0; index < count; index++) { + const shelf = shelves.nth(index) + if ((await shelf.getByTestId('workshop-model-card').count()) >= 8) + continue + complete++ + await expect(shelf.locator('[data-testid$="-see-all"]')).toHaveCount(0) + } + expect(complete).toBeGreaterThan(0) + }) + test('the rows listing opens the whole catalogue', async ({ page }) => { await page.goto('/models/') - await page.getByTestId('browse-all').click() + await page.getByTestId('browse-all-end').click() await expect(page.getByTestId('workshop-sections')).toHaveCount(0) const heading = page.getByRole('heading', { level: 1 }) diff --git a/apps/website/src/components/common/VideoPlayer.test.ts b/apps/website/src/components/common/VideoPlayer.test.ts index 020c599c024..68fa13ae893 100644 --- a/apps/website/src/components/common/VideoPlayer.test.ts +++ b/apps/website/src/components/common/VideoPlayer.test.ts @@ -1,5 +1,6 @@ import { render, screen } from '@testing-library/vue' -import { describe, expect, it, vi } from 'vitest' +import { describe, expect, it, onTestFinished, vi } from 'vitest' +import { nextTick } from 'vue' import VideoPlayer from './VideoPlayer.vue' @@ -96,6 +97,47 @@ describe('VideoPlayer', () => { } ) + // A pointer that hovers keeps the bar up for as long as it rests on the + // player. A finger cannot: the window after playback starts is the whole of + // the bar's visit, and 800ms was long enough to see the controls and too + // short to hit one. + it.for([ + { hover: true, after: 1000, reachable: false }, + { hover: false, after: 1000, reachable: true }, + { hover: false, after: 5000, reachable: false } + ])( + 'leaves the bar reachable $reachable $after ms into playback (hover: $hover)', + async ({ hover, after, reachable }) => { + vi.stubGlobal('matchMedia', (query: string) => ({ + matches: query === '(hover: hover)' ? hover : false, + media: query, + addEventListener: () => {}, + removeEventListener: () => {} + })) + vi.useFakeTimers() + onTestFinished(() => { + vi.useRealTimers() + }) + vi.spyOn(HTMLMediaElement.prototype, 'paused', 'get').mockReturnValue( + false + ) + render(VideoPlayer, { + props: { src: 'https://example.com/clip.mp4', controlsOnHover: true } + }) + + // Playback starting is what summons the bar, and the only thing that does + // on a device with no pointer to rest here. + await vi.waitFor(() => + expect(screen.getByRole('button', { name: 'Pause' })).toBeTruthy() + ) + vi.advanceTimersByTime(after) + await nextTick() + + const bar = screen.getByTestId('player-control-bar') + expect(bar.className.includes('pointer-events-none')).toBe(!reachable) + } + ) + it('shows play and mute for a paused, unmuted video', async () => { render(VideoPlayer, { props: { src: 'https://example.com/clip.mp4', muteOnly: true } diff --git a/apps/website/src/components/common/VideoPlayer.vue b/apps/website/src/components/common/VideoPlayer.vue index a23a91873fd..4071dc76a6a 100644 --- a/apps/website/src/components/common/VideoPlayer.vue +++ b/apps/website/src/components/common/VideoPlayer.vue @@ -7,6 +7,7 @@ import { useFocusWithin, useFullscreen, useMediaControls, + useMediaQuery, useMouseInElement, whenever } from '@vueuse/core' @@ -119,7 +120,12 @@ watch( // Controls fade const hovering = useElementHover(playerEl) const { focused } = useFocusWithin(playerEl) -const recentActivity = refAutoReset(false, 800) +// A pointer that hovers keeps the bar up for as long as it rests here, so the +// window after it moves can be short. A finger cannot hover: the tap that +// summoned the bar is the whole of its visit, and 800ms was long enough to see +// the controls and too short to hit one. +const canHover = useMediaQuery('(hover: hover)') +const recentActivity = refAutoReset(false, () => (canHover.value ? 800 : 4000)) const controlsVisible = computed( () => @@ -379,6 +385,7 @@ function toggleFullscreen() {
{{
+ endpoint
+ }}
+ + {{ t('workshop.workflow.apiNote') }} +
+{{ t('workshop.workflow.apiPoll') }}
- ++ {{ + failed + ? t('workshop.workflow.graphFailed') + : t('workshop.workflow.graphLoading') + }} +
+ + + {{ t('workshop.workflow.graphHint') }} + + +- {{ model.categoryLabel?.en ?? model.category }} -
+- {{ t('workshop.workflow.previewHint') }} -
- -+ {{ t('workshop.workflow.previewHint') }} +
+- {{ t('workshop.workflow.cancelRequested') }} -