diff --git a/frontend/src/lib/pages/Portfolio.svelte b/frontend/src/lib/pages/Portfolio.svelte new file mode 100644 index 00000000000..20c3c2db3d1 --- /dev/null +++ b/frontend/src/lib/pages/Portfolio.svelte @@ -0,0 +1,66 @@ + + +
+
+ {#if !$authSignedInStore} + + {/if} + Card1 +
+
+ Card3 + Card4 +
+
+ + diff --git a/frontend/src/routes/(app)/(home)/+layout.svelte b/frontend/src/routes/(app)/(home)/+layout.svelte index 6a6a77092db..597f4bf6a97 100644 --- a/frontend/src/routes/(app)/(home)/+layout.svelte +++ b/frontend/src/routes/(app)/(home)/+layout.svelte @@ -14,9 +14,13 @@ - + {#if $ENABLE_PORTFOLIO_PAGE} - + {:else} + + + + {/if} diff --git a/frontend/src/routes/(app)/(nns)/portfolio/+page.svelte b/frontend/src/routes/(app)/(nns)/portfolio/+page.svelte index d65c499cdac..c0dcb5da757 100644 --- a/frontend/src/routes/(app)/(nns)/portfolio/+page.svelte +++ b/frontend/src/routes/(app)/(nns)/portfolio/+page.svelte @@ -1,5 +1,6 @@ - + diff --git a/frontend/src/tests/lib/pages/Portfolio.spec.ts b/frontend/src/tests/lib/pages/Portfolio.spec.ts new file mode 100644 index 00000000000..82adb96ed02 --- /dev/null +++ b/frontend/src/tests/lib/pages/Portfolio.spec.ts @@ -0,0 +1,28 @@ +import Portfolio from "$lib/pages/Portfolio.svelte"; +import { resetIdentity, setNoIdentity } from "$tests/mocks/auth.store.mock"; +import { PortfolioPagePo } from "$tests/page-objects/PortfolioPage.page-object"; +import { JestPageObjectElement } from "$tests/page-objects/jest.page-object"; +import { render } from "@testing-library/svelte"; + +describe("Portfolio page", () => { + const renderPage = () => { + const { container } = render(Portfolio); + + return PortfolioPagePo.under(new JestPageObjectElement(container)); + }; + + beforeEach(() => { + resetIdentity(); + }); + + it("should display the login card when the user is not logged in", async () => { + setNoIdentity(); + const po = renderPage(); + expect(await po.getLoginCard().isPresent()).toBe(true); + }); + + it("should not display the login card when the user is logged in", async () => { + const page = renderPage(); + expect(await page.getLoginCard().isPresent()).toBe(false); + }); +}); diff --git a/frontend/src/tests/page-objects/PortfolioPage.page-object.ts b/frontend/src/tests/page-objects/PortfolioPage.page-object.ts new file mode 100644 index 00000000000..5494f668070 --- /dev/null +++ b/frontend/src/tests/page-objects/PortfolioPage.page-object.ts @@ -0,0 +1,14 @@ +import type { PageObjectElement } from "$tests/types/page-object.types"; +import { BasePageObject } from "./base.page-object"; + +export class PortfolioPagePo extends BasePageObject { + private static readonly TID = "portfolio-page-component"; + + static under(element: PageObjectElement): PortfolioPagePo { + return new PortfolioPagePo(element.byTestId(PortfolioPagePo.TID)); + } + + getLoginCard() { + return this.getElement("portfolio-login-card"); + } +}