Store the current flow definition in a state to not depend on a specific workflow version (#10352)
This PR introduces a new Recoil state to store the flow. A few parts of the application need to know the definition of the current flow. Previously, we stored the workflow version's ID and fetched its definition with the `useWorkflowVersion` hook. However, we must use another strategy to visualize workflow runs. Indeed, we now store the definition of the workflow in the workflow run output when it is executed. This is useful for draft versions, which can change between the moment they were executed and the moment they are visualized.
This commit is contained in:
committed by
GitHub
parent
d96865abc3
commit
05d00e6604
60
packages/twenty-e2e-testing/tests/workflow-run.spec.ts
Normal file
60
packages/twenty-e2e-testing/tests/workflow-run.spec.ts
Normal file
@ -0,0 +1,60 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '../lib/fixtures/blank-workflow';
|
||||
|
||||
test('The workflow run visualizer shows the executed draft version without the last draft changes', async ({
|
||||
workflowVisualizer,
|
||||
page,
|
||||
}) => {
|
||||
await workflowVisualizer.createInitialTrigger('manual');
|
||||
|
||||
const manualTriggerAvailabilitySelect = page.getByRole('button', {
|
||||
name: 'When record(s) are selected',
|
||||
});
|
||||
|
||||
await manualTriggerAvailabilitySelect.click();
|
||||
|
||||
const alwaysAvailableOption = page.getByText(
|
||||
'When no record(s) are selected',
|
||||
);
|
||||
|
||||
await alwaysAvailableOption.click();
|
||||
|
||||
await workflowVisualizer.closeSidePanel();
|
||||
|
||||
const { createdStepId: firstStepId } =
|
||||
await workflowVisualizer.createStep('create-record');
|
||||
|
||||
await workflowVisualizer.closeSidePanel();
|
||||
|
||||
const launchTestButton = page.getByRole('button', { name: 'Test' });
|
||||
|
||||
await launchTestButton.click();
|
||||
|
||||
const goToExecutionPageLink = page.getByRole('link', {
|
||||
name: 'View execution details',
|
||||
});
|
||||
const executionPageUrl = await goToExecutionPageLink.getAttribute('href');
|
||||
expect(executionPageUrl).not.toBeNull();
|
||||
|
||||
await workflowVisualizer.deleteStep(firstStepId);
|
||||
|
||||
await page.goto(executionPageUrl!);
|
||||
|
||||
const workflowRunName = page.getByText('Execution of v1');
|
||||
|
||||
await expect(workflowRunName).toBeVisible();
|
||||
|
||||
const flowTab = page.getByText('Flow', { exact: true });
|
||||
|
||||
await flowTab.click();
|
||||
|
||||
const executedFirstStepNode = workflowVisualizer.getStepNode(firstStepId);
|
||||
|
||||
await expect(executedFirstStepNode).toBeVisible();
|
||||
|
||||
await executedFirstStepNode.click();
|
||||
|
||||
await expect(
|
||||
workflowVisualizer.commandMenu.getByRole('textbox').first(),
|
||||
).toHaveValue('Create Record');
|
||||
});
|
||||
Reference in New Issue
Block a user