AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(frontend): Add marketplace creator page tests (#10429)
Abhimanyu Yadav326c4a9e0ceb
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/creator/[creator]/page.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/creator/[creator]/page.tsxindex 484022f151..f1c8a1e66f 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/creator/[creator]/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/creator/[creator]/page.tsx@@ -72,6 +72,7 @@ export default async function Page({About</p><div+ data-testid="creator-description"className="text-[48px] font-normal leading-[59px] text-neutral-900 dark:text-zinc-50"style={{ whiteSpace: "pre-line" }}>diff --git a/autogpt_platform/frontend/src/components/agptui/CreatorInfoCard.tsx b/autogpt_platform/frontend/src/components/agptui/CreatorInfoCard.tsxindex 5c3b9b1d01..1a89ef64ee 100644--- a/autogpt_platform/frontend/src/components/agptui/CreatorInfoCard.tsx+++ b/autogpt_platform/frontend/src/components/agptui/CreatorInfoCard.tsx@@ -41,7 +41,10 @@ export const CreatorInfoCard: React.FC<CreatorInfoCardProps> = ({</AvatarFallback></Avatar><div className="flex w-full flex-col items-start justify-start gap-1.5">- <div className="w-full font-poppins text-[35px] font-medium leading-10 text-neutral-900 dark:text-neutral-100 sm:text-[35px] sm:leading-10">+ <div+ data-testid="creator-title"+ className="w-full font-poppins text-[35px] font-medium leading-10 text-neutral-900 dark:text-neutral-100 sm:text-[35px] sm:leading-10"+ >{username}</div><div className="w-full text-lg font-normal leading-6 text-neutral-800 dark:text-neutral-200 sm:text-xl sm:leading-7">diff --git a/autogpt_platform/frontend/src/tests/marketplace-creator.spec.ts b/autogpt_platform/frontend/src/tests/marketplace-creator.spec.tsnew file mode 100644index 0000000000..8b3e2e1e64--- /dev/null+++ b/autogpt_platform/frontend/src/tests/marketplace-creator.spec.ts@@ -0,0 +1,79 @@+import { test } from "@playwright/test";+import { MarketplacePage } from "./pages/marketplace.page";+import { LoginPage } from "./pages/login.page";+import { isVisible, hasUrl, matchesUrl } from "./utils/assertion";+import { TEST_CREDENTIALS } from "./credentials";+import { getSelectors } from "./utils/selectors";++test.describe("Marketplace Creator Page – Basic Functionality", () => {+ test("User can access creator's page when logged out", async ({ page }) => {+ const marketplacePage = new MarketplacePage(page);++ await marketplacePage.goto(page);+ await hasUrl(page, "/marketplace");++ const firstCreatorProfile =+ await marketplacePage.getFirstCreatorProfile(page);+ await firstCreatorProfile.click();++ await page.waitForURL("**/marketplace/creator/**");+ await matchesUrl(page, /\/marketplace\/creator\/.+/);+ });++ test("User can access creator's page when logged in", async ({ page }) => {+ const loginPage = new LoginPage(page);+ const marketplacePage = new MarketplacePage(page);++ await loginPage.goto();+ await loginPage.login(TEST_CREDENTIALS.email, TEST_CREDENTIALS.password);+ await hasUrl(page, "/marketplace");++ await marketplacePage.goto(page);+ await hasUrl(page, "/marketplace");++ const firstCreatorProfile =+ await marketplacePage.getFirstCreatorProfile(page);+ await firstCreatorProfile.click();++ await page.waitForURL("**/marketplace/creator/**");+ await matchesUrl(page, /\/marketplace\/creator\/.+/);+ });++ test("Creator page details are visible", async ({ page }) => {+ const { getId } = getSelectors(page);+ const marketplacePage = new MarketplacePage(page);++ await marketplacePage.goto(page);+ await hasUrl(page, "/marketplace");++ const firstCreatorProfile =+ await marketplacePage.getFirstCreatorProfile(page);+ await firstCreatorProfile.click();+ await page.waitForURL("**/marketplace/creator/**");++ const creatorTitle = getId("creator-title");+ await isVisible(creatorTitle);++ const creatorDescription = getId("creator-description");+ await isVisible(creatorDescription);+ });++ test("Agents in agent by sections navigation works", async ({ page }) => {+ const marketplacePage = new MarketplacePage(page);++ await marketplacePage.goto(page);+ await hasUrl(page, "/marketplace");++ const firstCreatorProfile =+ await marketplacePage.getFirstCreatorProfile(page);+ await firstCreatorProfile.click();+ await page.waitForURL("**/marketplace/creator/**");+ const firstAgent = page+ .locator('[data-testid="store-card"]:visible')+ .first();++ await firstAgent.click();+ await page.waitForURL("**/marketplace/agent/**");+ await matchesUrl(page, /\/marketplace\/agent\/.+/);+ });+});