Skip to content

misc: Update nested groups design #31739

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

Merged
merged 22 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bcac9f2
refactor: Update nested groups design
estrada9166 May 19, 2025
64c32ce
Merge branch 'develop' into alejandro/feat/update-nested-groups-styles
estrada9166 May 20, 2025
3b39871
Merge branch 'develop' into alejandro/feat/update-nested-groups-styles
estrada9166 May 20, 2025
af8fe04
Update styles
estrada9166 May 20, 2025
18b54e8
Enhance command method styling for child elements in the reporter. Up…
estrada9166 May 21, 2025
dc119b0
Fix formatting in SCSS for child command styles by adjusting indentat…
estrada9166 May 21, 2025
bd1bfca
Merge branch 'develop' into alejandro/feat/update-nested-groups-styles
estrada9166 May 21, 2025
4d7193a
Merge branch 'develop' into alejandro/feat/update-nested-groups-styles
jennifer-shehane May 21, 2025
5e6a38e
add chanagelog entry
jennifer-shehane May 21, 2025
836d02a
Enhance command expander styling by adding a parent class for better …
estrada9166 May 21, 2025
19e949b
Update padding for error message styles in SCSS to improve layout con…
estrada9166 May 21, 2025
6f698b2
Merge branch 'develop' into alejandro/feat/update-nested-groups-styles
estrada9166 May 23, 2025
35b0178
Merge branch 'develop' into alejandro/feat/update-nested-groups-styles
jennifer-shehane May 27, 2025
48092fe
Refactor SCSS styles and introduce mixins for gutter alignment and co…
estrada9166 May 27, 2025
f87fb2e
Refactor command styles by removing redundant class names and consoli…
estrada9166 May 27, 2025
7fc3e05
Merge branch 'develop' into alejandro/feat/update-nested-groups-styles
estrada9166 May 27, 2025
79741bc
Enhance SCSS mixins by adding align-self property for improved layout…
estrada9166 May 27, 2025
872a5a1
Remove redundant align-self property from SCSS mixin for command info…
estrada9166 May 27, 2025
f6471e1
Use snapshotReporter instead
estrada9166 May 27, 2025
b344f56
Refactor snapshotReporter to dynamically set width based on reporter …
estrada9166 May 27, 2025
86d8816
Update snapshotReporter to include sidebar width in percy snapshots, …
estrada9166 May 28, 2025
4be973e
Merge branch 'develop' into alejandro/feat/update-nested-groups-styles
estrada9166 May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

_Released 6/3/2025 (PENDING)_

**Misc:**

- The design of commands that display as grouped (such as `.within()` and `cy.session()`) has been updated to provide better clarity when collapsing groups. Addressed in [#31739](https://github.com/cypress-io/cypress/pull/31739).

**Dependency Updates:**

- Updated `@sinonjs/fake-timers` from `10.3.0` to `11.3.1`. Addressed in [#31746](https://github.com/cypress-io/cypress/pull/31746).
Expand Down
53 changes: 32 additions & 21 deletions packages/app/cypress/e2e/runner/support/snapshot-reporter.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
// Takes percy snapshot with navigation/AUT/reporter hidden
export const snapshotReporter = () => {
cy.percySnapshot({
width: 450,
elementOverrides: {
'.cy-tooltip': true,
'[data-cy=sidebar]': ($el) => {
$el.attr('style', 'display: none !important')
},
'[data-cy=aut-panel]': ($el) => {
$el.attr('style', 'display: none !important')
},
'[data-cy=reporter-panel]': ($el) => {
$el.attr('style', 'width: 450px !important')
},
'[data-cy=reporter-running-icon]': ($el) => {
// remove 'fa-spin' class so that the icon is not animated
$el.attr('class', '')
},
'.command-progress': ($el) => {
// don't display command progress bar in snapshot
$el.attr('style', 'display: none !important')
let sidebarWidth = 0

cy.get('[data-cy=sidebar]')
.invoke('width')
.then((w) => {
if (w) {
sidebarWidth = w
}
}).then(() => {
cy.get('[data-cy=reporter-panel]')
})
.invoke('width')
.then((w) => {
cy.percySnapshot({
width: w + sidebarWidth,
elementOverrides: {
'.cy-tooltip': true,
'[data-cy=sidebar]': ($el) => {
$el.attr('style', 'display: none !important')
},
'[data-cy=aut-panel]': ($el) => {
$el.attr('style', 'display: none !important')
},
'[data-cy=reporter-running-icon]': ($el) => {
// remove 'fa-spin' class so that the icon is not animated
$el.attr('class', '')
},
'.command-progress': ($el) => {
// don't display command progress bar in snapshot
$el.attr('style', 'display: none !important')
},
},
},
})
})
}
37 changes: 19 additions & 18 deletions packages/app/cypress/e2e/runner/ui-states.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { snapshotReporter } from './support/snapshot-reporter'
import { loadSpec } from './support/spec-loader'

describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 600000 }, () => {
Expand All @@ -12,7 +13,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('test hooks').should('be.visible')
cy.percySnapshot()
snapshotReporter()
})

it('nested tests', () => {
Expand All @@ -22,7 +23,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('Nested Tests').should('be.visible')
cy.percySnapshot()
snapshotReporter()
})

describe('commands', () => {
Expand All @@ -33,7 +34,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('part 1 - basic commands').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})

it('part 2 - traversal and navigation', () => {
Expand All @@ -45,7 +46,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
cy.contains('part 2 - traversal and navigation').should('be.visible')
.click()

cy.percySnapshot()
snapshotReporter()
})

it('part 3 - element manipulation', () => {
Expand All @@ -57,7 +58,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
cy.contains('part 3 - element manipulation').should('be.visible')
.click()

cy.percySnapshot()
snapshotReporter()
})

it('part 4 - advanced interactions', () => {
Expand All @@ -69,7 +70,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
cy.contains('part 4 - advanced interactions').should('be.visible')
.click()

cy.percySnapshot()
snapshotReporter()
})

it('commands that do not appear in command log', () => {
Expand All @@ -79,7 +80,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('commands that do not appear in command log').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})

it('form interaction command options', () => {
Expand All @@ -89,7 +90,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('form interaction command options').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})

it('DOM traversal command options', () => {
Expand All @@ -99,7 +100,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('DOM traversal command options').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})

it('element state and navigation command options', () => {
Expand All @@ -109,7 +110,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('element state and navigation command options').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})

it('element traversal and file operations command options', () => {
Expand All @@ -119,7 +120,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('element traversal and file operations command options').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})

it('scrolling and form interaction command options', () => {
Expand All @@ -129,7 +130,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('scrolling and form interaction command options').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})

it('user interaction and window command options', () => {
Expand All @@ -139,7 +140,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('user interaction and window command options').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})

it('verify element visibility state', () => {
Expand All @@ -149,7 +150,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('verify element visibility state').should('be.visible').click()
cy.percySnapshot()
snapshotReporter()
})
})

Expand All @@ -160,7 +161,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('Request Statuses').should('be.visible')
cy.percySnapshot()
snapshotReporter()
})

