|
| 1 | +// SPDX-License-Identifier: AGPL-3.0-or-later |
| 2 | +// Copyright (C) 2026 CrewForm |
| 3 | + |
| 4 | +/** |
| 5 | + * E2E — Critical path 4: Marketplace |
| 6 | + * |
| 7 | + * Verifies: browse → search → filter tags → view detail modal → install |
| 8 | + */ |
| 9 | + |
| 10 | +import { test, expect } from '@playwright/test' |
| 11 | + |
| 12 | +test.describe('Marketplace', () => { |
| 13 | + test('browse marketplace and see agent cards', async ({ page }) => { |
| 14 | + await page.goto('/marketplace') |
| 15 | + |
| 16 | + // Should see the marketplace heading |
| 17 | + await expect(page.getByRole('heading', { name: /marketplace/i })).toBeVisible() |
| 18 | + |
| 19 | + // Agent cards should load |
| 20 | + await expect( |
| 21 | + page.locator('button').filter({ hasText: /installs/i }).first(), |
| 22 | + ).toBeVisible({ timeout: 10_000 }) |
| 23 | + }) |
| 24 | + |
| 25 | + test('search filters agents', async ({ page }) => { |
| 26 | + await page.goto('/marketplace') |
| 27 | + |
| 28 | + // Wait for cards to load |
| 29 | + await expect( |
| 30 | + page.locator('button').filter({ hasText: /installs/i }).first(), |
| 31 | + ).toBeVisible({ timeout: 10_000 }) |
| 32 | + |
| 33 | + // Count initial cards |
| 34 | + const initialCount = await page.locator('button').filter({ hasText: /installs/i }).count() |
| 35 | + |
| 36 | + // Type in search |
| 37 | + await page.getByPlaceholder(/search/i).fill('code') |
| 38 | + |
| 39 | + // Wait for results to update |
| 40 | + await page.waitForTimeout(500) // debounce |
| 41 | + |
| 42 | + // Should have fewer or same cards (filtered) |
| 43 | + const filteredCount = await page.locator('button').filter({ hasText: /installs/i }).count() |
| 44 | + expect(filteredCount).toBeLessThanOrEqual(initialCount) |
| 45 | + }) |
| 46 | + |
| 47 | + test('click tag pill filters results', async ({ page }) => { |
| 48 | + await page.goto('/marketplace') |
| 49 | + |
| 50 | + // Wait for tags to load |
| 51 | + await expect( |
| 52 | + page.locator('button').filter({ hasText: /installs/i }).first(), |
| 53 | + ).toBeVisible({ timeout: 10_000 }) |
| 54 | + |
| 55 | + // Click a tag pill |
| 56 | + const tagPill = page.locator('button').filter({ hasText: /coding|research|writing/i }).first() |
| 57 | + if (await tagPill.isVisible({ timeout: 3_000 }).catch(() => false)) { |
| 58 | + await tagPill.click() |
| 59 | + // Results should update (at least some cards visible) |
| 60 | + await page.waitForTimeout(500) |
| 61 | + } |
| 62 | + }) |
| 63 | + |
| 64 | + test('open agent detail modal', async ({ page }) => { |
| 65 | + await page.goto('/marketplace') |
| 66 | + |
| 67 | + // Wait for cards to load |
| 68 | + await expect( |
| 69 | + page.locator('button').filter({ hasText: /installs/i }).first(), |
| 70 | + ).toBeVisible({ timeout: 10_000 }) |
| 71 | + |
| 72 | + // Click the first agent card |
| 73 | + await page.locator('button').filter({ hasText: /installs/i }).first().click() |
| 74 | + |
| 75 | + // Modal should open with agent details |
| 76 | + await expect(page.getByText(/system prompt/i)).toBeVisible({ timeout: 5_000 }) |
| 77 | + await expect(page.getByRole('button', { name: /install agent/i })).toBeVisible() |
| 78 | + }) |
| 79 | + |
| 80 | + test('close detail modal', async ({ page }) => { |
| 81 | + await page.goto('/marketplace') |
| 82 | + |
| 83 | + // Open modal |
| 84 | + await expect( |
| 85 | + page.locator('button').filter({ hasText: /installs/i }).first(), |
| 86 | + ).toBeVisible({ timeout: 10_000 }) |
| 87 | + await page.locator('button').filter({ hasText: /installs/i }).first().click() |
| 88 | + |
| 89 | + // Wait for modal |
| 90 | + await expect(page.getByText(/system prompt/i)).toBeVisible({ timeout: 5_000 }) |
| 91 | + |
| 92 | + // Close modal via X button |
| 93 | + await page.locator('button').filter({ has: page.locator('svg') }).first().click() |
| 94 | + |
| 95 | + // Modal should close — system prompt should not be visible |
| 96 | + await expect(page.getByText(/system prompt/i)).not.toBeVisible({ timeout: 3_000 }) |
| 97 | + }) |
| 98 | +}) |
0 commit comments