feature/IO-3181-Test-Framework-Selection - Skeletons complete
This commit is contained in:
21
client/tests/e2e/utils/login.js
Normal file
21
client/tests/e2e/utils/login.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
export async function login(page, { email, password }) {
|
||||
// Navigate to the login page
|
||||
await page.goto("/"); // Adjust if your login route differs (e.g., '/login')
|
||||
|
||||
// Fill email field
|
||||
await page.fill('input[placeholder="Username"]', email); // Matches Ant Design Input placeholder
|
||||
|
||||
// Fill password field
|
||||
await page.fill('input[placeholder="Password"]', password);
|
||||
|
||||
// Click login button
|
||||
await page.click("button.login-btn");
|
||||
|
||||
// Wait for navigation or success indicator (e.g., redirect to /manage/)
|
||||
await page.waitForURL(/\/manage\//, { timeout: 10000 }); // Adjust based on redirect
|
||||
|
||||
// Verify successful login (e.g., check for a dashboard element)
|
||||
await expect(page.locator("text=Manage")).toBeVisible(); // Adjust to your app’s post-login UI
|
||||
}
|
||||
Reference in New Issue
Block a user