Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e tests for the Use as Draft feature #9845

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

Devessier
Copy link
Contributor

@Devessier Devessier commented Jan 24, 2025

Test with and without a draft version as the last version of the workflow

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds end-to-end tests for the workflow draft functionality, focusing on version management and state transitions.

  • Added new test file workflow-use-as-draft.spec.ts with comprehensive tests for using old workflow versions as drafts
  • Added draft-related button locators (useAsDraftButton, overrideDraftButton, discardDraftButton) in blank-workflow.ts fixture
  • Tests cover key scenarios: converting old versions to drafts, handling pending drafts, and proper state transitions between Active/Draft/Archived
  • Tests verify proper UI element visibility and workflow content preservation during version changes

2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +76 to +82
this.useAsDraftButton = page.getByRole('button', { name: 'Use as draft' });
this.overrideDraftButton = page.getByRole('button', {
name: 'Override Draft',
});
this.discardDraftButton = page.getByRole('button', {
name: 'Discard Draft',
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: consider using a common prefix for these related button names to make maintenance easier and prevent typos

Comment on lines +72 to +76
await Promise.all([
page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`),

workflowVisualizer.useAsDraftButton.click(),
]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The URL wait and button click should be sequential - waiting for URL after clicking the button. Current implementation may lead to flaky tests.

Comment on lines +158 to +162
await Promise.all([
page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`),

workflowVisualizer.overrideDraftButton.click(),
]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Same issue with URL wait and button click ordering as above. The URL wait should come after the button click.

@charlesBochet charlesBochet merged commit a401167 into main Jan 24, 2025
29 checks passed
@charlesBochet charlesBochet deleted the workflow-e2e-use-as-draft branch January 24, 2025 17:38
Copy link

Fails
🚫

node failed.

Log

�[31mError: �[39m SyntaxError: Unexpected token C in JSON at position 0
    at JSON.parse (<anonymous>)
�[90m    at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)�[39m
�[90m    at successSteps (node:internal/deps/undici/undici:5555:27)�[39m
�[90m    at fullyReadBody (node:internal/deps/undici/undici:1665:9)�[39m
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)�[39m
�[90m    at async specConsumeBody (node:internal/deps/undici/undici:5564:7)�[39m
danger-results://tmp/danger-results-c97a78db.json

Generated by 🚫 dangerJS against d9b15db

DeepaPrasanna pushed a commit to DeepaPrasanna/twenty that referenced this pull request Jan 27, 2025
Test with and without a draft version as the last version of the
workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants