@ -164,9 +164,9 @@
|
|||||||
"workerDirectory": "public"
|
"workerDirectory": "public"
|
||||||
},
|
},
|
||||||
"nyc": {
|
"nyc": {
|
||||||
"lines": 65,
|
"statements": 70,
|
||||||
"statements": 65,
|
"lines": 70,
|
||||||
"functions": 55,
|
"functions": 60,
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/generated/**/*"
|
"src/generated/**/*"
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
import { CompaniesMockMode } from '~/pages/companies/CompaniesMockMode';
|
|
||||||
|
|
||||||
export function AuthLayout({ children }: React.PropsWithChildren) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<CompaniesMockMode />
|
|
||||||
{children}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,10 +1,12 @@
|
|||||||
|
import { getOperationName } from '@apollo/client/utilities';
|
||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { within } from '@storybook/testing-library';
|
||||||
|
import { graphql } from 'msw';
|
||||||
|
|
||||||
import { AuthModal } from '@/auth/components/Modal';
|
|
||||||
import { AuthLayout } from '@/ui/layout/components/AuthLayout';
|
|
||||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
|
||||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||||
|
|
||||||
|
import { GET_CURRENT_USER } from '../../../modules/users/queries';
|
||||||
|
import { mockedOnboardingUsersData } from '../../../testing/mock-data/users';
|
||||||
import { CreateProfile } from '../CreateProfile';
|
import { CreateProfile } from '../CreateProfile';
|
||||||
|
|
||||||
const meta: Meta<typeof CreateProfile> = {
|
const meta: Meta<typeof CreateProfile> = {
|
||||||
@ -17,15 +19,23 @@ export default meta;
|
|||||||
export type Story = StoryObj<typeof CreateProfile>;
|
export type Story = StoryObj<typeof CreateProfile>;
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
render: getRenderWrapperForPage(
|
render: getRenderWrapperForPage(<CreateProfile />, '/create/profile'),
|
||||||
<AuthLayout>
|
|
||||||
<AuthModal>
|
|
||||||
<CreateProfile />
|
|
||||||
</AuthModal>
|
|
||||||
</AuthLayout>,
|
|
||||||
'/auth/create-profile',
|
|
||||||
),
|
|
||||||
parameters: {
|
parameters: {
|
||||||
msw: graphqlMocks,
|
msw: [
|
||||||
|
graphql.query(
|
||||||
|
getOperationName(GET_CURRENT_USER) ?? '',
|
||||||
|
(req, res, ctx) => {
|
||||||
|
return res(
|
||||||
|
ctx.data({
|
||||||
|
currentUser: mockedOnboardingUsersData[1],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
await canvas.findByText('Create profile');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
|
import { getOperationName } from '@apollo/client/utilities';
|
||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { within } from '@storybook/testing-library';
|
||||||
|
import { graphql } from 'msw';
|
||||||
|
|
||||||
import { AuthModal } from '@/auth/components/Modal';
|
|
||||||
import { AuthLayout } from '@/ui/layout/components/AuthLayout';
|
|
||||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
|
||||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||||
|
|
||||||
|
import { GET_CURRENT_USER } from '../../../modules/users/queries';
|
||||||
|
import { mockedOnboardingUsersData } from '../../../testing/mock-data/users';
|
||||||
import { CreateWorkspace } from '../CreateWorkspace';
|
import { CreateWorkspace } from '../CreateWorkspace';
|
||||||
|
|
||||||
const meta: Meta<typeof CreateWorkspace> = {
|
const meta: Meta<typeof CreateWorkspace> = {
|
||||||
@ -17,15 +19,23 @@ export default meta;
|
|||||||
export type Story = StoryObj<typeof CreateWorkspace>;
|
export type Story = StoryObj<typeof CreateWorkspace>;
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
render: getRenderWrapperForPage(
|
render: getRenderWrapperForPage(<CreateWorkspace />, '/create/workspace'),
|
||||||
<AuthLayout>
|
|
||||||
<AuthModal>
|
|
||||||
<CreateWorkspace />
|
|
||||||
</AuthModal>
|
|
||||||
</AuthLayout>,
|
|
||||||
'/create-workspace',
|
|
||||||
),
|
|
||||||
parameters: {
|
parameters: {
|
||||||
msw: graphqlMocks,
|
msw: [
|
||||||
|
graphql.query(
|
||||||
|
getOperationName(GET_CURRENT_USER) ?? '',
|
||||||
|
(req, res, ctx) => {
|
||||||
|
return res(
|
||||||
|
ctx.data({
|
||||||
|
currentUser: mockedOnboardingUsersData[0],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
await canvas.findByText('Create your workspace');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { fireEvent, within } from '@storybook/testing-library';
|
||||||
|
|
||||||
import { AuthModal } from '@/auth/components/Modal';
|
|
||||||
import { AuthLayout } from '@/ui/layout/components/AuthLayout';
|
|
||||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||||
|
|
||||||
@ -17,15 +16,19 @@ export default meta;
|
|||||||
export type Story = StoryObj<typeof SignInUp>;
|
export type Story = StoryObj<typeof SignInUp>;
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
render: getRenderWrapperForPage(
|
render: getRenderWrapperForPage(<SignInUp />, '/sign-in'),
|
||||||
<AuthLayout>
|
|
||||||
<AuthModal>
|
|
||||||
<SignInUp />
|
|
||||||
</AuthModal>
|
|
||||||
</AuthLayout>,
|
|
||||||
'/',
|
|
||||||
),
|
|
||||||
parameters: {
|
parameters: {
|
||||||
msw: graphqlMocks,
|
msw: graphqlMocks,
|
||||||
|
cookie: {
|
||||||
|
tokenPair: '{}',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
const continueWithEmailButton = await canvas.findByText(
|
||||||
|
'Continue With Email',
|
||||||
|
);
|
||||||
|
|
||||||
|
await fireEvent.click(continueWithEmailButton);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { within } from '@storybook/testing-library';
|
||||||
|
|
||||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||||
@ -19,4 +20,8 @@ export const Default: Story = {
|
|||||||
parameters: {
|
parameters: {
|
||||||
msw: graphqlMocks,
|
msw: graphqlMocks,
|
||||||
},
|
},
|
||||||
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
await canvas.findByText('All opportunities');
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { within } from '@storybook/testing-library';
|
||||||
|
|
||||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||||
@ -22,4 +23,8 @@ export const Default: Story = {
|
|||||||
parameters: {
|
parameters: {
|
||||||
msw: graphqlMocks,
|
msw: graphqlMocks,
|
||||||
},
|
},
|
||||||
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
await canvas.findByText('Copy link');
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -60,3 +60,60 @@ export const mockedUsersData: Array<MockedUser> = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const mockedOnboardingUsersData: Array<MockedUser> = [
|
||||||
|
{
|
||||||
|
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
|
||||||
|
__typename: 'User',
|
||||||
|
email: 'workspace-onboarding@test.com',
|
||||||
|
displayName: '',
|
||||||
|
firstName: '',
|
||||||
|
lastName: '',
|
||||||
|
avatarUrl: null,
|
||||||
|
workspaceMember: {
|
||||||
|
__typename: 'WorkspaceMember',
|
||||||
|
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
|
||||||
|
workspace: {
|
||||||
|
__typename: 'Workspace',
|
||||||
|
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
|
||||||
|
displayName: '',
|
||||||
|
domainName: '',
|
||||||
|
inviteHash: 'twenty.com-invite-hash-1',
|
||||||
|
logo: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
|
||||||
|
__typename: 'UserSettings',
|
||||||
|
locale: 'en',
|
||||||
|
colorScheme: ColorScheme.System,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
|
||||||
|
__typename: 'User',
|
||||||
|
email: 'profile-onboarding@test.com',
|
||||||
|
displayName: '',
|
||||||
|
firstName: '',
|
||||||
|
lastName: '',
|
||||||
|
avatarUrl: null,
|
||||||
|
workspaceMember: {
|
||||||
|
__typename: 'WorkspaceMember',
|
||||||
|
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
|
||||||
|
workspace: {
|
||||||
|
__typename: 'Workspace',
|
||||||
|
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
|
||||||
|
displayName: 'Test',
|
||||||
|
domainName: 'test.com',
|
||||||
|
inviteHash: 'twenty.com-invite-hash-2',
|
||||||
|
logo: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
id: '7dfbc3f7-6e5e-4128-957e-8d86808cde9y',
|
||||||
|
__typename: 'UserSettings',
|
||||||
|
locale: 'en',
|
||||||
|
colorScheme: ColorScheme.System,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user