mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
update auth tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
import random
|
||||
import prisma.enums
|
||||
import prisma.errors
|
||||
import prisma.models
|
||||
@@ -526,7 +526,7 @@ async def get_user_profile(
|
||||
data=prisma.types.ProfileCreateInput(
|
||||
userId=user_id,
|
||||
name="No Profile Data",
|
||||
username="No Profile Data",
|
||||
username=f"{random.choice(['happy', 'clever', 'swift', 'bright', 'wise'])}-{random.choice(['fox', 'wolf', 'bear', 'eagle', 'owl'])}_{random.randint(1000,9999)}",
|
||||
description="No Profile Data",
|
||||
links=[],
|
||||
avatarUrl="",
|
||||
|
||||
@@ -130,6 +130,7 @@ export const MobileNavBar: React.FC<MobileNavBarProps> = ({
|
||||
<Button
|
||||
aria-label="Open menu"
|
||||
className="fixed right-4 top-4 z-50 flex h-14 w-14 items-center justify-center rounded-lg border border-neutral-500 bg-neutral-200 hover:bg-gray-200/50 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:bg-gray-700/50 md:hidden"
|
||||
data-testid="mobile-nav-bar-trigger"
|
||||
>
|
||||
{isOpen ? (
|
||||
<IconChevronUp className="h-8 w-8 stroke-black dark:stroke-white" />
|
||||
|
||||
@@ -78,6 +78,7 @@ export const ProfilePopoutMenu: React.FC<ProfilePopoutMenuProps> = ({
|
||||
aria-label="Open profile menu"
|
||||
aria-controls={popupId}
|
||||
aria-haspopup="true"
|
||||
data-testid="profile-popout-menu-trigger"
|
||||
>
|
||||
<Avatar className="h-10 w-10">
|
||||
<AvatarImage src={avatarSrc} alt="" aria-hidden="true" />
|
||||
|
||||
@@ -6,7 +6,7 @@ test.describe("Authentication", () => {
|
||||
await page.goto("/login");
|
||||
await loginPage.login(testUser.email, testUser.password);
|
||||
await test.expect(page).toHaveURL("/");
|
||||
await test.expect(page.getByText("Monitor")).toBeVisible();
|
||||
await test.expect(page.getByTestId("profile-popout-menu-trigger")).toBeVisible();
|
||||
});
|
||||
|
||||
test("user can logout successfully", async ({
|
||||
@@ -19,10 +19,11 @@ test.describe("Authentication", () => {
|
||||
|
||||
await test.expect(page).toHaveURL("/");
|
||||
|
||||
// Click on the user menu
|
||||
await page.getByRole("button", { name: "CN" }).click();
|
||||
// Click on the logout menu item
|
||||
await page.getByRole("menuitem", { name: "Log out" }).click();
|
||||
// Click on the profile menu trigger to open popout
|
||||
await page.getByTestId("profile-popout-menu-trigger").click();
|
||||
|
||||
// Click the logout button in the popout menu
|
||||
await page.getByRole("button", { name: "Log out" }).click();
|
||||
|
||||
await test.expect(page).toHaveURL("/login");
|
||||
});
|
||||
@@ -35,11 +36,15 @@ test.describe("Authentication", () => {
|
||||
await page.goto("/login");
|
||||
await loginPage.login(testUser.email, testUser.password);
|
||||
await page.goto("/");
|
||||
await page.getByRole("button", { name: "CN" }).click();
|
||||
await page.getByRole("menuitem", { name: "Log out" }).click();
|
||||
// Click on the profile menu trigger to open popout
|
||||
await page.getByTestId("profile-popout-menu-trigger").click();
|
||||
|
||||
// Click the logout button in the popout menu
|
||||
await page.getByRole("button", { name: "Log out" }).click();
|
||||
|
||||
await test.expect(page).toHaveURL("/login");
|
||||
await loginPage.login(testUser.email, testUser.password);
|
||||
await test.expect(page).toHaveURL("/");
|
||||
await test.expect(page.getByText("Monitor")).toBeVisible();
|
||||
await test.expect(page.getByTestId("profile-popout-menu-trigger")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ export class LoginPage {
|
||||
await passwordInput2.fill(password);
|
||||
|
||||
// Wait for the button to be ready
|
||||
const loginButton = this.page.getByRole("button", { name: "Log in" });
|
||||
const loginButton = this.page.getByRole("button", { name: "Log in", exact: true });
|
||||
await loginButton.waitFor({ state: "visible" });
|
||||
|
||||
// Start waiting for navigation before clicking
|
||||
@@ -45,7 +45,7 @@ export class LoginPage {
|
||||
await navigationPromise;
|
||||
|
||||
console.log("Navigation complete, waiting for network idle"); // Debug log
|
||||
await this.page.waitForLoadState("networkidle", { timeout: 60000 });
|
||||
await this.page.waitForLoadState("load", { timeout: 60000 });
|
||||
console.log("Login process complete"); // Debug log
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user