- Introduced a Makefile for streamlined commands related to building, running, and managing presentations. - Created package.json to define project metadata, dependencies, and scripts for development and testing. - Added .gitignore entries to exclude build artifacts and temporary files from version control. - Included playwright.config.mjs for end-to-end testing setup with Playwright. - Added README.md for project documentation, outlining setup instructions and development guidelines.
40 lines
1.8 KiB
JavaScript
40 lines
1.8 KiB
JavaScript
// @ts-check
|
|
import { readFileSync } from 'fs'
|
|
import { join as pathJoin } from 'path'
|
|
import { test, expect } from '@playwright/test'
|
|
|
|
const presJson = pathJoin(process.cwd(), 'portal', '.vitepress', 'data', 'presentations.json')
|
|
const SLUGS = JSON.parse(readFileSync(presJson, 'utf8')).map((p) => p.slug)
|
|
|
|
test.describe('Matrice présentations (chaque slug)', () => {
|
|
for (const slug of SLUGS) {
|
|
test(`fiche ${slug} : titre, liens, QR`, async ({ page }) => {
|
|
await page.goto(`/presentations/${slug}/`)
|
|
await expect(page.locator('h1')).toBeVisible()
|
|
const title = await page.locator('h1').textContent()
|
|
expect(title.length).toBeGreaterThan(0)
|
|
|
|
const deckPath = new RegExp(`/slides/${slug}/1/?$`)
|
|
await expect(page.getByRole('link', { name: 'Voir les slides' })).toHaveAttribute('href', deckPath)
|
|
await expect(page.getByRole('link', { name: 'Ouvrir dans un nouvel onglet' })).toHaveAttribute('href', deckPath)
|
|
await expect(page.locator('.qr-deck canvas')).toHaveCount(1)
|
|
})
|
|
|
|
test(`deck Slidev ${slug} : #app + titre`, async ({ page }) => {
|
|
await page.goto(`/slides/${slug}/1`)
|
|
await expect(page.locator('#app')).toBeAttached()
|
|
const t = await page.title()
|
|
expect(t.length).toBeGreaterThan(0)
|
|
})
|
|
|
|
test(`liste : carte ${slug} avec actions Fiche / Slides`, async ({ page }) => {
|
|
await page.goto('/presentations/')
|
|
const card = page
|
|
.locator('article.talk-card--list')
|
|
.filter({ has: page.locator(`a[href="/presentations/${slug}/"], a[href$="/presentations/${slug}/"]`) })
|
|
await expect(card.getByRole('link', { name: 'Fiche' })).toHaveAttribute('href', new RegExp(`/presentations/${slug}/`))
|
|
await expect(card.getByRole('link', { name: 'Slides' })).toHaveAttribute('href', new RegExp(`/slides/${slug}/1`))
|
|
})
|
|
}
|
|
})
|