mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Refactor playwright tests, change button text for better usability and validate mimetype in API layer
This commit is contained in:
35
web-app/tests/shared.ts
Normal file
35
web-app/tests/shared.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
|
||||
export const userOwner = "test-owner";
|
||||
export const userCollab10 = "test-collab10";
|
||||
export const userCollab20 = "test-collab20";
|
||||
export const userCollab30 = "test-collab30";
|
||||
export const userDummy = "test-dummy";
|
||||
|
||||
export const collabUsers = new Map([
|
||||
[10, userCollab10],
|
||||
[20, userCollab20],
|
||||
[30, userCollab30]
|
||||
]);
|
||||
export const permissionLevels = [10, 20, 30];
|
||||
export const allUsers = [userOwner, userCollab10, userCollab20, userCollab30, userDummy];
|
||||
export const password = "T3stinguser?!";
|
||||
export const contentTypes = ["Blog", "Docs"];
|
||||
export const collabTestingWebsite = "Collaborator testing";
|
||||
|
||||
export const register = async (username: string, page: Page) => {
|
||||
await page.goto("/register");
|
||||
await page.getByLabel("Username:").click();
|
||||
await page.getByLabel("Username:").fill(username);
|
||||
await page.getByLabel("Password:").click();
|
||||
await page.getByLabel("Password:").fill(password);
|
||||
await page.getByRole("button", { name: "Register" }).click();
|
||||
};
|
||||
export const authenticate = async (username: string, page: Page) => {
|
||||
await page.goto("/login");
|
||||
await page.getByLabel("Username:").click();
|
||||
await page.getByLabel("Username:").fill(username);
|
||||
await page.getByLabel("Password:").click();
|
||||
await page.getByLabel("Password:").fill(password);
|
||||
await page.getByRole("button", { name: "Login" }).click();
|
||||
};
|
||||
Reference in New Issue
Block a user