Skip to content

Commit 831ef74

Browse files
committed
test: get first cmd
1 parent 508c796 commit 831ef74

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

tests/create-command.spec.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test.describe('Create Command', () => {
77

88
// Create command section should be visible (SSR)
99
// Use specific container to avoid matching README code blocks
10-
const createCommandSection = page.locator('.group\\/createcmd')
10+
const createCommandSection = page.locator('.group\\/createcmd').first()
1111
await expect(createCommandSection).toBeVisible()
1212
await expect(createCommandSection.locator('code')).toContainText(/create vite/i)
1313

@@ -23,7 +23,7 @@ test.describe('Create Command', () => {
2323

2424
// Create command section should be visible (SSR)
2525
// Use specific container to avoid matching README code blocks
26-
const createCommandSection = page.locator('.group\\/createcmd')
26+
const createCommandSection = page.locator('.group\\/createcmd').first()
2727
await expect(createCommandSection).toBeVisible()
2828
await expect(createCommandSection.locator('code')).toContainText(/create next-app/i)
2929

@@ -40,7 +40,7 @@ test.describe('Create Command', () => {
4040
// Create command section should be visible (SSR)
4141
// nuxt has create-nuxt package, so command is "npm create nuxt"
4242
// Use specific container to avoid matching README code blocks
43-
const createCommandSection = page.locator('.group\\/createcmd')
43+
const createCommandSection = page.locator('.group\\/createcmd').first()
4444
await expect(createCommandSection).toBeVisible()
4545
await expect(createCommandSection.locator('code')).toContainText(/create nuxt/i)
4646
})
@@ -55,7 +55,8 @@ test.describe('Create Command', () => {
5555
await expect(page.locator('h1').filter({ hasText: 'color' })).toBeVisible()
5656

5757
// Create command section should NOT be visible (different maintainers)
58-
const createCommandSection = page.locator('.group\\/createcmd')
58+
// Use .first() for consistency, though none should exist
59+
const createCommandSection = page.locator('.group\\/createcmd').first()
5960
await expect(createCommandSection).not.toBeVisible()
6061
})
6162

@@ -69,7 +70,8 @@ test.describe('Create Command', () => {
6970
await expect(page.locator('h1').filter({ hasText: 'lodash' })).toBeVisible()
7071

7172
// Create command section should NOT be visible (no create-lodash exists)
72-
const createCommandSection = page.locator('.group\\/createcmd')
73+
// Use .first() for consistency, though none should exist
74+
const createCommandSection = page.locator('.group\\/createcmd').first()
7375
await expect(createCommandSection).not.toBeVisible()
7476
})
7577
})
@@ -83,7 +85,7 @@ test.describe('Create Command', () => {
8385
await expect(page.locator('h1')).toContainText('vite')
8486

8587
// Find the create command container (wait longer for API response)
86-
const createCommandContainer = page.locator('.group\\/createcmd')
88+
const createCommandContainer = page.locator('.group\\/createcmd').first()
8789
await expect(createCommandContainer).toBeVisible({ timeout: 15000 })
8890

8991
// Copy button should initially be hidden (opacity-0)
@@ -108,7 +110,7 @@ test.describe('Create Command', () => {
108110
await goto('/vite', { waitUntil: 'hydration' })
109111

110112
// Find and hover over the create command container
111-
const createCommandContainer = page.locator('.group\\/createcmd')
113+
const createCommandContainer = page.locator('.group\\/createcmd').first()
112114
await createCommandContainer.hover()
113115

114116
// Click the copy button
@@ -132,7 +134,7 @@ test.describe('Create Command', () => {
132134
await goto('/lodash', { waitUntil: 'hydration' })
133135

134136
// Find the install command container
135-
const installCommandContainer = page.locator('.group\\/installcmd')
137+
const installCommandContainer = page.locator('.group\\/installcmd').first()
136138
await expect(installCommandContainer).toBeVisible()
137139

138140
// Copy button should initially be hidden
@@ -157,7 +159,7 @@ test.describe('Create Command', () => {
157159
await goto('/lodash', { waitUntil: 'hydration' })
158160

159161
// Find and hover over the install command container
160-
const installCommandContainer = page.locator('.group\\/installcmd')
162+
const installCommandContainer = page.locator('.group\\/installcmd').first()
161163
await installCommandContainer.hover()
162164

163165
// Click the copy button

0 commit comments

Comments
 (0)