Compare commits

...

5 Commits

Author SHA1 Message Date
Andrey Antukh
0b68edf84e 🚧 WIP 2026-02-10 19:18:03 +01:00
Andrey Antukh
afe7d41adf 🐛 Fix rpc methods on plugins e2e tests 2026-02-10 19:09:54 +01:00
Andrey Antukh
96f9e796be Allow self-signed certs on plugins e2e browser setup 2026-02-10 19:09:00 +01:00
Andrey Antukh
28eac35660 Enable cors by default on devenv 2026-02-10 19:08:21 +01:00
Andrey Antukh
f4d07a3c36 ⬆️ Update pnpm on frontend and plugins modules 2026-02-10 19:02:32 +01:00
12 changed files with 54 additions and 21 deletions

View File

@@ -29,6 +29,8 @@ export PENPOT_FLAGS="\
enable-user-feedback \
disable-secure-session-cookies \
enable-smtp \
enable-cors \
disable-secure-session-cookies \
enable-prepl-server \
enable-urepl-server \
enable-rpc-climit \

View File

@@ -213,14 +213,14 @@
(assoc "access-control-allow-origin" origin)
(assoc "access-control-allow-methods" "GET,POST,DELETE,OPTIONS,PUT,HEAD,PATCH")
(assoc "access-control-allow-credentials" "true")
(assoc "access-control-expose-headers" "x-requested-with, content-type, cookie")
(assoc "access-control-allow-headers" "x-frontend-version, content-type, accept, x-requested-width")))
(assoc "access-control-expose-headers" "content-type, set-cookie")
(assoc "access-control-allow-headers" "x-frontend-version, x-client, x-requested-width, content-type, accept, cookie")))
(defn wrap-cors
[handler]
(fn [request]
(let [response (if (= (yreq/method request) :options)
{::yres/status 200}
{::yres/status 204}
(handler request))
origin (yreq/get-header request "origin")]
(update response ::yres/headers with-cors-headers origin))))

View File

