Skip to content

Commit 199c4e6

Browse files
authored
misc: Increase max failures in IATR badge to 99 (#25737)
1 parent 9aad2aa commit 199c4e6

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

cli/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ _Released 02/14/2023 (PENDING)_
1717
- Improved the layout of the Debug Page on smaller viewports when there is a pending run. Addresses [#25664](https://github.com/cypress-io/cypress/issues/25664).
1818
- Improved the layout of the Debug Page when displaying informational messages. Addresses [#25669](https://github.com/cypress-io/cypress/issues/25669).
1919
- Icons in Debug page will no longer shrink at small viewports. Addresses [#25665](https://github.com/cypress-io/cypress/issues/25665).
20+
- Increased maximum number of failing tests to reflect in sidebar badge to 99. Addresses [#25662](https://github.com/cypress-io/cypress/issues/25662).
2021
- Improved the layout of the Debug Page empty states on smaller viewports. Addressed in [#25703](https://github.com/cypress-io/cypress/pull/25703).
2122
- Increased the spacing between elements and their associated tooltip and added borders around artifact links on the Debug Page. Addresses [#25666](https://github.com/cypress-io/cypress/issues/25666).
2223

packages/app/src/navigation/SidebarNavigation.cy.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,14 @@ describe('SidebarNavigation', () => {
170170
it('renders failure badge', () => {
171171
mountComponent({ cloudProject: { status: 'FAILED', numFailedTests: 1 } })
172172
cy.findByLabelText('Relevant run had 1 test failure').should('be.visible').contains('1')
173-
cy.percySnapshot('Debug Badge:failed')
173+
cy.percySnapshot('Debug Badge:failed:single-digit')
174174

175175
mountComponent({ cloudProject: { status: 'FAILED', numFailedTests: 10 } })
176-
cy.findByLabelText('Relevant run had 10 test failures').should('be.visible').contains('9+')
176+
cy.findByLabelText('Relevant run had 10 test failures').should('be.visible').contains('10')
177+
cy.percySnapshot('Debug Badge:failed:double-digit')
178+
179+
mountComponent({ cloudProject: { status: 'FAILED', numFailedTests: 100 } })
180+
cy.findByLabelText('Relevant run had 100 test failures').should('be.visible').contains('99+')
177181
cy.percySnapshot('Debug Badge:failed:truncated')
178182
})
179183

packages/app/src/navigation/SidebarNavigation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ watchEffect(() => {
202202
let countToDisplay = '0'
203203
204204
if (totalFailed) {
205-
countToDisplay = totalFailed < 9
205+
countToDisplay = totalFailed < 99
206206
? String(totalFailed)
207-
: '9+'
207+
: '99+'
208208
}
209209
210210
if (status === 'FAILED') {

packages/app/src/navigation/SidebarNavigationRow.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,23 @@ const props = withDefaults(defineProps <{
8282
})
8383
8484
const badgeVariant = computed(() => {
85-
return props.isNavBarExpanded ? 'ml-16px h-20px text-sm leading-3' : 'absolute outline-gray-1000 outline-2px outline bottom-0 left-36px text-xs h-16px leading-2'
85+
const classes: string[] = []
86+
87+
if (props.isNavBarExpanded) {
88+
classes.push('ml-16px', 'h-20px', 'text-sm', 'leading-3')
89+
} else {
90+
classes.push('absolute', 'outline-gray-1000', 'outline-2px', 'outline', 'bottom-0', 'text-xs', 'h-16px', 'leading-2')
91+
92+
// Keep failure count from overflowing sidebar (#25662)
93+
if ((props.badge.status === 'failed' || props.badge.status === 'error') && props.badge.value.length >= 3) {
94+
classes.push('right-4px')
95+
} else {
96+
// Anything else should left-align and overflow sidebar if needed
97+
classes.push('left-36px')
98+
}
99+
}
100+
101+
return classes
86102
})
87103
88104
const badgeColorStyles = {

0 commit comments

Comments
 (0)