|
1 | 1 | import { expect, test } from '@playwright/test' |
2 | | -import type { APIRequestContext } from '@playwright/test' |
3 | | -import { signInAndGetSessionCookie, withAuthHeaders } from './helpers/auth' |
| 2 | +import { loginViaProgrammatic, signInAndGetSessionCookie, withAuthHeaders } from './helpers/auth' |
4 | 3 |
|
5 | 4 | const TEST_EMAIL = process.env.E2E_USER_EMAIL || 'test@preview.local' |
6 | 5 | const TEST_PASSWORD = process.env.E2E_USER_PASSWORD || 'password123' |
@@ -89,6 +88,119 @@ test('authenticated user can access products UI workflow', async ({ request, pag |
89 | 88 | await expect(page.getByText('Point a CNAME record to Veerify to use a custom domain.')).toHaveCount(0) |
90 | 89 | }) |
91 | 90 |
|
| 91 | +test('new project statuses tab shows the default starting workflow without declined or drag affordances', async ({ |
| 92 | + request, |
| 93 | + page, |
| 94 | +}) => { |
| 95 | + await loginViaProgrammatic(request, { email: TEST_EMAIL, password: TEST_PASSWORD }) |
| 96 | + |
| 97 | + const authCookies = (await request.storageState()).cookies.filter((cookie) => cookie.name.startsWith('better-auth')) |
| 98 | + expect(authCookies.length).toBeGreaterThan(0) |
| 99 | + await page.context().addCookies(authCookies) |
| 100 | + |
| 101 | + const activeTeamResponse = await request.get('/api/teams/active') |
| 102 | + const activeTeamPayload = await activeTeamResponse.json() |
| 103 | + expect(activeTeamResponse.ok()).toBeTruthy() |
| 104 | + const teamId = activeTeamPayload.data.id as string |
| 105 | + |
| 106 | + const projectSlug = `e2e-statuses-${Date.now()}` |
| 107 | + const createProjectResponse = await request.post(`/api/teams/${teamId}/projects`, { |
| 108 | + data: { |
| 109 | + name: 'Statuses Product', |
| 110 | + slug: projectSlug, |
| 111 | + description: null, |
| 112 | + customDomain: null, |
| 113 | + }, |
| 114 | + }) |
| 115 | + expect(createProjectResponse.status()).toBe(201) |
| 116 | + |
| 117 | + const statusesResponse = await request.get(`/api/projects/${projectSlug}/statuses`) |
| 118 | + const statusesPayload = await statusesResponse.json() |
| 119 | + expect(statusesResponse.ok()).toBeTruthy() |
| 120 | + const initialStatuses = statusesPayload.data as Array<{ name: string; value: string }> |
| 121 | + expect(initialStatuses.map((status) => status.name)).toEqual(['Open', 'Planned', 'In Progress', 'Completed', 'Closed']) |
| 122 | + expect(initialStatuses.map((status) => status.value)).not.toContain('declined') |
| 123 | + |
| 124 | + await page.goto(`/products/${projectSlug}#statuses`, { waitUntil: 'domcontentloaded', timeout: 180_000 }) |
| 125 | + await expect(page).toHaveURL(new RegExp(`/products/${projectSlug}#statuses$`)) |
| 126 | + await expect(page.getByText('Feedback Statuses')).toBeVisible() |
| 127 | + await expect( |
| 128 | + page.getByText('Review the default starting workflow for feedback items. Add a custom status to start customizing it.') |
| 129 | + ).toBeVisible() |
| 130 | + await expect( |
| 131 | + page.getByText('Using the default starting workflow. Add a custom status to replace it with your own workflow.') |
| 132 | + ).toBeVisible() |
| 133 | + |
| 134 | + for (const label of ['Open', 'Planned', 'In Progress', 'Completed', 'Closed']) { |
| 135 | + await expect(page.getByText(label, { exact: true })).toBeVisible() |
| 136 | + } |
| 137 | + await expect(page.getByText('Declined', { exact: true })).toHaveCount(0) |
| 138 | + await expect(page.locator('[data-testid^="product-status-drag-handle-"]')).toHaveCount(0) |
| 139 | +}) |
| 140 | + |
| 141 | +test('custom domain dns setup hides duplicate cname targets for the same host', async ({ request, page }) => { |
| 142 | + await loginViaProgrammatic(request, { email: TEST_EMAIL, password: TEST_PASSWORD }) |
| 143 | + |
| 144 | + const authCookies = (await request.storageState()).cookies.filter((cookie) => cookie.name.startsWith('better-auth')) |
| 145 | + expect(authCookies.length).toBeGreaterThan(0) |
| 146 | + await page.context().addCookies(authCookies) |
| 147 | + |
| 148 | + const activeTeamResponse = await request.get('/api/teams/active') |
| 149 | + const activeTeamPayload = await activeTeamResponse.json() |
| 150 | + expect(activeTeamResponse.ok()).toBeTruthy() |
| 151 | + const teamId = activeTeamPayload.data.id as string |
| 152 | + |
| 153 | + const projectSlug = `e2e-domain-${Date.now()}` |
| 154 | + const createProjectResponse = await request.post(`/api/teams/${teamId}/projects`, { |
| 155 | + data: { |
| 156 | + name: 'Domain Product', |
| 157 | + slug: projectSlug, |
| 158 | + description: null, |
| 159 | + customDomain: null, |
| 160 | + }, |
| 161 | + }) |
| 162 | + expect(createProjectResponse.status()).toBe(201) |
| 163 | + |
| 164 | + await page.route(`**/api/projects/${projectSlug}/verify-domain?**`, async (route) => { |
| 165 | + await route.fulfill({ |
| 166 | + status: 200, |
| 167 | + contentType: 'application/json', |
| 168 | + body: JSON.stringify({ |
| 169 | + hostname: 'feedback.example.com', |
| 170 | + provider: 'vercel', |
| 171 | + verified: false, |
| 172 | + status: 'ownership_verification_required', |
| 173 | + dnsRecords: [ |
| 174 | + { |
| 175 | + type: 'CNAME', |
| 176 | + name: 'feedback.example.com', |
| 177 | + value: '23f9267bd57617a5.vercel-dns-017.com.', |
| 178 | + }, |
| 179 | + { |
| 180 | + type: 'CNAME', |
| 181 | + name: 'feedback.example.com', |
| 182 | + value: 'cname.vercel-dns.com.', |
| 183 | + }, |
| 184 | + ], |
| 185 | + configuredBy: 'CNAME', |
| 186 | + expected: '23f9267bd57617a5.vercel-dns-017.com.', |
| 187 | + resolvedTo: [], |
| 188 | + message: null, |
| 189 | + }), |
| 190 | + }) |
| 191 | + }) |
| 192 | + |
| 193 | + await page.goto(`/products/${projectSlug}#domain`, { waitUntil: 'domcontentloaded', timeout: 180_000 }) |
| 194 | + await expect(page).toHaveURL(new RegExp(`/products/${projectSlug}#domain$`)) |
| 195 | + await expect(page.getByText('Required DNS records')).toBeVisible() |
| 196 | + |
| 197 | + await page.locator('#custom-domain').fill('feedback.example.com') |
| 198 | + await page.getByRole('button', { name: 'Check DNS' }).click() |
| 199 | + |
| 200 | + await expect(page.getByText('23f9267bd57617a5.vercel-dns-017.com.')).toBeVisible() |
| 201 | + await expect(page.getByText('cname.vercel-dns.com.')).toHaveCount(0) |
| 202 | +}) |
| 203 | + |
92 | 204 | test('project categories API supports create/update/reorder/delete with reassignment rules', async ({ request }) => { |
93 | 205 | const sessionCookie = await signInAndGetSessionCookie(request, { email: TEST_EMAIL, password: TEST_PASSWORD }) |
94 | 206 |
|
|
0 commit comments