Skip to content

Commit

Permalink
chore(web): fixing failing component cypress tests pr #5250
Browse files Browse the repository at this point in the history
  • Loading branch information
LetItRock committed Mar 1, 2024
1 parent 5a915f1 commit dae3b9f
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions apps/web/src/pages/templates/components/TestWorkflow.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,27 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { TestWrapper } from '../../../testing';
import { TestWorkflow } from './TestWorkflow';
import { TriggerTypeEnum } from '@novu/shared';
import { FormProvider, useForm } from 'react-hook-form';

const queryClient = new QueryClient();

const FormProviderWrapper = ({ children }) => {
const methods = useForm();

return <FormProvider {...methods}>{children}</FormProvider>;
};

describe('TestWorkflow Component', function () {
it('should display subscriberId and empty json values when there are no variables', function () {
cy.mount(
<QueryClientProvider client={queryClient}>
<TestWrapper>
<TestWorkflow
trigger={{ variables: [], type: TriggerTypeEnum.EVENT, identifier: '1234', subscriberVariables: [] }}
/>
</TestWrapper>
<FormProviderWrapper>
<TestWrapper>
<TestWorkflow
trigger={{ variables: [], type: TriggerTypeEnum.EVENT, identifier: '1234', subscriberVariables: [] }}
/>
</TestWrapper>
</FormProviderWrapper>
</QueryClientProvider>
);

Expand All @@ -26,16 +35,18 @@ describe('TestWorkflow Component', function () {
it('should add variables and subscriber variables to input fields', function () {
cy.mount(
<QueryClientProvider client={queryClient}>
<TestWrapper>
<TestWorkflow
trigger={{
variables: [{ name: 'firstVariable' }, { name: 'secondVariable' }],
type: TriggerTypeEnum.EVENT,
identifier: '1234',
subscriberVariables: [{ name: 'email' }],
}}
/>
</TestWrapper>
<FormProviderWrapper>
<TestWrapper>
<TestWorkflow
trigger={{
variables: [{ name: 'firstVariable' }, { name: 'secondVariable' }],
type: TriggerTypeEnum.EVENT,
identifier: '1234',
subscriberVariables: [{ name: 'email' }],
}}
/>
</TestWrapper>
</FormProviderWrapper>
</QueryClientProvider>
);

Expand Down

0 comments on commit dae3b9f

Please sign in to comment.