Skip to content

Commit e459591

Browse files
authored
misc: remove New badge for debug page navigation icon (#25992)
1 parent 85e813d commit e459591

File tree

7 files changed

+7
-127
lines changed

7 files changed

+7
-127
lines changed

cli/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ _Released 03/14/2023 (PENDING)_
77

88
- It is now possible to control the number of connection attempts to the browser using the CYPRESS_CONNECT_RETRY_THRESHOLD Environment Variable. Learn more [here](https://docs.cypress.io/guides/references/advanced-installation#Environment-variables). Addressed in [#25848](https://github.com/cypress-io/cypress/pull/25848).
99

10+
**Misc:**
11+
12+
- Removed "New" badge in the navigation bar for the debug page icon. Addresses [#25925](https://github.com/cypress-io/cypress/issues/25925)
13+
1014
**Dependency Updates:**
1115

1216
- Upgraded [`mocha-junit-reporter`](https://github.com/michaelleeallen/mocha-junit-reporter) from `2.1.0` to `2.2.0` to be able to use [new placeholders](https://github.com/michaelleeallen/mocha-junit-reporter/pull/163) such as `[suiteFilename]` or `[suiteName]` when defining the test report name. Addressed in [#25922](https://github.com/cypress-io/cypress/pull/25922).

packages/app/cypress/e2e/sidebar_navigation.cy.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -250,34 +250,6 @@ describe('Sidebar Navigation', { viewportWidth: 1280 }, () => {
250250
cy.get('.router-link-active').findByText('Debug').should('be.visible')
251251
})
252252

253-
it('Debug "new" notification appears as a dot when nav is collapsed', () => {
254-
cy.findByLabelText('New Debug feature')
255-
.should('be.visible')
256-
.contains('New')
257-
258-
// in expanded state, expect no dot
259-
cy.findByTestId('debug-badge-dot').should('not.exist')
260-
261-
// collapse the nav
262-
cy.findByTestId('toggle-sidebar').click()
263-
264-
// in collapsed state, find the dot
265-
// TODO (Percy): when Percy is enabled for e2e tests
266-
// we can stop testing the class name directly here
267-
cy.findByLabelText('New Debug feature', {
268-
selector: '[data-cy=debug-badge-dot]',
269-
})
270-
.should('be.visible')
271-
.and('have.class', 'bg-jade-500')
272-
.invoke('text')
273-
.should('eq', '')
274-
275-
// go to the Spec Runner route by clicking on a test
276-
cy.contains('a', 'flower.png').click()
277-
278-
cy.findByTestId('debug-badge-dot').should('have.class', 'bg-gray-800')
279-
})
280-
281253
it('Specs sidebar nav link is not active when a test is running', () => {
282254
cy.location('hash').should('equal', '#/specs')
283255
cy.contains('.router-link-exact-active', 'Specs')

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

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { CloudRunStubs } from '@packages/graphql/test/stubCloudTypes'
55
import { cloneDeep } from 'lodash'
66
import { IATR_RELEASE } from '@packages/frontend-shared/src/utils/isAllowedFeature'
77
import { useLoginConnectStore } from '@packages/frontend-shared/src/store/login-connect-store'
8-
import interval from 'human-interval'
98

109
function mountComponent (props: { initialNavExpandedVal?: boolean, cloudProject?: { status: CloudRunStatus, numFailedTests: number }, isLoading?: boolean, online?: boolean} = {}) {
1110
const withDefaults = { initialNavExpandedVal: false, isLoading: false, online: true, ...props }
@@ -127,44 +126,8 @@ describe('SidebarNavigation', () => {
127126
})
128127

129128
context('debug status badge', () => {
130-
it('renders new badge without cloudProject', { viewportWidth: 1280 }, () => {
131-
cy.clock(IATR_RELEASE)
132-
133-
mountComponent()
134-
cy.tick(1000) //wait for debounce
135-
136-
cy.findByLabelText('New Debug feature', {
137-
selector: '[data-cy=debug-badge-dot]',
138-
}).should('be.visible')
139-
140-
cy.percySnapshot('Debug Badge:collapsed')
141-
142-
cy.findByLabelText(defaultMessages.sidebar.toggleLabel.collapsed, {
143-
selector: 'button',
144-
}).click()
145-
146-
cy.tick(1000) //wait for transition
147-
cy.findByLabelText('New Debug feature').should('be.visible').contains('New')
148-
cy.percySnapshot('Debug Badge:expanded badge')
149-
})
150-
151-
it('renders new badge when run status is "NOTESTS" or "RUNNING"', () => {
152-
cy.clock(IATR_RELEASE + interval('1 month'))
153-
154-
for (const status of ['NOTESTS', 'RUNNING'] as CloudRunStatus[]) {
155-
mountComponent({ cloudProject: { status, numFailedTests: 0 } })
156-
cy.tick(1000) //wait for debounce
157-
cy.findByLabelText('New Debug feature', {
158-
selector: '[data-cy=debug-badge-dot]',
159-
}).should('be.visible')
160-
}
161-
})
162-
163-
it('renders no badge if no cloudProject and released > 2 months ago', () => {
164-
// Set to February 15, 2023 to see this fail
165-
cy.clock(IATR_RELEASE + interval('3 months'))
129+
it('renders no badge if no cloudProject', () => {
166130
mountComponent()
167-
cy.tick(1000) //wait for debounce
168131
cy.findByLabelText('New Debug feature').should('not.exist')
169132
})
170133

@@ -218,16 +181,5 @@ describe('SidebarNavigation', () => {
218181
cy.tick(1000) //wait for debounce
219182
cy.findByLabelText('New Debug feature').should('not.exist')
220183
})
221-
222-
it('renders new badge if offline', () => {
223-
cy.clock(IATR_RELEASE)
224-
225-
mountComponent({ online: false })
226-
227-
cy.tick(1000) //wait for debounce
228-
cy.findByLabelText('New Debug feature', {
229-
selector: '[data-cy=debug-badge-dot]',
230-
}).should('be.visible')
231-
})
232184
})
233185
})

packages/app/src/navigation/SidebarNavigation.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ import { useRoute } from 'vue-router'
109109
import SidebarNavigationHeader from './SidebarNavigationHeader.vue'
110110
import { useDebounceFn, useWindowSize } from '@vueuse/core'
111111
import { useLoginConnectStore } from '@packages/frontend-shared/src/store/login-connect-store'
112-
import { isAllowedFeature } from '@packages/frontend-shared/src/utils/isAllowedFeature'
113112
114113
const { t } = useI18n()
115114
@@ -178,18 +177,13 @@ watchEffect(() => {
178177
return
179178
}
180179
181-
const showNewBadge = isAllowedFeature('debugNewBadge', loginConnectStore)
182-
const newBadge: Badge = { value: t('sidebar.debug.new'), status: 'success', label: t('sidebar.debug.debugFeature') }
183-
184180
if (props.gql?.currentProject?.cloudProject?.__typename === 'CloudProject'
185181
&& props.gql.currentProject.cloudProject.runByNumber
186182
&& props.online
187183
) {
188184
const { status, totalFailed } = props.gql.currentProject.cloudProject.runByNumber || {}
189185
190186
if (status === 'NOTESTS' || status === 'RUNNING') {
191-
setDebugBadge(showNewBadge ? newBadge : undefined)
192-
193187
return
194188
}
195189
@@ -225,8 +219,6 @@ watchEffect(() => {
225219
226220
return
227221
}
228-
229-
setDebugBadge(showNewBadge ? newBadge : undefined)
230222
})
231223
232224
const navigation = computed<{ name: string, icon: FunctionalComponent, href: string, badge?: Badge }[]>(() => {

packages/app/src/navigation/SidebarNavigationRow.vue

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,13 @@
4848
{{ name }}
4949
</span>
5050
<span
51-
v-if="badge && !showDot"
51+
v-if="badge"
5252
:aria-label="badge.label"
5353
class="rounded-md font-medium text-white p-4px transition-opacity z-1"
5454
:class="[badgeVariant, badgeColorStyles[badge.status], {'opacity-0': transitioning}]"
5555
>
5656
{{ badge.value }}
5757
</span>
58-
<div
59-
v-else-if="badge && showDot"
60-
:class="[{'opacity-0': transitioning}, dotClass]"
61-
:aria-label="badge.label"
62-
data-cy="debug-badge-dot"
63-
/>
6458
</div>
6559
<template #popper>
6660
{{ name }}
@@ -72,14 +66,9 @@
7266
import { computed, FunctionalComponent, SVGAttributes, watch, ref } from 'vue'
7367
import Tooltip from '@packages/frontend-shared/src/components/Tooltip.vue'
7468
import { promiseTimeout } from '@vueuse/core'
75-
import { useI18n } from '@cy/i18n'
76-
import { useRoute } from 'vue-router'
7769
7870
export type Badge = { value: string, status: 'success' | 'failed' | 'error', label: string }
7971
80-
const { t } = useI18n()
81-
const route = useRoute()
82-
8372
const props = withDefaults(defineProps <{
8473
icon: FunctionalComponent<SVGAttributes>
8574
name: string
@@ -118,26 +107,6 @@ const badgeColorStyles = {
118107
'error': 'bg-warning-500',
119108
}
120109
121-
const showDot = computed(() => {
122-
return props.badge.value === t('sidebar.debug.new') && !props.isNavBarExpanded
123-
})
124-
125-
const dotClass = computed(() => {
126-
const dotColor = route.name === 'SpecRunner' ? 'bg-gray-800' : 'bg-jade-500'
127-
128-
return `${dotColor}
129-
w-10px
130-
h-10px
131-
relative
132-
-bottom-7px
133-
-left-30px
134-
flex-shrink-0
135-
z-1
136-
border-2px
137-
border-gray-1000
138-
rounded-full`
139-
})
140-
141110
const transitioning = ref(false)
142111
143112
// Badge is either absolutely positioned or relative. Since the navbar expands with an animation,

packages/frontend-shared/src/locales/en-US.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@
238238
"ariaLabel": "Pages"
239239
},
240240
"debug": {
241-
"new": "New",
242241
"debugFeature": "New Debug feature",
243242
"passed": "Relevant run passed",
244243
"failed": "Relevant run had {n} test failure | Relevant run had {n} test failures",

packages/frontend-shared/src/utils/isAllowedFeature.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import interval from 'human-interval'
22
import { BannerIds } from '@packages/types'
33
import type { LoginConnectStore, UserStatus } from '../store'
44

5-
type Feature = 'specsListBanner' | 'docsCiPrompt' | 'debugNewBadge'
5+
type Feature = 'specsListBanner' | 'docsCiPrompt'
66
type RulesSet = { base: boolean[] } & Partial<Record<UserStatus, boolean[]>>
77
type Rules = Record<Feature, RulesSet>
88

@@ -95,14 +95,6 @@ export const isAllowedFeature = (
9595
isLoggedOut: [],
9696
allTasksCompleted: [],
9797
},
98-
debugNewBadge: {
99-
base: [!minTimeSinceEvent(IATR_RELEASE, '2 months')],
100-
needsRecordedRun: [],
101-
needsOrgConnect: [],
102-
needsProjectConnect: [],
103-
isLoggedOut: [],
104-
allTasksCompleted: [],
105-
},
10698
}
10799

108100
const baseRules = [...rules[featureName].base]

0 commit comments

Comments
 (0)