-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat: display self healed badge for cy.prompt #32802
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
Changes from all commits
2d8ce9c
ee83ca0
a254bfc
5c6e639
037d3aa
6ca95bd
0c70478
03e1515
a7e671f
11a4823
e76a4b1
81d81f6
4ddfc6e
f6215f4
2fd7be5
73e0b1d
33fa4ae
b276b0a
6e1a261
e916838
ce2541a
3bb6ee9
4a7ac25
2623a08
554d505
1c0309d
2abb629
cb5902a
ecd2cb3
d76e131
56de58b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ export interface RenderProps { | |
| }> | ||
| status?: InterceptStatuses | XHRStatuses | ||
| wentToOrigin?: boolean | ||
| selfHealed?: boolean | ||
| } | ||
|
|
||
| export interface CommandProps extends InstrumentProps { | ||
|
|
@@ -163,6 +164,7 @@ export default class Command extends Instrument { | |
| hasChildren: computed, | ||
| showError: computed, | ||
| setGroup: action, | ||
| isSelfHealed: computed, | ||
| }) | ||
|
|
||
| if (props.err) { | ||
|
|
@@ -278,4 +280,8 @@ export default class Command extends Instrument { | |
| _isPending () { | ||
| return this.state === 'pending' | ||
| } | ||
|
|
||
| get isSelfHealed () { | ||
| return (!!this.renderProps.selfHealed || (this.hasChildren && !this.isOpen && this.children.some((child) => child.isSelfHealed))) | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: MobX Computed Getter Not RegisteredThe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Self-Heal Status Not Propagating Through Nested GroupsThe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| .command-self-healed-badge { | ||
| background-color: $gray-1000; | ||
| border-radius: 4px; | ||
| display: inline-flex; | ||
| height: 20px; | ||
| border: 1px solid $gray-900; | ||
| gap: 4px; | ||
| padding: 0 4px; | ||
| color: $jade-300; | ||
| font-family: $font-system; | ||
| font-size: 14px; | ||
| font-weight: 400; | ||
| margin-right: 4px; | ||
| align-items: center; | ||
| justify-content: center; | ||
| white-space: nowrap; | ||
| text-transform: none; | ||
| vertical-align: middle; | ||
|
|
||
| .command-info:hover & { | ||
| border-color: $gray-800; | ||
| } | ||
|
|
||
| } | ||
|
|
||
| .command-self-healed-badge-command { | ||
| height: 16px; | ||
| font-size: 12px; | ||
| } | ||
|
|
||
| .command-self-healed-badge-test { | ||
| margin-left: 8px; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import React from 'react' | ||
| import { IconGeneralSparkleSingleSmall } from '@cypress-design/react-icon' | ||
| import cs from 'classnames' | ||
|
|
||
| export const SelfHealedBadge = ({ source }: { source: 'command' | 'test' }) => { | ||
| return ( | ||
| <div className={cs('command-self-healed-badge', { 'command-self-healed-badge-command': source === 'command', 'command-self-healed-badge-test': source === 'test' })} data-cy={`self-healed-badge-${source}`}> | ||
| <IconGeneralSparkleSingleSmall strokeColor='jade-300' fillColor='gray-1000' /> | ||
| <span> | ||
| Self-healed | ||
| </span> | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,7 @@ export default class Test extends Runnable { | |
| hasRetried: computed, | ||
| isActive: computed, | ||
| currentRetry: computed, | ||
| isSelfHealed: computed, | ||
| start: action, | ||
| update: action, | ||
| setIsOpen: action, | ||
|
|
@@ -257,4 +258,12 @@ export default class Test extends Runnable { | |
|
|
||
| return null | ||
| } | ||
|
|
||
| get isSelfHealed () { | ||
| // Compute self-healed status from the commands in all attempts | ||
| // This ensures the badge is shown correctly even across retries | ||
| return _.some(this.attempts, (attempt: Attempt) => { | ||
| return _.some(attempt.commands, (command) => command.isSelfHealed) | ||
| }) | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Self-Heal Flag Persistence Across Test AttemptsThe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @estrada9166 Can you test this? |
||
| } | ||
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.
@estrada9166 You'll need to put a changelog entry with proper semver for every prompt feature since this is publicly released now.