Skip to content
Open
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
24 changes: 24 additions & 0 deletions e2e/tests/smoke.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { test, expect } = require('@playwright/test');

test.describe('Editor Smoke Test', () => {

test.beforeEach(async ({ page }) => {
await page.goto('/');
await expect(page.locator('.CodeMirror')).toBeVisible({ timeout: 15000 });
});

test('play button runs sketch', async ({ page }) => {
const playButton = page.locator('#play-sketch');

await expect(playButton).toBeVisible();
await playButton.click({ force: true });

// wait for preview trigger
await page.waitForTimeout(2000);

// ✅ ONLY reliable signal
const iframe = page.locator('iframe');
await expect(iframe).toBeVisible();
});

});
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "2.20.6",
"description": "The web editor for p5.js.",
"scripts": {
"test:e2e": "playwright test",
"test:e2e:headed": "playwright test --headed",
"test:e2e:debug": "playwright test --debug",
"clean": "rimraf dist",
"start": "cross-env BABEL_DISABLE_CACHE=1 NODE_ENV=development nodemon index.js",
"start:prod": "cross-env NODE_ENV=production node index.js",
Expand Down Expand Up @@ -97,6 +100,7 @@
"url": "git+https://github.com/catarak/p5.js-web-editor.git"
},
"devDependencies": {
"@playwright/test": "^1.45.0",
"@babel/eslint-parser": "^7.17.0",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.14.5",
Expand Down
25 changes: 25 additions & 0 deletions playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { defineConfig, devices } = require('@playwright/test');

module.exports = defineConfig({
testDir: './e2e/tests',

use: {
baseURL: process.env.BASE_URL || 'http://localhost:8000',
headless: true,
actionTimeout: 10000,
},

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],

webServer: {
command: 'npm run start',
url: 'http://localhost:8000',
timeout: 120000,
reuseExistingServer: !process.env.CI,
},
});
4 changes: 4 additions & 0 deletions test-results/.last-run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"status": "passed",
"failedTests": []
}