@@ -4,7 +4,7 @@
"license": "MPL-2.0",
"author": "Kaleidos INC",
"private": true,
"packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264",
"packageManager": "pnpm@10.29.2+sha512.bef43fa759d91fd2da4b319a5a0d13ef7a45bb985a3d7342058470f9d2051a3ba8674e629672654686ef9443ad13a82da2beb9eeb3e0221c87b8154fff9d74b8",
"browserslist": [
"defaults"
],
@@ -47,12 +47,12 @@
"devDependencies": {
"@penpot/draft-js": "workspace:./packages/draft-js",
"@penpot/mousetrap": "workspace:./packages/mousetrap",
"@penpot/tokenscript": "workspace:./packages/tokenscript",
"@penpot/plugins-runtime": "1.4.2",
"@penpot/svgo": "penpot/svgo#v3.2",
"@penpot/text-editor": "workspace:./text-editor",
"@playwright/test": "1.58.0",
"@penpot/tokenscript": "workspace:./packages/tokenscript",
"@penpot/ui": "workspace:./packages/ui",
"@playwright/test": "1.58.0",
"@storybook/addon-docs": "10.1.11",
"@storybook/addon-themes": "10.1.11",
"@storybook/addon-vitest": "10.1.11",
@@ -103,6 +103,7 @@
"sass": "^1.89.0",
"sass-embedded": "^1.89.0",
"sax": "^1.4.1",
"scheduler": "^0.27.0",
"source-map-support": "^0.5.21",
"storybook": "10.1.11",
"style-dictionary": "5.0.0-rc.1",

View File

@@ -187,6 +187,9 @@ importers:
sax:
specifier: ^1.4.1
version: 1.4.4
scheduler:
specifier: ^0.27.0
version: 0.27.0
source-map-support:
specifier: ^0.5.21
version: 0.5.21

View File

@@ -11,7 +11,7 @@ import comments from './plugins/create-comments';
import { Agent } from './utils/agent';
describe('Plugins', () => {
it('create board - text - rectable', async () => {
it.only('create board - text - rectable', async () => {
const agent = await Agent();
const result = await agent.runCode(testingPlugin.toString(), {
screenshot: 'create-board-text-rect',

View File

@@ -56,10 +56,13 @@ export async function Agent() {
console.log('File URL:', fileUrl);
console.log('Launching browser...');
const browser = await puppeteer.launch({});
const browser = await puppeteer.launch({args: ['--ignore-certificate-errors']});
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 1080 });
await page.setExtraHTTPHeaders({
'X-Client': 'plugins/e2e:puppeter',
});
console.log('Setting authentication cookie...');
page.setCookie({

View File

@@ -1,27 +1,38 @@
import { FileRpc } from '../models/file-rpc.model';
const apiUrl = 'http://localhost:3449';
const apiUrl = 'https://localhost:3449';
export async function PenpotApi() {
if (!process.env['E2E_LOGIN_EMAIL']) {
throw new Error('E2E_LOGIN_EMAIL not set');
}
const body = JSON.stringify({
'email': process.env['E2E_LOGIN_EMAIL'],
'password': process.env['E2E_LOGIN_PASSWORD'],
});
const resultLoginRequest = await fetch(
`${apiUrl}/api/rpc/command/login-with-password`,
`${apiUrl}/api/main/methods/login-with-password`,
{
credentials: 'include',
method: 'POST',
headers: {
'Content-Type': 'application/transit+json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'~:email': process.env['E2E_LOGIN_EMAIL'],
'~:password': process.env['E2E_LOGIN_PASSWORD'],
}),
body: body
},
);
console.log("AAAAAAAAAAAA", 1, apiUrl)
// console.log("AAAAAAAAAAAA", 2, resultLoginRequest);
console.dir(resultLoginRequest.headers, {depth:20});
console.log('Document Cookies:', window.document.cookie);
const loginData = await resultLoginRequest.json();
const authToken = resultLoginRequest.headers
.get('set-cookie')
?.split(';')
@@ -35,7 +46,7 @@ export async function PenpotApi() {
getAuth: () => authToken,
createFile: async () => {
const createFileRequest = await fetch(
`${apiUrl}/api/rpc/command/create-file`,
`${apiUrl}/api/main/methods/create-file`,
{
method: 'POST',
headers: {
@@ -65,7 +76,7 @@ export async function PenpotApi() {
},
deleteFile: async (fileId: string) => {
const deleteFileRequest = await fetch(
`${apiUrl}/api/rpc/command/delete-file`,
`${apiUrl}/api/main/methods/delete-file`,
{
method: 'POST',
headers: {

View File

@@ -14,6 +14,6 @@ export default defineConfig({
reportsDirectory: '../coverage/e2e',
provider: 'v8',
},
setupFiles: ['dotenv/config'],
setupFiles: ['dotenv/config', 'vitest.setup.ts']
},
});

View File

@@ -0,0 +1,3 @@
// import { vi } from 'vitest';
window.location.href = 'https://localhost:3449';

View File

@@ -4,7 +4,7 @@
1. **Configure Environment Variables**
Create and populate the `.env` file with a valid user mail & password:
Create and populate the `apps/e2e/.env` file with a valid user mail & password:
```env
E2E_LOGIN_EMAIL="test@penpot.app"
@@ -24,7 +24,7 @@
1. **Adding Tests**
Place your test files in the `/apps/e2e/src/**/*.spec.ts` directory. Below is an example of a test file:
Place your test files in the `apps/e2e/src/**/*.spec.ts` directory. Below is an example of a test file:
```ts
import testingPlugin from './plugins/create-board-text-rect';

View File

@@ -3,7 +3,7 @@
"version": "0.6.0",
"type": "module",
"license": "MIT",
"packageManager": "pnpm@10.26.2+sha512.0e308ff2005fc7410366f154f625f6631ab2b16b1d2e70238444dd6ae9d630a8482d92a451144debc492416896ed16f7b114a86ec68b8404b2443869e68ffda6",
"packageManager": "pnpm@10.29.2+sha512.bef43fa759d91fd2da4b319a5a0d13ef7a45bb985a3d7342058470f9d2051a3ba8674e629672654686ef9443ad13a82da2beb9eeb3e0221c87b8154fff9d74b8",
"scripts": {
"start": "pnpm run start:app:runtime",
"start:app:runtime": "concurrently --kill-others --names build,server \"pnpm --filter @penpot/plugins-runtime run build:watch\" \"pnpm --filter @penpot/plugins-runtime run preview\"",
@@ -50,6 +50,7 @@
"@vitest/coverage-v8": "4.0.17",
"@vitest/ui": "4.0.17",
"concurrently": "^9.2.1",
"dotenv": "^17.2.4",
"esbuild": "^0.27.2",
"eslint": "9.39.2",
"eslint-config-prettier": "10.1.8",

View File

@@ -120,6 +120,9 @@ importers:
concurrently:
specifier: ^9.2.1
version: 9.2.1
dotenv:
specifier: ^17.2.4
version: 17.2.4
esbuild:
specifier: ^0.27.2
version: 0.27.2
@@ -3505,6 +3508,10 @@ packages:
domutils@3.2.2:
resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}
dotenv@17.2.4:
resolution: {integrity: sha512-mudtfb4zRB4bVvdj0xRo+e6duH1csJRM8IukBqfTRvHotn9+LBXB8ynAidP9zHqoRC/fsllXgk4kCKlR21fIhw==}
engines: {node: '>=12'}
dunder-proto@1.0.1:
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'}
@@ -10215,6 +10222,8 @@ snapshots:
domelementtype: 2.3.0
domhandler: 5.0.3
dotenv@17.2.4: {}
dunder-proto@1.0.1:
dependencies:
call-bind-apply-helpers: 1.0.2