Skip to content
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

feat: update git related messages for runs and debug #26758

Merged
merged 25 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
af7d0d6
feat(app): update DebugError copy
jordanpowell88 May 12, 2023
a3e7b60
feat: set isUsingGit project flag and consume in DebugContainer
jordanpowell88 May 12, 2023
169a9c6
feat(app): update not using git icon for DebugError
jordanpowell88 May 12, 2023
e7a2c6b
feat(app): displays alert on runs page when not using git
jordanpowell88 May 12, 2023
2fccb00
feat(app): add component for when no runs for current branch
jordanpowell88 May 15, 2023
a7bc3f5
feat(app): add warning for no runs for branch on runs container
jordanpowell88 May 15, 2023
16c42b4
chore: add feat to CHANGELOG
jordanpowell88 May 15, 2023
dc4cfd1
chore: remove logged status value
jordanpowell88 May 15, 2023
d0de4a1
chore: resolve import from merge conflict
jordanpowell88 May 15, 2023
cb503f9
test(app): stub branch name for e2e runs spec
jordanpowell88 May 15, 2023
345f875
chore: add line break in changelog entry
jordanpowell88 May 16, 2023
ad35a26
chore: cleanup PR
jordanpowell88 May 16, 2023
07340a7
chore: fix i18n import for DebugBranchError
jordanpowell88 May 16, 2023
106bd75
chore: add utm and update Warning links to inline
jordanpowell88 May 16, 2023
12fb5c4
chore: capitalize Git in i18n
jordanpowell88 May 16, 2023
a76ddc5
ref: warning liink
jordanpowell88 May 16, 2023
b117c00
test: add i18n to tests
jordanpowell88 May 17, 2023
eee6aec
test(app): change utm_source assertions
jordanpowell88 May 17, 2023
e1f23d0
chore: cleanup pr
jordanpowell88 May 18, 2023
ebd7176
chore: remove unused prop
jordanpowell88 May 18, 2023
89177e5
test(app): remove no git warning when moving to runs page in e2e
jordanpowell88 May 18, 2023
0bb8ce3
chore: change template logic
jordanpowell88 May 18, 2023
c6f5bb9
chore: remove duplicate RUNS_TAB_MEDIUM const
jordanpowell88 May 18, 2023
95a2623
Merge branch 'develop' into jordanpowell88/update-git-messages
jordanpowell88 May 18, 2023
ce63656
Changed Debug test assertion and reordered new components for Debug
warrensplayer May 19, 2023
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 05/23/2023 (PENDING)_

**Features:**

