Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions apps/website/e2e/vfx-nav-attribution.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import assert from 'node:assert/strict'
import { expect } from '@playwright/test'
import { test } from './fixtures/blockExternalMedia'
import { expectIslandHydrated } from './fixtures/islands'

const TRACKED =
'https://cloud.comfy.org/?utm_source=comfy_org&utm_medium=website&utm_campaign=free_tier&utm_content=nav_try_cloud'
for (const { path, label, expected } of [
{
path: '/solutions/vfx/v3/',
label: 'TRY CLOUD FOR FREE',
expected: 'https://cloud.comfy.org/'
},
{
path: '/zh-CN/solutions/vfx/v3/',
label: '免费试用云端',
expected: 'https://cloud.comfy.org/'
},
{ path: '/solutions/vfx/', label: 'TRY CLOUD FOR FREE', expected: TRACKED },
{ path: '/zh-CN/solutions/vfx/', label: '免费试用云端', expected: TRACKED },
{ path: '/', label: 'TRY CLOUD FOR FREE', expected: TRACKED }
]) {
test(`${path} scopes cloud nav attribution in SSR and after hydration`, async ({
page
}) => {
const response = await page.goto(
`${path}?utm_source=linkedin&utm_medium=paid_social&utm_campaign=vfx`
)
assert(response)
const html = await response.text()
const serverHref = await page.evaluate(
({ html, label }) => {
const document = new DOMParser().parseFromString(html, 'text/html')
return Array.from(
document.querySelectorAll('[data-testid="desktop-nav-cta"] a')
)
.find((node) => node.getAttribute('aria-label') === label)
?.getAttribute('href')
},
{ html, label }
)
expect(serverHref).toBe(expected)
const nav = page
.getByTestId('desktop-nav-cta')
.getByRole('link', { name: label, exact: true })
await expectIslandHydrated(page, page.getByTestId('desktop-nav-cta'))
await expect(nav).toHaveAttribute('href', expected)
await page.evaluate(() =>
document.dispatchEvent(new Event('astro:page-load'))
)
await expect(nav).toHaveAttribute('href', expected)
})
}
for (const path of ['/solutions/vfx/v3/', '/zh-CN/solutions/vfx/v3/']) {
test(`${path} preserves attribution on contact, workflow and Studio signup links`, async ({
page
}) => {
await page.goto(`${path}?utm_source=linkedin&utm_campaign=vfx`)
await expect(
page.locator('[data-vfx-v3] a[href*="/contact/"]').first()
).toHaveAttribute(
'href',
/interest=vfx&landing_version=v3&utm_source=linkedin&utm_campaign=vfx/
)
await expect(
page.locator('[data-vfx-demo="swap"] [data-try-workflow]')
).toHaveAttribute(
'href',
'https://cloud.comfy.org/?share=28fa6219c110&utm_source=linkedin&utm_campaign=vfx'
)
await expect(
page.locator('[data-vfx-studio] a[href*="/cloud/signup"]').first()
).toHaveAttribute(
'href',
'https://cloud.comfy.org/cloud/signup?utm_source=linkedin&utm_campaign=vfx'
)
})
}
test('restores the normal nav URL when navigating away from V3', async ({
page
}) => {
await page.goto('/solutions/vfx/?utm_source=linkedin')
const nav = page
.getByTestId('desktop-nav-cta')
.getByRole('link', { name: 'TRY CLOUD FOR FREE', exact: true })
await expectIslandHydrated(page, page.getByTestId('desktop-nav-cta'))
await expect(nav).toHaveAttribute('href', TRACKED)
await page.evaluate(() => {
history.pushState(null, '', '/solutions/vfx/v3/?utm_source=linkedin')
document.dispatchEvent(new Event('astro:page-load'))
})
await expect(nav).toHaveAttribute('href', 'https://cloud.comfy.org/')
await page.evaluate(() => {
history.pushState(null, '', '/pricing/')
document.dispatchEvent(new Event('astro:page-load'))
})
await expect(nav).toHaveAttribute('href', TRACKED)
})
131 changes: 131 additions & 0 deletions apps/website/e2e/vfx-studio-signup.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import { join } from 'node:path'
import { expect } from '@playwright/test'
import type { Locator, Page } from '@playwright/test'
import { websiteRoot } from '@website/paths'
import { test } from './fixtures/blockExternalMedia'
import { expectIslandHydrated } from './fixtures/islands'
import { vfxMediaRoot } from '@/data/vfxMedia'

