Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci-superdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,10 @@ jobs:

- name: Run slow tests
run: pnpm test:slow

- name: Install Playwright for UMD smoke test
run: pnpm --filter @superdoc/umd-smoke-test exec playwright install --with-deps chromium

- name: Run UMD smoke test
working-directory: packages/superdoc/tests/umd-smoke
run: pnpm test
16 changes: 16 additions & 0 deletions packages/superdoc/tests/umd-smoke/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>UMD Smoke Test</title>
<link href="/dist/style.css" rel="stylesheet" />
<script src="/dist/superdoc.umd.js"></script>
</head>
<body>
<div id="editor" style="height: 100vh"></div>
<script>
var superdoc = new SuperDocLibrary.SuperDoc({ selector: '#editor' });
window.__SUPERDOC_READY__ = true;
</script>
</body>
</html>
11 changes: 11 additions & 0 deletions packages/superdoc/tests/umd-smoke/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@superdoc/umd-smoke-test",
"private": true,
"scripts": {
"test": "playwright test"
},
"devDependencies": {
"@playwright/test": "catalog:",
"serve": "^14.2.0"
}
}
15 changes: 15 additions & 0 deletions packages/superdoc/tests/umd-smoke/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from '@playwright/test';

export default defineConfig({
testDir: '.',
timeout: 15_000,
webServer: {
command: 'npx serve ../.. -l 3333 --no-clipboard',
url: 'http://localhost:3333',
timeout: 10_000,
},
use: {
baseURL: 'http://localhost:3333',
},
projects: [{ name: 'chromium', use: { channel: 'chrome' } }],
});
16 changes: 16 additions & 0 deletions packages/superdoc/tests/umd-smoke/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Rename Playwright smoke test to avoid Vitest collection

This file is added under packages/superdoc with a .test.ts suffix, so it is matched by the normal Vitest run (pnpm test in .github/workflows/ci-superdoc.yml runs before the Playwright step, and vitest.config.mjs includes ./packages/superdoc while packages/superdoc/vite.config.js only excludes **/*.spec.js). Because the test uses @playwright/test instead of Vitest’s test, Vitest will try to process it as a unit test file and can fail the pipeline before the dedicated UMD smoke test stage runs.

Useful? React with 👍 / 👎.


test('UMD bundle loads and initializes SuperDoc', async ({ page }) => {
const errors: string[] = [];
page.on('pageerror', (err) => errors.push(err.message));

await page.goto('/tests/umd-smoke/index.html');

const hasLibrary = await page.evaluate(() => typeof (window as any).SuperDocLibrary !== 'undefined');
expect(hasLibrary).toBe(true);

const ready = await page.evaluate(() => (window as any).__SUPERDOC_READY__ === true);
expect(ready).toBe(true);

expect(errors).toEqual([]);
});
1 change: 1 addition & 0 deletions packages/superdoc/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default defineConfig(({ mode, command }) => {
exclude: [
...configDefaults.exclude,
'**/*.spec.js',
'tests/umd-smoke/**',
],
},
build: {
Expand Down
11 changes: 10 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading