The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
test(workflow): wait for statuses recomputed by the status job (#27122)
Félix Malfaita28e8c81cca4
diff --git a/packages/twenty-server/test/integration/graphql/suites/workflow/if-else-workflow.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/workflow/if-else-workflow.integration-spec.tsindex 13c923b7b3d..03ee8df98bc 100644--- a/packages/twenty-server/test/integration/graphql/suites/workflow/if-else-workflow.integration-spec.ts+++ b/packages/twenty-server/test/integration/graphql/suites/workflow/if-else-workflow.integration-spec.ts@@ -4,6 +4,7 @@ import {runWorkflowVersion,waitForWorkflowCompletion,} from 'test/integration/graphql/suites/workflow/utils/workflow-run-test.util';+import { expectEventually } from 'test/integration/utils/expect-eventually.util';import { StepLogicalOperator, ViewFilterOperand } from 'twenty-shared/types';import { type StepIfElseBranch } from 'twenty-shared/workflow';import { v4 } from 'uuid';@@ -408,22 +409,25 @@ describe('If/Else Workflow (e2e)', () => {describe('Workflow structure', () => {it('should verify If/Else workflow exists and is active', async () => {- const response = await client- .post('/graphql')- .set('Authorization', `Bearer ${APPLE_JANE_ADMIN_ACCESS_TOKEN}`)- .send({- query: `- query FindWorkflow($id: UUID!) {- workflow(filter: { id: { eq: $id } }) {- id- name- lastPublishedVersionId- statuses+ const findWorkflow = () =>+ client+ .post('/graphql')+ .set('Authorization', `Bearer ${APPLE_JANE_ADMIN_ACCESS_TOKEN}`)+ .send({+ query: `+ query FindWorkflow($id: UUID!) {+ workflow(filter: { id: { eq: $id } }) {+ id+ name+ lastPublishedVersionId+ statuses+ }}- }- `,- variables: { id: createdWorkflowId },- });+ `,+ variables: { id: createdWorkflowId },+ });++ const response = await findWorkflow();expect(response.body.errors).toBeUndefined();expect(response.body.data.workflow.id).toBe(createdWorkflowId);@@ -431,8 +435,19 @@ describe('If/Else Workflow (e2e)', () => {expect(response.body.data.workflow.lastPublishedVersionId).toBe(createdWorkflowVersionId,);- expect(response.body.data.workflow.statuses).toContain('ACTIVE');- });++ // statuses is recomputed by a workflow queue job after activation returns+ await expectEventually(+ async () => {+ const statusesResponse = await findWorkflow();++ expect(statusesResponse.body.data.workflow.statuses).toContain(+ 'ACTIVE',+ );+ },+ { timeoutMs: 30_000 },+ );+ }, 60_000);it('should verify If/Else workflow version has correct structure', async () => {const response = await client