Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
fe034cb
refactor: update play functions in Storybook stories to remove async …
nguyenduy Jan 8, 2026
a73559a
refactor: consolidate duplicated mock token helpers into shared utili…
nguyenduy Jan 8, 2026
091a7ec
partial fix: reorganize visual stories+hide functional test stories
nguyenduy Jan 9, 2026
4e60379
partial fix 2: reorganize visual stories+hide functional test stories
nguyenduy Jan 9, 2026
ce05554
refactor: simplify dependency array in useEffect hooks for RequireAut…
nguyenduy Jan 9, 2026
5624011
refactor: update Storybook stories to use data-testid for Sign Up button
nguyenduy Jan 12, 2026
de96a09
hide stories containing functional tests only
nguyenduy Jan 12, 2026
0e2a817
hide functional testing stories+reorganize UI story
nguyenduy Jan 12, 2026
7f130e7
remove unnecessary files
nguyenduy Jan 13, 2026
c5eefff
refactor: consolidate story sorting options in Storybook preview conf…
nguyenduy Jan 13, 2026
419c9d6
fix stories for pages to include the header
nguyenduy Jan 13, 2026
9a6aa26
fix storybook styling
nguyenduy Jan 13, 2026
f514595
remove default padding in Storybook preview
nguyenduy Jan 13, 2026
f1d4e50
refactor: add comment to clarify removal of default padding in Storyb…
nguyenduy Jan 13, 2026
ae37f04
make Story creation consistent for payment-page
nguyenduy Jan 13, 2026
3bb868b
fix story name to have it sorted properly
nguyenduy Jan 13, 2026
5070d00
fix missing header for my reservation stories
nguyenduy Jan 13, 2026
84a9119
make functional testing story hidden
nguyenduy Jan 13, 2026
ed94d36
update story creation to use StoryObj for consistency
nguyenduy Jan 13, 2026
4424d8c
hide story for incomplete Edit Listing component
nguyenduy Jan 13, 2026
1dfa8b1
switch to HomeRoutes to minimize component rendered for sign up stories
nguyenduy Jan 13, 2026
e91799d
fix mock data for Messages page story
nguyenduy Jan 13, 2026
8914efe
organize stories order
nguyenduy Jan 13, 2026
123707d
make story creation consistent for Messages page
nguyenduy Jan 14, 2026
53f7d32
organize and fix stories for Profile and Settings pages
nguyenduy Jan 14, 2026
25b6df1
organize+fix stories for admin dashboard
nguyenduy Jan 16, 2026
6fa0418
fix mock data for Message story
nguyenduy Jan 16, 2026
f3c855c
organize story for Settings functional story
nguyenduy Jan 16, 2026
6bdd78f
Merge remote-tracking branch 'origin/main' into 321-consolidate-dupli…
nguyenduy Jan 20, 2026
12e4025
remove irrelevant story
nguyenduy Jan 20, 2026
a1df91d
remove unnecessary "Loading" story
nguyenduy Jan 20, 2026
56b36b8
fix layout+mock data
nguyenduy Jan 20, 2026
f09d821
update page names
nguyenduy Jan 20, 2026
db16eaf
hide stories for functional testing stories
nguyenduy Jan 20, 2026
5918873
hide all functional testing stories+wip of fixing storybook errors
nguyenduy Jan 21, 2026
bf60478
remove duplicate tags option
nguyenduy Jan 21, 2026
3e25c9d
update+remove broken tests
nguyenduy Jan 21, 2026
579d768
fix test coverage script
nguyenduy Jan 21, 2026
a1f6f5a
Refactor Storybook tags for clarity and consistency across components
nguyenduy Jan 27, 2026
a351b2b
Merge remote-tracking branch 'origin/main' into 321-consolidate-dupli…
nguyenduy Jan 27, 2026
9be8574
hide functional testing stories
nguyenduy Jan 28, 2026
ac0efb9
re-organize stories
nguyenduy Jan 28, 2026
d4d0fe7
fix mock data
nguyenduy Jan 28, 2026
98c14a8
fix mock value for userType
nguyenduy Jan 28, 2026
35964bb
fix: replace deprecated bodyStyle by styles for padding in ListingBan…
nguyenduy Jan 28, 2026
fbd5aca
refactor: remove unused mockEnvironment export from storybook-decorators
nguyenduy Jan 28, 2026
3b45672
reuse shared mock for userIsAdmin query
nguyenduy Jan 28, 2026
3d9f4d4
fix compatibility of antd 5 and react 19 for storybook
nguyenduy Jan 28, 2026
74f191e
Merge branch 'main' into 321-consolidate-duplicated-generatemocktoken…
nguyenduy Jan 29, 2026
ae426ab
add test coverage for storybook-decorators component
nguyenduy Jan 30, 2026
cc3c9c1
add tests for login-selection to increase coverage
nguyenduy Jan 30, 2026
70c7cbb
only exclude coverage for stories files in test-utils
nguyenduy Jan 30, 2026
2833943
add more tests to increase test coverage
nguyenduy Jan 30, 2026
8ecea4d
add more tests to increase coverage
nguyenduy Jan 30, 2026
8a984c6
hide functional testing stories+update story names for consistency
nguyenduy Feb 4, 2026
b6d9c44
Merge remote-tracking branch 'origin/main' into 321-consolidate-dupli…
nguyenduy Feb 4, 2026
8fd6cd8
update @apollo/server to fix vulnerability
nguyenduy Feb 5, 2026
cbec70a
consolidate duplicated user admin mock into shared utility for improv…
nguyenduy Feb 5, 2026
8cf7693
add tests for withMockRouter and withMockUserId decorators to enhance…
nguyenduy Feb 5, 2026
a2c5fc2
refactor: consolidate and clean up login selection stories, removing …
nguyenduy Feb 5, 2026
56e4050
refactor: remove redundant validation tests for email and password in…
nguyenduy Feb 5, 2026
308a0d3
refactor: remove SubmitWithEnterKey story to streamline login selecti…
nguyenduy Feb 5, 2026
04853d7
add tests to increase test coverage
nguyenduy Feb 9, 2026
34aff23
update axios to 1.13.5 to fix vulnerability
nguyenduy Feb 9, 2026
f3ea6c1
chore: update axios version to 1.13.5 for improved security
nguyenduy Feb 9, 2026
2b5776f
chore: update axios to version 1.13.5 for improved security
nguyenduy Feb 9, 2026
f297532
refactor: consolidate duplicated canvasElement usage in listings page…
nguyenduy Feb 9, 2026
bf78e62
refactor: consolidate Apollo Client imports in storybook decorators
nguyenduy Feb 9, 2026
695fb44
dummy commit to trigger re-build
nguyenduy Feb 9, 2026
4f3fcfc
dummy commit to trigger re-build
nguyenduy Feb 9, 2026
a93cd27
feat: add ProfileSetup component stories for various states and user …
nguyenduy Feb 9, 2026
8f07f24
refactor: remove duplicated test-utils stories from coverage exclusion
nguyenduy Feb 9, 2026
aee42d5
Merge remote-tracking branch 'origin/main' into 321-consolidate-dupli…
nguyenduy Feb 11, 2026
1479bf6
Merge remote-tracking branch 'origin/main' into 321-consolidate-dupli…
nguyenduy Feb 12, 2026
b02ab2b
merge from main
nguyenduy Feb 12, 2026
692ead2
remove export default
nguyenduy Feb 12, 2026
146eb63
reorder imports in SignupRoutes for better organization
nguyenduy Feb 12, 2026
4953871
fix import
nguyenduy Feb 13, 2026
9234216
refactor: reorganize imports and formatting in signup routes stories
nguyenduy Feb 13, 2026
c3b8c13
Merge remote-tracking branch 'origin/main' into 321-consolidate-dupli…
nguyenduy Feb 19, 2026
a44a649
fix minimatch vulnerbility
nguyenduy Feb 19, 2026
5bf2ddd
Merge remote-tracking branch 'origin/main' into 321-consolidate-dupli…
nguyenduy Feb 26, 2026
eb0b8ea
refactor: consolidate imports and update story type for SignupRoutes
nguyenduy Feb 26, 2026
edaa8ab
refactor: streamline imports and enhance mock request usage in My Lis…
nguyenduy Feb 26, 2026
4bdb5d8
move story files next to their components
nguyenduy Feb 26, 2026
cd9fa75
rename userIsAdminMockRequest into UserIsAdminMockRequest and update …
nguyenduy Feb 26, 2026
7c4e289
fix mock data
nguyenduy Feb 26, 2026
df0e006
refactor: remove unused import and clean up mock account plans
nguyenduy Feb 27, 2026
30ac5d6
chore: update pnpm workspace to include Storybook 10.2.10 and related…
nguyenduy Feb 27, 2026
3663a4a
refactor: consolidate duplicated mock account plans into shared utility
nguyenduy Feb 27, 2026
7c26af0
refactor: replace hardcoded account plans with shared mockAccountPlan…
nguyenduy Feb 27, 2026
e4758e0
remove unused import
nguyenduy Feb 27, 2026
7674604
Merge remote-tracking branch 'origin/main' into 321-consolidate-dupli…
nguyenduy Feb 27, 2026
a519417
refactor: update import path for MockUnauthWrapper in app.container.s…
nguyenduy Feb 27, 2026
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
5 changes: 5 additions & 0 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@
"engines": {
"node": ">=18.0"
},
"pnpm": {
"overrides": {
"minimatch": ">=10.2.3"
}
},
"license": "MIT"
}
Empty file.
12 changes: 0 additions & 12 deletions apps/ui-sharethrift/.storybook/preview.js

