🐛 Fix rpc methods on plugins e2e tests

This commit is contained in:
Andrey Antukh
2026-02-10 19:09:54 +01:00
parent 96f9e796be
commit afe7d41adf
2 changed files with 13 additions and 11 deletions

View File

@@ -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: {

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';