const SIGNUP = 'https://cloud.comfy.org/cloud/signup'
const QUERY =
'utm_source=linkedin&utm_medium=paid_social&utm_campaign=vfx&utm_content=v3'
const DESTINATION = `${SIGNUP}?${QUERY}`

async function clickSignup(_page: Page, studio: Locator, label: string) {
await studio.getByRole('link', { name: label }).click()
}
async function keyboardSignup(page: Page, studio: Locator, label: string) {
await studio.getByRole('link', { name: label }).focus()
await page.keyboard.press('Enter')
}
async function dropFootage(page: Page, studio: Locator) {
await studio.getByRole('tab', { name: 'SETTINGS' }).click()
const transfer = await page.evaluateHandle(() => {
const data = new DataTransfer()
data.items.add(
new File(['private-footage-bytes'], 'private-footage.mov', {
type: 'video/quicktime'
})
)
return data
})
await studio
.getByRole('textbox', { name: 'Describe the shot' })
.dispatchEvent('dragover', { dataTransfer: transfer })
await studio
.getByRole('textbox', { name: 'Describe the shot' })
.dispatchEvent('drop', { dataTransfer: transfer })
}

for (const { name, path, open, label, activate } of [
{
name: 'pointer',
path: '/solutions/vfx/v3/',
open: 'OPEN STUDIO',
label: 'SIGN UP TO TRY FREE',
activate: clickSignup
},
{
name: 'keyboard',
path: '/solutions/vfx/v3/',
open: 'OPEN STUDIO',
label: 'SIGN UP TO TRY FREE',
activate: keyboardSignup
},
{
name: 'file drop',
path: '/solutions/vfx/v3/',
open: 'OPEN STUDIO',
label: 'SIGN UP TO TRY FREE',
activate: dropFootage
},
{
name: 'Chinese pointer',
path: '/zh-CN/solutions/vfx/v3/',
open: '打开工作室',
label: '注册免费试用',
activate: clickSignup
}
]) {
test(`${name} footage intent enters signup without a picker or file transfer`, async ({
page,
context
}) => {
await context.route(`${vfxMediaRoot}/*.mp4`, (route) =>
route.fulfill({
path: join(websiteRoot, 'e2e/assets/vfx-playback.mp4'),
contentType: 'video/mp4'
})
)
await context.route(`${SIGNUP}**`, (route) =>
route.fulfill({
contentType: 'text/html',
body: '<h1>Existing signup destination</h1>'
})
)
await page.goto(
`${path}?${QUERY}&filename=page-query.mov&email=private@example.com`
)
const section = page.locator('[data-vfx-demo="relight"]')
await section
.locator('.vfx-canvas-window')
.evaluate((node) =>
node.scrollIntoView({ block: 'start', behavior: 'instant' })
)
await expect(section).toHaveAttribute('data-canvas-ready', '', {
timeout: 12000
})
await section.getByRole('button', { name: open, exact: true }).click()
const studio = section.locator('[data-vfx-studio]')
await expectIslandHydrated(
page,
page.getByRole('link', { name: label, exact: true })
)
const link = studio.getByRole('link', { name: label })
await expect(link).toHaveAttribute('href', DESTINATION)
await expect(studio.locator('input[type=file]')).toHaveCount(0)
let pickerOpened = false
page.on('filechooser', () => {
pickerOpened = true
})
const sent: string[] = []
page.on('request', (request) =>
sent.push(
JSON.stringify({
url: request.url(),
method: request.method(),
body: request.postData()
})
)
)
await activate(page, studio, label)
await expect(page).toHaveURL(DESTINATION)
expect(pickerOpened).toBe(false)
expect(sent.join('\n')).not.toContain('private-footage')
expect(sent.join('\n')).not.toContain('page-query.mov')
expect(sent.join('\n')).not.toContain('private@example.com')
await expect(
page.getByRole('heading', { name: 'Existing signup destination' })
).toBeVisible()
})
}
Loading
Loading