it('page events', () => {
Expand All @@ -170,7 +171,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('events - page events').should('be.visible')
cy.percySnapshot()
snapshotReporter()
})

describe('errors', () => {
Expand All @@ -181,7 +182,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60
})

cy.contains('simple error with docs link').should('be.visible')
cy.percySnapshot()
snapshotReporter()
})

it('long error', () => {
Expand All @@ -192,7 +193,7 @@ describe('src/cypress/runner ui states', { retries: 0, defaultCommandTimeout: 60

cy.contains('simple error with docs link').click()
cy.contains('long error').should('be.visible')
cy.percySnapshot()
snapshotReporter()
})
})
})
25 changes: 20 additions & 5 deletions packages/reporter/src/commands/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const NavColumns: React.FC<NavColumnsProps> = observer(({ model, isPinned, toggl
{(!model._isPending() && isPinned) && <PinIcon className='command-pin' />}
{(!model._isPending() && !isPinned) && model.number}
</div>
{model.hasChildren && (
{model.hasChildren && !model.group && (
<div className='command-expander-column' onClick={() => model.toggleOpen()}>
<ChevronIcon className={cs('command-expander', { 'command-expander-is-open': model.hasChildren && !!model.isOpen })} />
</div>
Expand Down Expand Up @@ -326,7 +326,7 @@ interface CommandProps {

const CommandDetails: React.FC<CommandDetailsProps> = observer(({ model, groupId, aliasesWithDuplicates }) => (
<span className={cs('command-info')}>
<span className='command-method'>
<span className={cs('command-method', { 'command-method-child': !model.hasChildren })}>
<span>
{model.event && model.type !== 'system' ? `(${displayName(model)})` : displayName(model)}
</span>
Expand Down Expand Up @@ -432,7 +432,10 @@ const Command: React.FC<CommandProps> = observer(({ model, aliasesWithDuplicates
groupLevel = model.groupLevel < 6 ? model.groupLevel : 5

for (let i = 1; i < groupLevel; i++) {
groupPlaceholder.push(<span key={`${groupId}-${i}`} className='command-group-block' />)
groupPlaceholder.push(<span key={`${groupId}-${i}`} className='command-group-block' onClick={(e) => {
e.stopPropagation()
model.toggleOpen()
}} />)
}
}

Expand Down Expand Up @@ -520,14 +523,26 @@ const Command: React.FC<CommandProps> = observer(({ model, aliasesWithDuplicates
message='Printed output to your console'
onClick={_toggleColumnPin}
shouldShowMessage={_shouldShowClickMessage}
wrapperClassName={cs('command-pin-target', { 'command-group': !!groupId })}
wrapperClassName={cs('command-pin-target', { 'command-group': !!groupId, 'command-group-no-children': !model.hasChildren && model.group })}
>
<div
className='command-wrapper-text'
className={cs('command-wrapper-text', {
'command-wrapper-text-group': model.hasChildren && groupId,
'command-wrapper-text-group-parent': model.hasChildren && !groupId,
})}
onMouseEnter={() => _snapshot(true)}
onMouseLeave={() => _snapshot(false)}
>
{groupPlaceholder}

{model.hasChildren && groupId && (
<div className={cs('command-expander-column-group', { 'nested-group-expander': model.groupLevel })} onClick={(e) => {
e.stopPropagation()
model.toggleOpen()
}}>
<ChevronIcon className={cs('command-expander', { 'command-expander-is-open': model.hasChildren && !!model.isOpen })} />
</div>
)}
<CommandDetails model={model} groupId={groupId} aliasesWithDuplicates={aliasesWithDuplicates} />
<CommandControls model={model} commandName={commandName} events={events} />
</div>
Expand Down
Loading
Loading