diff --git a/apps/website/e2e/header-models-navigation.spec.ts b/apps/website/e2e/header-models-navigation.spec.ts index aeb98753dc9..1af5642c020 100644 --- a/apps/website/e2e/header-models-navigation.spec.ts +++ b/apps/website/e2e/header-models-navigation.spec.ts @@ -21,9 +21,7 @@ async function expectNoHorizontalOverflow(page: Page) { } for (const viewport of viewports) { - test(`enabled Models navigation fits at ${viewport.name}`, async ({ - page - }) => { + test(`enabled Hub navigation fits at ${viewport.name}`, async ({ page }) => { await page.setViewportSize({ width: viewport.width, height: 900 }) await page.goto('/') @@ -36,7 +34,7 @@ for (const viewport of viewports) { if (viewport.desktopNavigation) { await expect(desktopLinks).toBeVisible() await expect( - desktopLinks.getByRole('link', { name: 'Models', exact: true }) + desktopLinks.getByRole('link', { name: 'Hub', exact: true }) ).toHaveAttribute('href', '/models') await expect(menuButton).toBeHidden() } else { @@ -45,9 +43,10 @@ for (const viewport of viewports) { await menuButton.click() const menu = page.getByRole('dialog', { name: 'Menu' }) await expect(menu).toBeVisible() - await expect( - menu.getByRole('link', { name: /^Models\b/ }) - ).toHaveAttribute('href', '/models') + await expect(menu.getByRole('link', { name: /^Hub\b/ })).toHaveAttribute( + 'href', + '/models' + ) } await expectNoHorizontalOverflow(page) diff --git a/apps/website/e2e/homepage.spec.ts b/apps/website/e2e/homepage.spec.ts index 72c089fb973..d3165c0919a 100644 --- a/apps/website/e2e/homepage.spec.ts +++ b/apps/website/e2e/homepage.spec.ts @@ -278,3 +278,61 @@ test.describe('Get started section links @smoke', () => { ) }) }) + +test.describe('Model discovery row @interaction', () => { + test('a hovered or focused workflow card gives its whole name', async ({ + page, + context + }) => { + await context.route('**/t.comfy.org/**', (route) => + /\/(flags|decide)\//.test(route.request().url()) + ? route.fulfill({ + json: { + featureFlags: { + 'workshop-enabled': true, + 'workshop-workflows-enabled': true + }, + featureFlagPayloads: {} + } + }) + : route.abort('blockedbyclient') + ) + await page.goto('/') + await page + .getByTestId('catalogue-tabs') + .getByRole('button', { name: 'Workflows' }) + .click() + const cards = page.getByTestId('discovery-workflow') + await expect(cards.first()).toBeAttached() + await page.addStyleTag({ + content: + '[data-testid="discovery-marquee"] { animation: none !important }' + }) + + const cut = await cards.evaluateAll((elements) => + elements.findIndex((element) => { + const name = element.querySelector('span[title]') + const box = element.getBoundingClientRect() + return ( + name !== null && + name.scrollWidth > name.clientWidth + 1 && + box.x > 0 && + box.right < window.innerWidth + ) + }) + ) + expect(cut).toBeGreaterThan(-1) + + const card = cards.nth(cut) + const name = card.locator('span[title]') + const overflow = () => + name.evaluate((element) => element.scrollWidth - element.clientWidth) + await card.hover() + await expect.poll(overflow).toBeLessThanOrEqual(1) + + await page.mouse.move(0, 0) + await expect.poll(overflow).toBeGreaterThan(1) + await card.focus() + await expect.poll(overflow).toBeLessThanOrEqual(1) + }) +}) diff --git a/apps/website/e2e/navigation.spec.ts b/apps/website/e2e/navigation.spec.ts index 50d88f953b4..2c4d56e5142 100644 --- a/apps/website/e2e/navigation.spec.ts +++ b/apps/website/e2e/navigation.spec.ts @@ -29,7 +29,7 @@ const minimaxRoute = '/minimax-h3' const minimaxRouteZh = '/zh-CN/minimax-h3' const TOP_LEVEL_LABELS = [ - 'Models', + 'Hub', 'Products', 'Pricing', 'Community', @@ -113,7 +113,7 @@ test.describe('Desktop navigation @smoke', () => { await expect( desktopLinks - .getByRole('link', { name: 'Models' }) + .getByRole('link', { name: 'Hub' }) .getByText('NEW', { exact: true }) ).toBeVisible() for (const label of ['Products', 'Community']) { @@ -326,7 +326,7 @@ test.describe('Mobile menu @mobile', () => { const menu = page.getByRole('dialog') await expect(menu).toBeVisible() - for (const label of ['Models', 'Products', 'Pricing', 'Community']) { + for (const label of ['Hub', 'Products', 'Pricing', 'Community']) { await expect(menu.getByText(label, { exact: true }).first()).toBeVisible() } }) @@ -339,7 +339,7 @@ test.describe('Mobile menu @mobile', () => { const menu = page.getByRole('dialog') await expect( - menu.getByRole('link', { name: 'Models' }).getByText('NEW', { + menu.getByRole('link', { name: 'Hub' }).getByText('NEW', { exact: true }) ).toBeVisible() diff --git a/apps/website/e2e/visual-responsive.spec.ts b/apps/website/e2e/visual-responsive.spec.ts index 2896dfa2677..b1c6b83e64e 100644 --- a/apps/website/e2e/visual-responsive.spec.ts +++ b/apps/website/e2e/visual-responsive.spec.ts @@ -33,7 +33,7 @@ async function navigateAndSettle(page: Page, url: string) { await expect( page .getByTestId('desktop-nav-links') - .getByRole('link', { name: 'Models', includeHidden: true }) + .getByRole('link', { name: 'Hub', includeHidden: true }) ).toBeAttached() await waitForPpFormulaLight(page) } diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/enterprise-faq-3-lg-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/enterprise-faq-3-lg-visual-linux.png index 85161954b47..3fc619ce509 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/enterprise-faq-3-lg-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/enterprise-faq-3-lg-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/enterprise-faq-4-xl-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/enterprise-faq-4-xl-visual-linux.png index 210a5a856c5..78d4aafbecc 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/enterprise-faq-4-xl-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/enterprise-faq-4-xl-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-get-started-3-lg-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-get-started-3-lg-visual-linux.png index ea8aac6461c..0aeaaae3200 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-get-started-3-lg-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-get-started-3-lg-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-get-started-4-xl-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-get-started-4-xl-visual-linux.png index 08bf11b7b5b..0ec7114b3a6 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-get-started-4-xl-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-get-started-4-xl-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-product-cards-3-lg-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-product-cards-3-lg-visual-linux.png index d97ab7b3269..ed9cbcd307a 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-product-cards-3-lg-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-product-cards-3-lg-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-product-cards-4-xl-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-product-cards-4-xl-visual-linux.png index a67b970607f..502da14ecd7 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-product-cards-4-xl-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/home-product-cards-4-xl-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-faq-3-lg-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-faq-3-lg-visual-linux.png index 4fb078db892..882dcafd231 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-faq-3-lg-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-faq-3-lg-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-faq-4-xl-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-faq-4-xl-visual-linux.png index 44410114eca..4c5b3ef7021 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-faq-4-xl-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-faq-4-xl-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-tiers-3-lg-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-tiers-3-lg-visual-linux.png index b1460dc9c8c..7dfc8d62568 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-tiers-3-lg-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-tiers-3-lg-visual-linux.png differ diff --git a/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-tiers-4-xl-visual-linux.png b/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-tiers-4-xl-visual-linux.png index b92ddc5b847..4086123a560 100644 Binary files a/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-tiers-4-xl-visual-linux.png and b/apps/website/e2e/visual-responsive.spec.ts-snapshots/pricing-tiers-4-xl-visual-linux.png differ diff --git a/apps/website/e2e/workshop-visibility.spec.ts b/apps/website/e2e/workshop-visibility.spec.ts index ad53b0db17e..b5b45f4b968 100644 --- a/apps/website/e2e/workshop-visibility.spec.ts +++ b/apps/website/e2e/workshop-visibility.spec.ts @@ -28,7 +28,7 @@ test('keeps the public site when PostHog is unavailable', async ({ page }) => { }) await page.goto('/') await expect( - page.getByRole('link', { name: 'Models', exact: true }) + page.getByRole('link', { name: 'Hub', exact: true }) ).toHaveCount(0) await expect(page.getByTestId('model-discovery')).toHaveCount(0) await expect( diff --git a/apps/website/e2e/workshop-workflows.spec.ts b/apps/website/e2e/workshop-workflows.spec.ts index 15a935092b8..927847bf6de 100644 --- a/apps/website/e2e/workshop-workflows.spec.ts +++ b/apps/website/e2e/workshop-workflows.spec.ts @@ -80,7 +80,7 @@ test('workflow launch groups lead to the existing shared form', async ({ await page.getByTestId('sort-name').click() await expect( page.getByTestId('workflow-search-results').getByRole('link').first() - ).toHaveAttribute('href', '/models/workflows/animate-reference-sheet/') + ).toHaveAttribute('href', '/models/workflows/connect-images-with-motion/') await page.getByTestId('section-back').click() await expect(page.getByTestId('workshop-hero')).toBeVisible() await page.getByTestId('workshop-search').fill('Change a material') @@ -103,7 +103,7 @@ test('workflow launch groups lead to the existing shared form', async ({ ).toBeVisible() const prompt = page.getByRole('textbox', { name: 'What should change?' }) await expect(prompt).toHaveValue( - 'Change the furniture leather difference in image 1 to the fur material in image 2.' + 'Give the sofa the fur texture from the material reference instead of its leather.' ) await prompt.fill('Use the material from the second image.') await page @@ -177,24 +177,29 @@ test('the Details graph waits for its tab, names its subgraphs, and zooms from i expect(graphRequests).toHaveLength(1) await expect(drawing).toContainText('Image to Video (LTX-2.3)') + // Fitting the whole drawing into the panel renders its titles at a few + // pixels, so it opens zoomed onto the node the workflow starts from. + const zoom = () => + graph + .getByText('%') + .evaluate((el) => Number(el.textContent.replace('%', ''))) + const opening = await zoom() + expect(opening).toBeGreaterThan(100) + // The controls sit inside the draggable frame; a press on them has to reach // them rather than the frame. await graph.getByRole('button', { name: 'Zoom in' }).click() - await expect(graph).toContainText('120%') + await expect.poll(zoom).toBeGreaterThan(opening) const frame = await graph.boundingBox() const drawn = await drawing.locator('g').first().boundingBox() - const centre = { - x: drawn!.x + drawn!.width / 2, - y: drawn!.y + drawn!.height / 2 - } - // Zooming keeps the drawing where it was rather than carrying it off-frame. - expect(centre.x).toBeGreaterThan(frame!.x) - expect(centre.x).toBeLessThan(frame!.x + frame!.width) - expect(centre.y).toBeGreaterThan(frame!.y) - expect(centre.y).toBeLessThan(frame!.y + frame!.height) + // Zooming keeps the drawing under the frame rather than carrying it off. + expect(drawn!.x).toBeLessThan(frame!.x + frame!.width) + expect(drawn!.x + drawn!.width).toBeGreaterThan(frame!.x) + expect(drawn!.y).toBeLessThan(frame!.y + frame!.height) + expect(drawn!.y + drawn!.height).toBeGreaterThan(frame!.y) await graph.getByRole('button', { name: 'Reset' }).click() - await expect(graph).toContainText('100%') + await expect.poll(zoom).toBe(opening) }) test('withholds workflow discovery and direct pages when the workflow flag is off', async ({ @@ -513,3 +518,21 @@ test('keeps the workflow form inside a phone screen @mobile', async ({ const box = await footer.boundingBox() expect((box?.x ?? 0) + (box?.width ?? 0)).toBeLessThanOrEqual(viewportWidth) }) + +test('the examples below the form read and mark themselves like a model page', async ({ + page, + context +}) => { + await mockWorkflowVisibility(context, true) + await page.goto('/models/workflows/change-material/') + + await expect( + page.getByRole('heading', { name: 'Try an example' }) + ).toBeVisible() + + const example = page.getByRole('button', { + name: /A softer finish for a leather sofa/ + }) + await expect(example).toHaveAttribute('aria-current', 'true') + await expect(page.getByTestId('workflow-example-chosen')).toHaveCount(1) +}) diff --git a/apps/website/e2e/workshop.spec.ts b/apps/website/e2e/workshop.spec.ts index 16d01a859a5..792315618f6 100644 --- a/apps/website/e2e/workshop.spec.ts +++ b/apps/website/e2e/workshop.spec.ts @@ -290,6 +290,21 @@ test.describe('Models catalog', () => { await expect(page.getByTestId('workshop-sections')).toBeVisible() }) + test('an opened shelf reads as a chosen filter', async ({ page }) => { + await page.goto('/models/') + await page.getByTestId('section-generate-videos-open').click() + await expect(page.getByRole('heading', { level: 1 })).toContainText( + 'Generate videos' + ) + await expect(page.getByTestId('workshop-filter-count')).toHaveText('1') + await page.getByTestId('workshop-filter').click() + await expect(page.getByTestId('workshop-filter-applied')).toHaveText( + '1 selected' + ) + await page.getByTestId('workshop-filter-clear').click() + await expect(page.getByTestId('workshop-sections')).toBeVisible() + }) + test('a model page returns to the shelf it was opened from', async ({ page }) => { @@ -531,6 +546,65 @@ test.describe('Models catalog', () => { }) test.describe('Model playground', () => { + test('keeps a long prompt whole instead of scrolling it out of sight', async ({ + page + }) => { + await page.goto(MODEL_PATH) + const prompt = page.getByTestId('field-prompt') + const hidden = () => + prompt.evaluate((box) => box.scrollHeight - box.clientHeight) + const height = () => prompt.evaluate((box) => box.clientHeight) + + await prompt.fill( + Array.from({ length: 12 }, (_, line) => `Line ${line + 1}.`).join('\n') + ) + await expect.poll(hidden).toBeLessThanOrEqual(1) + const tall = await height() + + await prompt.fill('One line.') + await expect.poll(height).toBeLessThan(tall) + await expect.poll(hidden).toBeLessThanOrEqual(1) + }) + + test('keeps a long prompt whole when the layout narrows under it', async ({ + page + }) => { + await page.goto(MODEL_PATH) + const prompt = page.getByTestId('field-prompt') + const hidden = () => + prompt.evaluate((box) => box.scrollHeight - box.clientHeight) + + await prompt.fill( + 'A slow push-in on a glass teapot lit from behind by a low winter sun, steam rising and catching the light while the room around it stays in shadow, the reflections on the table kept sharp and the background soft, with no people, no text and no logos anywhere in the frame.' + ) + await expect.poll(hidden).toBeLessThanOrEqual(1) + + await page.setViewportSize({ width: 380, height: 900 }) + + await expect.poll(hidden).toBeLessThanOrEqual(1) + }) + + test('stops the prompt box short of swallowing the window', async ({ + page + }) => { + await page.setViewportSize({ width: 1280, height: 800 }) + await page.goto(MODEL_PATH) + const prompt = page.getByTestId('field-prompt') + + await prompt.fill( + Array.from({ length: 60 }, (_, line) => `Line ${line + 1}.`).join('\n') + ) + + // A prompt this long would bury the rest of the form, so the box keeps a + // share of the window and scrolls what is left. + await expect + .poll(() => prompt.evaluate((box) => box.clientHeight)) + .toBeLessThan(800) + await expect + .poll(() => prompt.evaluate((box) => box.scrollHeight - box.clientHeight)) + .toBeGreaterThan(1) + }) + test('puts data-declared parameters in the Advanced disclosure', async ({ page }) => { @@ -593,7 +667,7 @@ test.describe('Model playground', () => { await page .getByRole('navigation', { name: 'Main navigation', exact: true }) - .getByRole('link', { name: 'Models', exact: true }) + .getByRole('link', { name: 'Hub', exact: true }) .click() await page.getByTestId('workshop-search').fill('Seedream 4.5 Image Edit') await page.getByRole('link', { name: /Seedream 4\.5 Image Edit/ }).click() @@ -711,6 +785,13 @@ test.describe('Model playground', () => { await prompt.fill('') await page.getByTestId('example-card').first().click() + const dialog = page.getByTestId('example-replace-dialog') + await expect(dialog.getByRole('heading')).toHaveText('Load this example?') + await expect(dialog.getByRole('button')).toHaveCount(2) + await expect(dialog.getByRole('button', { name: 'Cancel' })).toBeVisible() + await expect( + dialog.getByRole('button', { name: 'Load example' }) + ).toBeVisible() await page.getByTestId('example-replace-keep').click() await expect(page.getByTestId('example-replace-dialog')).toHaveCount(0) diff --git a/apps/website/public/workflow-graphs/remove-object.json b/apps/website/public/workflow-graphs/remove-object.json index 93400b88309..b9cb0977950 100644 --- a/apps/website/public/workflow-graphs/remove-object.json +++ b/apps/website/public/workflow-graphs/remove-object.json @@ -140,7 +140,7 @@ "id": 16, "type": "LoadImageMask", "title": "Edit mask (white = edit)", - "pos": [300, 600], + "pos": [-2900, 5390], "size": [300, 310], "flags": {}, "order": 0, diff --git a/apps/website/public/workflow-graphs/remove-object.svg b/apps/website/public/workflow-graphs/remove-object.svg index 4c408a50a1a..48338fb0e13 100644 --- a/apps/website/public/workflow-graphs/remove-object.svg +++ b/apps/website/public/workflow-graphs/remove-object.svg @@ -1 +1 @@ -Workflow graph and nested graphsOriginal node positions and connections. Notes and widget previews are available in the downloadable workflow.Workflow overviewLoad ImageIMAGEMASKSave Image AdvancedimagesimagesImage Compareimage_aimage_bBria EraserimagemaskIMAGEEdit mask (white = edit)MASK +Workflow graph and nested graphsOriginal node positions and connections. Notes and widget previews are available in the downloadable workflow.Workflow overviewLoad ImageIMAGEMASKSave Image AdvancedimagesimagesImage Compareimage_aimage_bBria EraserimagemaskIMAGEEdit mask (white = edit)MASK diff --git a/apps/website/src/components/common/HeaderMain/HeaderMain.test.ts b/apps/website/src/components/common/HeaderMain/HeaderMain.test.ts index c0cfa2b7390..7607d487ca5 100644 --- a/apps/website/src/components/common/HeaderMain/HeaderMain.test.ts +++ b/apps/website/src/components/common/HeaderMain/HeaderMain.test.ts @@ -47,13 +47,13 @@ describe('HeaderMain workshop gating', () => { { workshopInBuild: true, enabled: false, modelsAvailable: false }, { workshopInBuild: true, enabled: true, modelsAvailable: true } ])( - 'renders Models availability as $modelsAvailable when workshopInBuild is $workshopInBuild', + 'renders Hub availability as $modelsAvailable when workshopInBuild is $workshopInBuild', async ({ workshopInBuild, enabled, modelsAvailable }) => { visibility.value = enabled renderHeader(workshopInBuild) await nextTick() - expect(screen.queryByRole('link', { name: /^Models\b/i }) !== null).toBe( + expect(screen.queryByRole('link', { name: /^Hub\b/i }) !== null).toBe( modelsAvailable ) } @@ -180,14 +180,14 @@ describe('HeaderMain workshop gating', () => { it('updates navigation and removes the account controls when access is revoked', async () => { flag.value = true renderHeader(true) - expect(screen.queryByRole('link', { name: /^Models\b/i })).toBeNull() + expect(screen.queryByRole('link', { name: /^Hub\b/i })).toBeNull() expect(screen.queryByTestId('header-account')).toBeNull() visibility.value = true - await screen.findByRole('link', { name: /^Models\b/i }) + await screen.findByRole('link', { name: /^Hub\b/i }) visibility.value = false await nextTick() - expect(screen.queryByRole('link', { name: /^Models\b/i })).toBeNull() + expect(screen.queryByRole('link', { name: /^Hub\b/i })).toBeNull() expect(screen.queryByTestId('header-account')).toBeNull() }) }) diff --git a/apps/website/src/components/common/HeaderMain/HeaderMainDesktop.test.ts b/apps/website/src/components/common/HeaderMain/HeaderMainDesktop.test.ts index 57781428b8e..e2104228e21 100644 --- a/apps/website/src/components/common/HeaderMain/HeaderMainDesktop.test.ts +++ b/apps/website/src/components/common/HeaderMain/HeaderMainDesktop.test.ts @@ -8,15 +8,15 @@ async function modelsLink(path: string) { history.replaceState(null, '', path) render(HeaderMainDesktop, { props: { workshopInBuild: true } }) await nextTick() - return screen.getByRole('link', { name: /^Models\b/i }) + return screen.getByRole('link', { name: /^Hub\b/i }) } describe('HeaderMainDesktop', () => { - it('does not add Models navigation without a build opt-in', () => { + it('does not add Hub navigation without a build opt-in', () => { render(HeaderMainDesktop) - expect(screen.queryByRole('link', { name: /^Models\b/i })).toBeNull() + expect(screen.queryByRole('link', { name: /^Hub\b/i })).toBeNull() }) - it('renders the Models leaf link with its NEW badge', async () => { + it('renders the Hub leaf link with its NEW badge', async () => { const link = await modelsLink('/pricing') expect(link.getAttribute('href')).toBe('/models') expect(link.textContent).toMatch(/new/i) @@ -28,7 +28,7 @@ describe('HeaderMainDesktop', () => { expect(link.getAttribute('data-active')).not.toBeNull() }) - it('keeps Products inactive on the Models page it also links to', async () => { + it('keeps Products inactive on the Hub page it also links to', async () => { await modelsLink('/models') const products = screen.getByRole('button', { name: /products/i }) expect(products.getAttribute('data-active')).toBeNull() diff --git a/apps/website/src/components/common/HeaderMain/HeaderMainMobile.test.ts b/apps/website/src/components/common/HeaderMain/HeaderMainMobile.test.ts index 796d9691c7d..e06d3f8eb01 100644 --- a/apps/website/src/components/common/HeaderMain/HeaderMainMobile.test.ts +++ b/apps/website/src/components/common/HeaderMain/HeaderMainMobile.test.ts @@ -11,16 +11,16 @@ async function openMenu(workshopInBuild: boolean) { } describe('HeaderMainMobile', () => { - it('omits Models when the workshop is not in the build', async () => { + it('omits the Hub when the workshop is not in the build', async () => { await openMenu(false) - expect(screen.queryByRole('link', { name: /^Models\b/i })).toBeNull() + expect(screen.queryByRole('link', { name: /^Hub\b/i })).toBeNull() }) - it('offers Models when the workshop is in the build', async () => { + it('offers the Hub when the workshop is in the build', async () => { await openMenu(true) - expect(screen.getByRole('link', { name: /^Models\b/i })).toBeTruthy() + expect(screen.getByRole('link', { name: /^Hub\b/i })).toBeTruthy() }) it('labels a new top-level section with a NEW badge', async () => { diff --git a/apps/website/src/components/home/DiscoveryWorkflowCard.test.ts b/apps/website/src/components/home/DiscoveryWorkflowCard.test.ts new file mode 100644 index 00000000000..4212a5893c2 --- /dev/null +++ b/apps/website/src/components/home/DiscoveryWorkflowCard.test.ts @@ -0,0 +1,22 @@ +import { render, screen } from '@testing-library/vue' +import { describe, expect, it } from 'vitest' + +import type { DiscoveryWorkflow } from '../../data/modelDiscovery' +import DiscoveryWorkflowCard from './DiscoveryWorkflowCard.vue' + +const workflow: DiscoveryWorkflow = { + name: 'Turn a rough sketch into a finished product render with reflections', + href: '/models/workflows/sketch-to-render/', + thumbnailUrl: '/fixture-workflow.png' +} + +describe('DiscoveryWorkflowCard', () => { + it('keeps the whole name within reach of a name the card cuts short', () => { + render(DiscoveryWorkflowCard, { props: { workflow } }) + + expect(screen.getByText(workflow.name)).toHaveAttribute( + 'title', + workflow.name + ) + }) +}) diff --git a/apps/website/src/components/home/DiscoveryWorkflowCard.vue b/apps/website/src/components/home/DiscoveryWorkflowCard.vue index 5a8e1133eac..9f7f3a0b819 100644 --- a/apps/website/src/components/home/DiscoveryWorkflowCard.vue +++ b/apps/website/src/components/home/DiscoveryWorkflowCard.vue @@ -14,12 +14,15 @@ const { workflow } = defineProps<{ workflow: DiscoveryWorkflow }>() class="absolute inset-0 size-full object-cover transition-transform duration-300 group-hover/card:scale-105" />