-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Conversation
There was a problem hiding this 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
) inblank-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
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', | ||
}); |
There was a problem hiding this comment.
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
await Promise.all([ | ||
page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`), | ||
|
||
workflowVisualizer.useAsDraftButton.click(), | ||
]); |
There was a problem hiding this comment.
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.
await Promise.all([ | ||
page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`), | ||
|
||
workflowVisualizer.overrideDraftButton.click(), | ||
]); |
There was a problem hiding this comment.
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.
Log
|
Test with and without a draft version as the last version of the workflow
Test with and without a draft version as the last version of the workflow