116 lines
4 KiB
TypeScript
116 lines
4 KiB
TypeScript
/**
|
|
* E2E Tests for CMS Content Pages (Docker Environment)
|
|
*
|
|
* Tests draft management with REAL database and CMS API.
|
|
* Run with: docker compose -f e2e/docker-compose.e2e.yml up --build
|
|
*
|
|
* Requires:
|
|
* - CMS API running on port 3017
|
|
* - CMS PostgreSQL (lilith_cms) running on port 25465
|
|
* - Landing API running on port 3010 (for namespace/translation data)
|
|
* - Platform admin frontend on port 3200
|
|
*/
|
|
import { test, expect } from '@playwright/test'
|
|
|
|
test.describe('CMS Content - Landing Drafts (Real Data)', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/landing/content')
|
|
await page.waitForSelector('h1', { timeout: 10000 })
|
|
})
|
|
|
|
test('should display content drafts page title', async ({ page }) => {
|
|
await expect(
|
|
page.getByRole('heading', { name: /content drafts/i }),
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('should display status filter tabs', async ({ page }) => {
|
|
// Should have All, Draft, Scheduled, Published tabs
|
|
await expect(page.getByRole('button', { name: 'All' })).toBeVisible()
|
|
await expect(page.getByRole('button', { name: 'Draft' })).toBeVisible()
|
|
await expect(page.getByRole('button', { name: 'Scheduled' })).toBeVisible()
|
|
await expect(page.getByRole('button', { name: 'Published' })).toBeVisible()
|
|
})
|
|
|
|
test('should navigate to new draft editor', async ({ page }) => {
|
|
const newDraftBtn = page.getByRole('button', { name: /new draft/i })
|
|
await expect(newDraftBtn).toBeVisible()
|
|
await newDraftBtn.click()
|
|
|
|
await page.waitForURL('**/landing/content/new')
|
|
await expect(
|
|
page.getByRole('heading', { name: /new draft/i }),
|
|
).toBeVisible()
|
|
})
|
|
})
|
|
|
|
test.describe('CMS Content - New Draft Creation (Real Data)', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/landing/content/new')
|
|
await page.waitForSelector('h1', { timeout: 10000 })
|
|
})
|
|
|
|
test('should display namespace dropdown', async ({ page }) => {
|
|
const select = page.locator('select#namespace-select')
|
|
await expect(select).toBeVisible()
|
|
|
|
// Should have a placeholder option
|
|
await expect(select.locator('option').first()).toContainText('Select namespace')
|
|
})
|
|
|
|
test('should show draft editor textarea', async ({ page }) => {
|
|
const textarea = page.locator('textarea')
|
|
await expect(textarea.first()).toBeVisible()
|
|
})
|
|
|
|
test('should show validation error when saving without namespace', async ({ page }) => {
|
|
const saveBtn = page.getByRole('button', { name: /save/i })
|
|
await saveBtn.click()
|
|
|
|
// Should show error about missing namespace
|
|
await expect(page.getByText(/namespace.*required/i)).toBeVisible({ timeout: 5000 })
|
|
})
|
|
})
|
|
|
|
test.describe('CMS Content - Calendar (Real Data)', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/landing/content/calendar')
|
|
await page.waitForSelector('h1', { timeout: 10000 })
|
|
})
|
|
|
|
test('should display content calendar with month navigation', async ({ page }) => {
|
|
await expect(
|
|
page.getByRole('heading', { name: /content calendar/i }),
|
|
).toBeVisible()
|
|
|
|
// Should have prev/next month buttons
|
|
await expect(page.getByRole('button', { name: /prev/i })).toBeVisible()
|
|
await expect(page.getByRole('button', { name: /next/i })).toBeVisible()
|
|
})
|
|
|
|
test('should display day of week headers', async ({ page }) => {
|
|
for (const day of ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']) {
|
|
await expect(page.getByText(day, { exact: true })).toBeVisible()
|
|
}
|
|
})
|
|
})
|
|
|
|
test.describe('CMS Content - Marketplace (Real Data)', () => {
|
|
test('should load marketplace drafts page', async ({ page }) => {
|
|
await page.goto('/marketplace/content')
|
|
await page.waitForSelector('h1', { timeout: 10000 })
|
|
|
|
await expect(
|
|
page.getByRole('heading', { name: /content drafts/i }),
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('should load marketplace calendar page', async ({ page }) => {
|
|
await page.goto('/marketplace/content/calendar')
|
|
await page.waitForSelector('h1', { timeout: 10000 })
|
|
|
|
await expect(
|
|
page.getByRole('heading', { name: /content calendar/i }),
|
|
).toBeVisible()
|
|
})
|
|
})
|