CI / build (push) Failing after 6m2s
Introduce a Node build system for minified CSS/JS with content hashes, add PWA support, i18n helpers, accessibility improvements, and more translatable strings. Move theme configuration from bookmarks to localStorage, add Playwright tests, and set up CI workflows.
58 lines
2.2 KiB
JavaScript
58 lines
2.2 KiB
JavaScript
/**
|
|
* Smoke tests for the Shaarli Pro theme.
|
|
*
|
|
* These tests require a running Shaarli instance with the shaarli-pro theme
|
|
* activated. Set SHAARLI_URL before running.
|
|
*/
|
|
'use strict';
|
|
|
|
const { test, expect } = require('@playwright/test');
|
|
|
|
test.describe('Shaarli Pro theme smoke tests', () => {
|
|
test('homepage loads and shows the main layout', async ({ page }) => {
|
|
await page.goto('/');
|
|
await expect(page.locator('body')).toBeVisible();
|
|
// Sidebar or header should be present.
|
|
await expect(
|
|
page.locator('.shaarli-sidebar, .sidebar, header, .header')
|
|
).toHaveCount(1);
|
|
});
|
|
|
|
test('search overlay opens with the S shortcut', async ({ page }) => {
|
|
await page.goto('/');
|
|
const search = page.locator('.search-overlay, #search-overlay');
|
|
await expect(search).not.toBeVisible();
|
|
await page.keyboard.press('s');
|
|
await expect(search).toBeVisible();
|
|
await page.keyboard.press('Escape');
|
|
await expect(search).not.toBeVisible();
|
|
});
|
|
|
|
test('theme toggle changes data-theme attribute', async ({ page }) => {
|
|
await page.goto('/');
|
|
const toggle = page.locator('[data-theme-toggle], .theme-toggle, #theme-toggle');
|
|
if (await toggle.count() === 0) {
|
|
test.skip('No theme toggle found on this page');
|
|
}
|
|
const initialTheme = await page.locator('html').getAttribute('data-theme');
|
|
await toggle.click();
|
|
await page.waitForTimeout(200);
|
|
const newTheme = await page.locator('html').getAttribute('data-theme');
|
|
expect(newTheme).not.toEqual(initialTheme);
|
|
});
|
|
|
|
test('skip-link is present for keyboard users', async ({ page }) => {
|
|
await page.goto('/');
|
|
await expect(page.locator('.skip-link')).toHaveAttribute('href');
|
|
});
|
|
|
|
test('bulk selection button is present on link list', async ({ page }) => {
|
|
await page.goto('/');
|
|
const bulkButton = page.locator('[data-bulk-select], .bulk-select-toggle, #bulk-select');
|
|
if (await bulkButton.count() === 0) {
|
|
test.skip('No bulk selection button found');
|
|
}
|
|
await expect(bulkButton).toBeVisible();
|
|
});
|
|
});
|