From afe7d41adf0737e810c91dda7ece495d01707db8 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 10 Feb 2026 19:09:54 +0100 Subject: [PATCH] :bug: Fix rpc methods on plugins e2e tests --- plugins/apps/e2e/src/utils/api.ts | 20 +++++++++++--------- plugins/docs/test-e2e.md | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/plugins/apps/e2e/src/utils/api.ts b/plugins/apps/e2e/src/utils/api.ts index 78355626db..ba05e46c33 100644 --- a/plugins/apps/e2e/src/utils/api.ts +++ b/plugins/apps/e2e/src/utils/api.ts @@ -1,23 +1,25 @@ 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`, { 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 }, ); @@ -35,7 +37,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 +67,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: { diff --git a/plugins/docs/test-e2e.md b/plugins/docs/test-e2e.md index 135c42e280..b92287a7bd 100644 --- a/plugins/docs/test-e2e.md +++ b/plugins/docs/test-e2e.md @@ -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';