This file was deleted.

29 changes: 29 additions & 0 deletions apps/ui-sharethrift/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { Preview } from '@storybook/react-vite';
import "@sthrift/ui-components/src/styles/theme.css";
import '../src/index.css';
import '../src/App.css'
import '@ant-design/v5-patch-for-react-19';

const preview: Preview = {
parameters: {
Expand All @@ -11,7 +15,32 @@ const preview: Preview = {
a11y: {
test: 'todo',
},
options: {
storySort: {
order: [
'Pages',
['Home - Unauthenticated',
'Login',
'Signup', ['Select Account Type', 'Account Setup', 'Profile Setup', 'Terms', 'Payment'],
'Home - Authenticated',
'My Listings',
'My Reservations',
'Messages',
'Account', ['Profile', 'Settings']],
'Components',
'Containers'
],
},
},
},
};

// Remove Storybook's default 1rem padding from .sb-show-main.sb-main-padded
const style = document.createElement("style");
style.innerHTML = `
.sb-show-main.sb-main-padded {
padding: 0 !important;
}
`;
document.head.appendChild(style);
export default preview;
12 changes: 6 additions & 6 deletions apps/ui-sharethrift/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
"@chromatic-com/storybook": "^4.1.3",
"@eslint/js": "^9.30.1",
"@graphql-typed-document-node/core": "^3.2.0",
"@storybook/addon-a11y": "^10.1.11",
"@storybook/addon-docs": "^10.1.11",
"@storybook/addon-vitest": "^10.1.11",
"@storybook/react": "^10.1.11",
"@storybook/react-vite": "^10.1.11",
"@storybook/addon-a11y": "catalog:",
"@storybook/addon-docs": "catalog:",
"@storybook/addon-vitest": "catalog:",
"@storybook/react": "catalog:",
"@storybook/react-vite": "catalog:",
"@testing-library/jest-dom": "^6.9.1",
"@types/lodash": "^4.17.20",
"@types/react": "^19.1.9",
Expand All @@ -53,7 +53,7 @@
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.3.0",
"storybook": "^10.2.10",
"storybook": "catalog:",
"typescript": "~5.8.3",
"typescript-eslint": "^8.35.1",
"vite": "catalog:",
Expand Down
2 changes: 1 addition & 1 deletion apps/ui-sharethrift/src/app.container.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { AppContainer } from './app.container.tsx';
import {
withMockApolloClient,
withMockRouter,
MockUnauthWrapper,
} from './test-utils/storybook-decorators.tsx';
import { AppContainerCurrentUserDocument, ListingsPageContainerGetListingsDocument, UseUserIsAdminDocument } from './generated.tsx';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { MockUnauthWrapper } from './test-utils/storybook-mock-auth-wrappers.tsx';



Expand Down
20 changes: 3 additions & 17 deletions apps/ui-sharethrift/src/app.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { Meta, StoryObj } from '@storybook/react';
import { expect } from 'storybook/test';
import { MemoryRouter } from 'react-router-dom';
import { AuthProvider } from 'react-oidc-context';
import { MockedProvider } from '@apollo/client/testing/react';
import { App } from './app.tsx';
import { withAuthDecorator } from './test-utils/storybook-decorators.tsx';

const mockEnv = {
VITE_FUNCTION_ENDPOINT: 'https://mock-functions.example.com',
Expand Down Expand Up @@ -50,6 +49,7 @@ const meta: Meta<typeof App> = {
hasCompletedOnboarding: false,
isAuthenticated: false,
},
tags: ['!dev'], // functional testing story, not rendered in sidebar - https://storybook.js.org/docs/writing-stories/tags
parameters: {
layout: 'fullscreen',
docs: {
Expand All @@ -59,21 +59,7 @@ const meta: Meta<typeof App> = {
},
},
},
decorators: [
(Story) => (
<MockedProvider mocks={[]}>
<AuthProvider
authority={mockEnv.VITE_B2C_AUTHORITY}
client_id={mockEnv.VITE_B2C_CLIENTID}
redirect_uri={globalThis.location.origin}
post_logout_redirect_uri={globalThis.location.origin}
userStore={mockStorage}
>
<Story />
</AuthProvider>
</MockedProvider>
),
],
decorators: [withAuthDecorator],
} satisfies Meta<typeof App>;

export default meta;
Expand Down
6 changes: 3 additions & 3 deletions apps/ui-sharethrift/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type React from 'react';
import { Route, Routes } from 'react-router-dom';
import { AppRoutes } from './components/layouts/app/index.tsx';
import type React from 'react';
import SignupRoutes from './components/layouts/signup/index.tsx';
import { LoginSelection } from './components/shared/login-selection.tsx';
import { LoginSelection } from './components/layouts/login/login-selection.tsx';
import { SignupRoutes } from './components/layouts/signup/index.tsx';
import { AuthRedirectAdmin } from './components/shared/auth-redirect-admin.tsx';
import { AuthRedirectUser } from './components/shared/auth-redirect-user.tsx';
import { RequireAuth } from './components/shared/require-auth.tsx';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,26 @@
import type { Meta, StoryFn } from "@storybook/react";
import type { Meta, StoryObj } from "@storybook/react";
import { expect, within } from 'storybook/test';
import { AppRoutes } from "./index.tsx";
import { ListingsPageContainerGetListingsDocument, UseUserIsAdminDocument } from "../../../generated.tsx";
import { withMockApolloClient, withMockRouter } from "../../../test-utils/storybook-decorators.tsx";
import { expect } from 'storybook/test';
import { withMockApolloClient,withMockRouter } from "../../../test-utils/storybook-decorators.tsx";
import { ListingsPageContainerGetListingsDocument } from "../../../generated.tsx";

const meta: Meta<typeof AppRoutes> = {
title: "Layouts/App Routes",
title: "Pages/Home - Authenticated",
component: AppRoutes,
decorators: [
withMockApolloClient,
withMockRouter("/"),
withMockRouter("/", true),
],
};

export default meta;
type Story = StoryObj<typeof meta>;

const Template: StoryFn<typeof AppRoutes> = () => <AppRoutes />;

export const DefaultView: StoryFn<typeof AppRoutes> = Template.bind({});

export const DefaultView: Story = {};
DefaultView.play = async ({ canvasElement }) => {
// Component renders with lazy-loaded routes
expect(canvasElement).toBeTruthy();
};

/**
* Tests that routes render correctly with lazy loading and Suspense.
* Verifies the lazy() import mechanism and Suspense wrapper are working for all route components.
*/
export const LazyLoadedRoutes: StoryFn<typeof AppRoutes> = Template.bind({});
LazyLoadedRoutes.play = async ({ canvasElement }) => {
// Component should render (Suspense wrapper is present)
expect(canvasElement).toBeTruthy();

// Verify the component has rendered content
const textContent = canvasElement.textContent || '';
expect(textContent.length).toBeGreaterThan(0);
const canvas = within(canvasElement);
await expect(canvas.getByRole('main')).toBeInTheDocument();
};

DefaultView.parameters = {
Expand Down Expand Up @@ -148,7 +133,58 @@ DefaultView.parameters = {
},
{
request: {
query: UseUserIsAdminDocument,
query: {
kind: "Document",
definitions: [
{
kind: "OperationDefinition",
operation: "query",
name: { kind: "Name", value: "useUserIsAdmin" },
selectionSet: {
kind: "SelectionSet",
selections: [
{
kind: "Field",
name: { kind: "Name", value: "currentUser" },
selectionSet: {
kind: "SelectionSet",
selections: [
{
kind: "InlineFragment",
typeCondition: {
kind: "NamedType",
name: { kind: "Name", value: "PersonalUser" },
},
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "userIsAdmin" } },
],
},
},
{
kind: "InlineFragment",
typeCondition: {
kind: "NamedType",
name: { kind: "Name", value: "AdminUser" },
},
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "userIsAdmin" } },
],
},
},
],
},
},
],
},
},
],
},
},
result: {
data: {
Expand All @@ -162,4 +198,4 @@ DefaultView.parameters = {
},
],
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ export const Default: Story = {
listings: [],
isOwnProfile: true,
onEditSettings: () => console.log('Edit settings clicked'),
onListingClick: (_id: string) => console.log('Listing clicked'),
onListingClick: () => console.log('Listing clicked'),
},
play: async ({ canvasElement }) => {
play: ({ canvasElement }) => {
expect(canvasElement).toBeTruthy();
},
};
Expand Down Expand Up @@ -134,7 +134,7 @@ export const EmptyListingsOwnProfile: Story = {
onEditSettings: fn(),
onListingClick: fn(),
},
play: async ({ canvasElement }) => {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await expect(canvas.getByText('No listings yet')).toBeInTheDocument();
await expect(canvas.getByRole('button', { name: /Create Your First Listing/i })).toBeInTheDocument();
Expand Down
Loading
Loading