* [WEB-6776] feat: add e2e testing package with Playwright smoke tests Set up a shared root-level e2e/ package for end-to-end testing across web, admin, and space apps using Playwright. Includes project-based config, auth fixtures, API client utility, and an initial smoke test that verifies all three apps load successfully. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: rename e2e scripts to test:e2e to avoid turbo test pickup The general `turbo run test` task was picking up the e2e package's `test` script in CI, which fails without Playwright browsers installed. Renamed to `test:e2e` so it only runs explicitly via `pnpm test:e2e`. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
58 lines
1.9 KiB
TypeScript
58 lines
1.9 KiB
TypeScript
/**
|
|
* SPDX-FileCopyrightText: 2023-present Plane Software, Inc.
|
|
* SPDX-License-Identifier: LicenseRef-Plane-Commercial
|
|
*
|
|
* Licensed under the Plane Commercial License (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
* https://plane.so/legals/eula
|
|
*
|
|
* DO NOT remove or modify this notice.
|
|
* NOTICE: Proprietary and confidential. Unauthorized use or distribution is prohibited.
|
|
*/
|
|
|
|
import type { APIRequestContext } from "@playwright/test";
|
|
|
|
const API_BASE_URL = process.env.E2E_API_URL ?? "http://localhost:8000";
|
|
|
|
/**
|
|
* Direct API client for test setup/teardown.
|
|
* Use this to create test data via the API instead of through the UI.
|
|
*/
|
|
export class ApiClient {
|
|
constructor(private request: APIRequestContext) {}
|
|
|
|
async signIn(email: string, password: string): Promise<unknown> {
|
|
const response = await this.request.post(`${API_BASE_URL}/api/sign-in/`, {
|
|
data: { email, password, medium: "email" },
|
|
});
|
|
return response.json();
|
|
}
|
|
|
|
async createWorkspace(name: string, slug: string): Promise<unknown> {
|
|
const response = await this.request.post(`${API_BASE_URL}/api/v1/workspaces/`, {
|
|
data: { name, slug },
|
|
});
|
|
return response.json();
|
|
}
|
|
|
|
async createProject(workspaceSlug: string, name: string, identifier: string): Promise<unknown> {
|
|
const response = await this.request.post(`${API_BASE_URL}/api/v1/workspaces/${workspaceSlug}/projects/`, {
|
|
data: { name, identifier, network: 2 },
|
|
});
|
|
return response.json();
|
|
}
|
|
|
|
async createIssue(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
data: { name: string; [key: string]: unknown }
|
|
): Promise<unknown> {
|
|
const response = await this.request.post(
|
|
`${API_BASE_URL}/api/v1/workspaces/${workspaceSlug}/projects/${projectId}/issues/`,
|
|
{ data }
|
|
);
|
|
return response.json();
|
|
}
|
|
}
|