Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(portfolio): implement page loading states #6216

Merged
merged 8 commits into from
Jan 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions frontend/src/tests/lib/pages/Portfolio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ describe("Portfolio page", () => {
isStakeLoading: true,
};

// Test Case 1: Initial loading state - both tokens and projects loading
yhabib marked this conversation as resolved.
Show resolved Hide resolved
let po = renderPage({
userTokens: [loadingToken],
tableProjects: [loadingProject],
Expand All @@ -552,6 +553,8 @@ describe("Portfolio page", () => {
balanceInUsd: 100,
universeId: principal(1),
});

// Test Case 2: Partial loading state - tokens loaded, projects still loading
po = renderPage({
userTokens: [loadedToken],
tableProjects: [loadingProject],
Expand All @@ -571,6 +574,21 @@ describe("Portfolio page", () => {
isStakeLoading: false,
};

// Test Case 3: Partial loading state - projects loaded, tokens still loading
po = renderPage({
userTokens: [loadingToken],
tableProjects: [loadedProject],
});

expect(await po.getTotalAssetsCardPo().hasSpinner()).toEqual(true);
expect(await po.getHeldTokensSkeletonCard().isPresent()).toEqual(true);
expect(await po.getStakedTokensSkeletonCard().isPresent()).toEqual(
false
);
expect(await po.getHeldTokensCardPo().isPresent()).toEqual(false);
expect(await po.getStakedTokensCardPo().isPresent()).toEqual(true);

// Test Case 4: Fully loaded state - both tokens and projects loaded
po = renderPage({
userTokens: [loadedToken],
yhabib marked this conversation as resolved.
Show resolved Hide resolved
tableProjects: [loadedProject],
Expand Down