diff --git a/apps/website/e2e/workshop-apps.spec.ts b/apps/website/e2e/workshop-apps.spec.ts index 73be193df75..ada692eb684 100644 --- a/apps/website/e2e/workshop-apps.spec.ts +++ b/apps/website/e2e/workshop-apps.spec.ts @@ -73,3 +73,21 @@ test('sends the old studio address to the app page it named', async ({ await page.goto('/cinematic-studio/?app=reshoot&ux=d&model=flux') await expect(page).toHaveURL(/\/models\/apps\/reshoot\/\?ux=d&model=flux$/) }) + +test.describe('GitHub link before an app repo is published', () => { + for (const path of [ + '/models/apps/cinematic-studio/', + '/models/apps/reshoot/' + ]) + test(`shows a placeholder, not a link, on ${path}`, async ({ + page, + context + }) => { + await mockFlags(context, { apps: true, workflows: false }) + await page.goto(path) + await expect(page.getByText('GitHub · Coming soon')).toHaveCount(1) + await expect( + page.getByRole('link', { name: 'View on GitHub' }) + ).toHaveCount(0) + }) +}) diff --git a/apps/website/src/components/workshop/cinematic-studio/AppRepoLink.test.ts b/apps/website/src/components/workshop/cinematic-studio/AppRepoLink.test.ts new file mode 100644 index 00000000000..85bb466ec83 --- /dev/null +++ b/apps/website/src/components/workshop/cinematic-studio/AppRepoLink.test.ts @@ -0,0 +1,27 @@ +import { render, screen } from '@testing-library/vue' +import { describe, expect, it } from 'vitest' + +import AppRepoLink from './AppRepoLink.vue' + +describe('AppRepoLink', () => { + it('opens the app repository on GitHub in a new tab', () => { + render(AppRepoLink, { + props: { repo: 'https://github.com/Comfy-Org/comfy-examples' } + }) + + const link = screen.getByRole('link', { name: 'View on GitHub' }) + expect(link).toHaveAttribute( + 'href', + 'https://github.com/Comfy-Org/comfy-examples' + ) + expect(link).toHaveAttribute('target', '_blank') + expect(link).toHaveAttribute('rel', 'noopener noreferrer') + }) + + it('renders no link until the repository exists', () => { + render(AppRepoLink) + + expect(screen.getByText(/GitHub/)).toBeInTheDocument() + expect(screen.queryByRole('link')).toBeNull() + }) +}) diff --git a/apps/website/src/components/workshop/cinematic-studio/AppRepoLink.vue b/apps/website/src/components/workshop/cinematic-studio/AppRepoLink.vue new file mode 100644 index 00000000000..00998fa9521 --- /dev/null +++ b/apps/website/src/components/workshop/cinematic-studio/AppRepoLink.vue @@ -0,0 +1,37 @@ + + + diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicFirstRun.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicFirstRun.vue index d8bfda84889..26da21a33ec 100644 --- a/apps/website/src/components/workshop/cinematic-studio/CinematicFirstRun.vue +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicFirstRun.vue @@ -1,8 +1,10 @@