- Add Git-related messages for the [Runs page](https://docs.cypress.io/guides/core-concepts/cypress-app#Runs) and [Debug page](https://docs.cypress.io/guides/cloud/runs#Debug) when users aren't using Git or there are no recorded runs for the current branch. Fixes [#26680](https://github.com/cypress-io/cypress/issues/26680).

**Bugfixes:**

- Reverted [#26452](https://github.com/cypress-io/cypress/pull/26630) which introduced a bug that prevents users from using End to End with Yarn 3. Fixed in [#26735](https://github.com/cypress-io/cypress/pull/26735). Fixes [#26676](https://github.com/cypress-io/cypress/issues/26676).
Expand Down
14 changes: 13 additions & 1 deletion packages/app/cypress/e2e/runs.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import defaultMessages from '@packages/frontend-shared/src/locales/en-US.json'
import type { SinonStub } from 'sinon'

function moveToRunsPage (): void {
cy.withCtx((ctx, o) => {
o.sinon.stub(ctx.lifecycleManager.git!, 'currentBranch').value('fakeBranch')
})

cy.findByTestId('sidebar-link-runs-page').click()
cy.findByTestId('app-header-bar').findByText('Runs').should('be.visible')
cy.findByTestId('runs-container').should('be.visible')
Expand Down Expand Up @@ -34,6 +38,9 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
cy.scaffoldProject('component-tests')
cy.openProject('component-tests')
cy.startAppServer('component')
cy.withCtx((ctx, o) => {
o.sinon.stub(ctx.lifecycleManager.git!, 'currentBranch').value('fakeBranch')
})
})

it('resolves the runs page', () => {
Expand Down Expand Up @@ -99,7 +106,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
moveToRunsPage()
cy.contains('a', 'OVERLIMIT').click()

cy.withCtx((ctx) => {
cy.withCtx((ctx, o) => {
expect((ctx.actions.electron.openExternal as SinonStub).lastCall.lastArg).to.contain('http://dummy.cypress.io/runs/4')
})
})
Expand Down Expand Up @@ -315,6 +322,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
cy.withCtx(async (ctx, o) => {
o.sinon.spy(ctx.cloud, 'executeRemoteGraphQL')

o.sinon.stub(ctx.lifecycleManager.git!, 'currentBranch').value('fakeBranch')
const config = await ctx.project.getConfig()

expect(config.projectId).to.not.equal('newProjectId')
Expand Down Expand Up @@ -757,6 +765,10 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
})

it('should remove the alert warning if the app reconnects to the internet', () => {
cy.withCtx((ctx, o) => {
o.sinon.stub(ctx.lifecycleManager.git!, 'currentBranch').value('fakeBranch')
})

cy.loginUser()
cy.visitApp()
cy.wait(1000)
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dependencies": {},
"devDependencies": {
"@cypress-design/vue-button": "0.9.2",
"@cypress-design/vue-icon": "0.22.1",
"@cypress-design/vue-icon": "0.22.2",
"@cypress-design/vue-statusicon": "0.4.3",
"@graphql-typed-document-node/core": "^3.1.0",
"@headlessui/vue": "1.4.0",
Expand Down
36 changes: 32 additions & 4 deletions packages/app/src/debug/DebugContainer.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('<DebugContainer />', () => {
const userProjectStatusStore = useUserProjectStatusStore()

userProjectStatusStore.setHasInitiallyLoaded()
userProjectStatusStore.setProjectFlag('isUsingGit', true)

validateEmptyState([defaultMessages.debugPage.emptyStates.connectToCypressCloud, defaultMessages.debugPage.emptyStates.connect.title, defaultMessages.debugPage.emptyStates.connect.description])
cy.findByRole('button', { name: 'Connect to Cypress Cloud' }).should('be.visible')
Expand All @@ -56,6 +57,7 @@ describe('<DebugContainer />', () => {

userProjectStatusStore.setUserFlag('isLoggedIn', true)
userProjectStatusStore.setProjectFlag('isProjectConnected', false)
userProjectStatusStore.setProjectFlag('isUsingGit', true)
userProjectStatusStore.setHasInitiallyLoaded()

validateEmptyState([defaultMessages.debugPage.emptyStates.connect.title, defaultMessages.debugPage.emptyStates.connect.description])
Expand All @@ -67,6 +69,7 @@ describe('<DebugContainer />', () => {

userProjectStatusStore.setUserFlag('isLoggedIn', true)
userProjectStatusStore.setProjectFlag('isProjectConnected', true)
userProjectStatusStore.setProjectFlag('isUsingGit', true)
userProjectStatusStore.setHasInitiallyLoaded()
cy.mountFragment(DebugSpecsFragmentDoc, {
variableTypes: DebugSpecVariableTypes,
Expand All @@ -78,20 +81,43 @@ describe('<DebugContainer />', () => {
cy.findByDisplayValue('npx cypress run --record --key 2aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa').should('be.visible')
})

it('errors', () => {
it('is not using git', () => {
const userProjectStatusStore = useUserProjectStatusStore()

userProjectStatusStore.setUserFlag('isLoggedIn', true)
userProjectStatusStore.setProjectFlag('isProjectConnected', true)
userProjectStatusStore.setProjectFlag('isUsingGit', false)
userProjectStatusStore.setHasInitiallyLoaded()
cy.mountFragment(DebugSpecsFragmentDoc, {
variableTypes: DebugSpecVariableTypes,
variables: defaultVariables,
render: (gqlVal) => <DebugContainer gql={gqlVal} showError={true} />,
render: (gqlVal) => <DebugContainer gql={gqlVal} />,
})

cy.findByTestId('debug-empty-title').should('contain.text', 'Git repository not detected')
})

it('has no runs for the current branch', () => {
const { setUserFlag, setProjectFlag, cloudStatusMatches, setHasInitiallyLoaded } = useUserProjectStatusStore()

setUserFlag('isLoggedIn', true)
setUserFlag('isMemberOfOrganization', true)
setProjectFlag('isProjectConnected', true)
setProjectFlag('hasNoRecordedRuns', true)
setProjectFlag('hasNonExampleSpec', true)
setProjectFlag('isConfigLoaded', true)
setProjectFlag('isUsingGit', true)
setHasInitiallyLoaded()

cy.mountFragment(DebugSpecsFragmentDoc, {
variableTypes: DebugSpecVariableTypes,
variables: defaultVariables,
render: (gqlVal) => <DebugContainer gql={gqlVal} />,
})

cy.findByTestId('debug-empty').should('not.exist')
cy.findByTestId('debug-alert').should('be.visible')
expect(cloudStatusMatches('needsRecordedRun')).equals(true)

cy.contains('No runs found for your branch')
})
})

Expand All @@ -101,6 +127,7 @@ describe('<DebugContainer />', () => {

userProjectStatusStore.setUserFlag('isLoggedIn', true)
userProjectStatusStore.setProjectFlag('isProjectConnected', true)
userProjectStatusStore.setProjectFlag('isUsingGit', true)
userProjectStatusStore.setHasInitiallyLoaded()
})

Expand Down Expand Up @@ -228,6 +255,7 @@ describe('<DebugContainer />', () => {

userProjectStatusStore.setUserFlag('isLoggedIn', true)
userProjectStatusStore.setProjectFlag('isProjectConnected', true)
userProjectStatusStore.setProjectFlag('isUsingGit', true)
userProjectStatusStore.setHasInitiallyLoaded()
})

Expand Down
15 changes: 10 additions & 5 deletions packages/app/src/debug/DebugContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
{{ t('launchpadErrors.noInternet.connectProject') }}
</NoInternetConnection>
<DebugLoading v-else-if="!userProjectStatusStore.hasInitiallyLoaded || userProjectStatusStore.project.isProjectConnected && isLoading" />
<DebugError
v-else-if="showError"
/>

<DebugNotLoggedIn
v-else-if="!userProjectStatusStore.user.isLoggedIn"
data-cy="debug-empty"
Expand All @@ -16,6 +14,12 @@
v-else-if="!userProjectStatusStore.project.isProjectConnected"
data-cy="debug-empty"
/>
<DebugError
v-else-if="!userProjectStatusStore.project.isUsingGit"
/>
<DebugBranchError
v-else-if="cloudStatusMatches('needsRecordedRun')"
/>
<DebugNoRuns
v-else-if="!run"
data-cy="debug-empty"
Expand Down Expand Up @@ -97,6 +101,7 @@ import DebugNotLoggedIn from './empty/DebugNotLoggedIn.vue'
import DebugNoProject from './empty/DebugNoProject.vue'
import DebugNoRuns from './empty/DebugNoRuns.vue'
import DebugError from './empty/DebugError.vue'
import DebugBranchError from './empty/DebugBranchError.vue'
import DebugSpecLimitBanner from './DebugSpecLimitBanner.vue'
import DebugRunNavigation from './DebugRunNavigation.vue'
import { specsList } from './utils/DebugMapping'
Expand Down Expand Up @@ -189,8 +194,6 @@ fragment DebugSpecs on Query {

const props = withDefaults(defineProps<{
gql?: DebugSpecsFragment
// This prop is just to stub the error state for now
showError?: boolean
isLoading?: boolean
commitsAhead?: number
online?: boolean
Expand All @@ -206,6 +209,8 @@ const props = withDefaults(defineProps<{

const userProjectStatusStore = useUserProjectStatusStore()

const { cloudStatusMatches } = userProjectStatusStore

const cloudProject = computed(() => {
return props.gql?.currentProject?.cloudProject?.__typename === 'CloudProject'
? props.gql.currentProject.cloudProject
Expand Down
12 changes: 12 additions & 0 deletions packages/app/src/debug/empty/DebugBranchError.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import DebugBranchError from './DebugBranchError.vue'
import { defaultMessages } from '@cy/i18n'

describe('<DebugBranchError />', () => {
it('can mount', () => {
cy.mount(<DebugBranchError />)
cy.get('[data-cy=debug-empty-title]').should('contain.text', defaultMessages.debugPage.emptyStates.noRunsFoundForBranch)
cy.get('[data-cy=debug-empty-description]').should('contain.text', defaultMessages.debugPage.emptyStates.noRunsForBranchMessage)
// The utm_source will be Binary%3A+App in production`open` mode but we assert using Binary%3A+Launchpad as this is the value in CI
cy.contains(defaultMessages.links.learnMoreButton).should('have.attr', 'href', 'https://on.cypress.io/git-info?utm_source=Binary%3A+Launchpad&utm_medium=Debug+Tab&utm_campaign=No+Runs+Found')
})
})
22 changes: 22 additions & 0 deletions packages/app/src/debug/empty/DebugBranchError.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<DebugEmptyView
:title="t('debugPage.emptyStates.noRunsFoundForBranch')"
:description="t('debugPage.emptyStates.noRunsForBranchMessage')"
:icon="IconTechnologyCommandLineError"
:utm="utm"
help-link-href="https://on.cypress.io/git-info"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No UTM params needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No UTM params needed here?

I don't see anything about UTM params in the requirements. @warrensplayer does this need added?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asking about this...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the links should have UTM params. The requirements in the issue have been updated.

/>
</template>

<script lang="ts" setup>
import DebugEmptyView from './DebugEmptyView.vue'
import { useI18n } from '@cy/i18n'
import { IconTechnologyCommandLineError } from '@cypress-design/vue-icon'

const { t } = useI18n()

const utm = {
utm_campaign: 'No Runs Found',
}

</script>
6 changes: 2 additions & 4 deletions packages/app/src/debug/empty/DebugEmptyStates.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,10 @@ describe('Debug page empty states', { defaultCommandTimeout: 250 }, () => {
})
})

context('error', () => {
context('not using git', () => {
it('renders', () => {
mountWithGql(<DebugError />)

cy.findByRole('link', { name: 'Learn more about debugging CI failures in Cypress' }).should('have.attr', 'href', 'https://on.cypress.io/debug-page?utm_source=Binary%3A+Launchpad&utm_medium=Debug+Tab&utm_campaign=Learn+More')

cy.findByText('Git repository not detected').should('be.visible')
cy.percySnapshot()
})
})
Expand Down
24 changes: 20 additions & 4 deletions packages/app/src/debug/empty/DebugEmptyView.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
<template>
<div class="flex flex-col mx-auto my-[45px] max-w-[680px] items-center">
<div class="flex flex-col items-center justify-evenly">
<div><i-cy-box-open_x48 class="icon-dark-gray-500 icon-light-indigo-100" /></div>
<component
:is="icon"
v-if="icon"
class="icon-dark-gray-500 icon-light-indigo-100"
/>
<div v-else>
<i-cy-box-open_x48 class="icon-dark-gray-500 icon-light-indigo-100" />
</div>
<div class="flex flex-col gap-1 my-6 max-w-[640px] items-center">
<div class="font-medium text-center text-gray-900 text-lg">
<div
data-cy="debug-empty-title"
class="font-medium text-center text-gray-900 text-lg"
>
{{ title }}
</div>
<div class="font-normal text-center leading-relaxed text-gray-600">
<div
data-cy="debug-empty-description"
class="font-normal text-center leading-relaxed text-gray-600"
>
{{ description }}
<span
v-if="helpLinkHref"
Expand Down Expand Up @@ -40,14 +53,17 @@ import { getUtmSource } from '@packages/frontend-shared/src/utils/getUtmSource'
import { useI18n } from '@packages/frontend-shared/src/locales/i18n'

import { DEBUG_TAB_MEDIUM } from '../utils/constants'
import type { FunctionalComponent, SVGAttributes } from 'vue'

const { t } = useI18n()

const props = defineProps<{
title: string
description?: string
icon?: FunctionalComponent<SVGAttributes, {}>
helpLinkHref?: string
helpLinkSrText?: string
utm?: { utm_campaign: string }
cohort?: string
}>()

Expand All @@ -56,7 +72,7 @@ const helpLink = getUrlWithParams({
params: {
utm_source: getUtmSource(),
utm_medium: DEBUG_TAB_MEDIUM,
utm_campaign: 'Learn More',
utm_campaign: props.utm?.utm_campaign || 'Learn More',
},
})

Expand Down
10 changes: 10 additions & 0 deletions packages/app/src/debug/empty/DebugError.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import DebugError from './DebugError.vue'
import { defaultMessages } from '@cy/i18n'

describe('<DebugError />', () => {
it('can mount', () => {
cy.mount(<DebugError />)
cy.contains(defaultMessages.debugPage.emptyStates.gitRepositoryNotDetected)
cy.contains(defaultMessages.debugPage.emptyStates.ensureGitSetupCorrectly)
})
})
21 changes: 4 additions & 17 deletions packages/app/src/debug/empty/DebugError.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
<template>
<div class="m-[25px]">
<Alert
data-cy="debug-alert"
status="warning"
:title="t('debugPage.emptyStates.gitRepositoryNotDetected')"
:icon="WarningIcon"
dismissible
>
<p>{{ t('debugPage.emptyStates.ensureGitSetupCorrectly') }}</p>
</Alert>
</div>
<DebugEmptyView
:title="t('debugPage.emptyStates.debugDirectlyInCypress')"
:description="t('debugPage.emptyStates.reviewRerunAndDebug')"
:help-link-sr-text="t('debugPage.emptyStates.learnAboutDebuggingSrText')"
help-link-href="https://on.cypress.io/debug-page"
:title="t('debugPage.emptyStates.gitRepositoryNotDetected')"
:description="t('debugPage.emptyStates.ensureGitSetupCorrectly')"
:icon="IconTechnologyCommandLineError"
/>
</template>

<script lang="ts" setup>
import DebugEmptyView from './DebugEmptyView.vue'
import Alert from '@packages/frontend-shared/src/components/Alert.vue'
import WarningIcon from '~icons/cy/warning_x16.svg'
import { useI18n } from '@cy/i18n'
import { IconTechnologyCommandLineError } from '@cypress-design/vue-icon'

const { t } = useI18n()

Expand Down
Loading