From af7d0d60743ea8cdb76b9a4b02131c3a83f39ba5 Mon Sep 17 00:00:00 2001 From: jordanpowell88 Date: Fri, 12 May 2023 11:07:18 -0400 Subject: [PATCH 01/24] feat(app): update DebugError copy --- packages/app/src/debug/DebugContainer.cy.tsx | 1 - .../app/src/debug/empty/DebugError.cy.tsx | 7 +++++++ packages/app/src/debug/empty/DebugError.vue | 19 ++----------------- .../frontend-shared/src/locales/en-US.json | 2 +- 4 files changed, 10 insertions(+), 19 deletions(-) create mode 100644 packages/app/src/debug/empty/DebugError.cy.tsx diff --git a/packages/app/src/debug/DebugContainer.cy.tsx b/packages/app/src/debug/DebugContainer.cy.tsx index 9b8f30362d8c..1e9d1bb35416 100644 --- a/packages/app/src/debug/DebugContainer.cy.tsx +++ b/packages/app/src/debug/DebugContainer.cy.tsx @@ -91,7 +91,6 @@ describe('', () => { }) cy.findByTestId('debug-empty').should('not.exist') - cy.findByTestId('debug-alert').should('be.visible') }) }) diff --git a/packages/app/src/debug/empty/DebugError.cy.tsx b/packages/app/src/debug/empty/DebugError.cy.tsx new file mode 100644 index 000000000000..41537f8cfa7d --- /dev/null +++ b/packages/app/src/debug/empty/DebugError.cy.tsx @@ -0,0 +1,7 @@ +import DebugError from './DebugError.vue' + +describe('', () => { + it('can mount', () => { + cy.mount() + }) +}) diff --git a/packages/app/src/debug/empty/DebugError.vue b/packages/app/src/debug/empty/DebugError.vue index fa59dd99d9bc..b4ff2abe3709 100644 --- a/packages/app/src/debug/empty/DebugError.vue +++ b/packages/app/src/debug/empty/DebugError.vue @@ -1,27 +1,12 @@ diff --git a/packages/frontend-shared/src/store/user-project-status-store.ts b/packages/frontend-shared/src/store/user-project-status-store.ts index 28e798470c48..508f44437487 100644 --- a/packages/frontend-shared/src/store/user-project-status-store.ts +++ b/packages/frontend-shared/src/store/user-project-status-store.ts @@ -28,6 +28,7 @@ export interface UserProjectStatusState { isNotFound: boolean isCTConfigured: boolean hasDetectedCtFramework: boolean + isUsingGit: boolean } userData?: LoginUserData promptsShown: { @@ -82,6 +83,7 @@ export const useUserProjectStatusStore = defineStore({ isNotFound: false, isCTConfigured: false, hasDetectedCtFramework: false, + isUsingGit: false, }, promptsShown: {}, bannersState: {}, From 169a9c6cb64b8115409d75dd1a66e06edb5e77b6 Mon Sep 17 00:00:00 2001 From: jordanpowell88 Date: Fri, 12 May 2023 15:29:50 -0400 Subject: [PATCH 03/24] feat(app): update not using git icon for DebugError --- cli/package.json | 25 +++++++++---------- packages/app/package.json | 2 +- .../src/debug/empty/DebugEmptyStates.cy.tsx | 4 +-- .../app/src/debug/empty/DebugEmptyView.vue | 11 +++++++- .../app/src/debug/empty/DebugError.cy.tsx | 2 ++ packages/app/src/debug/empty/DebugError.vue | 2 ++ yarn.lock | 18 ++++++------- 7 files changed, 37 insertions(+), 27 deletions(-) diff --git a/cli/package.json b/cli/package.json index f9c2d09f146b..a8afaba53221 100644 --- a/cli/package.json +++ b/cli/package.json @@ -125,40 +125,39 @@ "require": "./index.js" }, "./vue": { - "types": "./vue/dist/index.d.ts", "import": "./vue/dist/cypress-vue.esm-bundler.js", - "require": "./vue/dist/cypress-vue.cjs.js" + "require": "./vue/dist/cypress-vue.cjs.js", + "types": "./vue/dist/index.d.ts" }, "./vue2": { - "types": "./vue2/dist/index.d.ts", "import": "./vue2/dist/cypress-vue2.esm-bundler.js", - "require": "./vue2/dist/cypress-vue2.cjs.js" + "require": "./vue2/dist/cypress-vue2.cjs.js", + "types": "./vue2/dist/index.d.ts" }, "./package.json": { "import": "./package.json", "require": "./package.json" }, "./react": { - "types": "./react/dist/index.d.ts", "import": "./react/dist/cypress-react.esm-bundler.js", - "require": "./react/dist/cypress-react.cjs.js" + "require": "./react/dist/cypress-react.cjs.js", + "types": "./react/dist/index.d.ts" }, "./react18": { - "types": "./react18/dist/index.d.ts", "import": "./react18/dist/cypress-react.esm-bundler.js", - "require": "./react18/dist/cypress-react.cjs.js" + "require": "./react18/dist/cypress-react.cjs.js", + "types": "./react18/dist/index.d.ts" }, "./mount-utils": { - "types": "./mount-utils/dist/index.d.ts", - "require": "./mount-utils/dist/index.js" + "require": "./mount-utils/dist/index.js", + "types": "./mount-utils/dist/index.d.ts" }, "./angular": { - "types": "./angular/dist/index.d.ts", "import": "./angular/dist/index.js", - "require": "./angular/dist/index.js" + "require": "./angular/dist/index.js", + "types": "./angular/dist/index.d.ts" }, "./svelte": { - "types": "./svelte/dist/index.d.ts", "import": "./svelte/dist/cypress-svelte.esm-bundler.js", "require": "./svelte/dist/cypress-svelte.cjs.js" } diff --git a/packages/app/package.json b/packages/app/package.json index b0a4cff12435..109d59767634 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -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", diff --git a/packages/app/src/debug/empty/DebugEmptyStates.cy.tsx b/packages/app/src/debug/empty/DebugEmptyStates.cy.tsx index 20f1acb8a0c2..b2226b6a0942 100644 --- a/packages/app/src/debug/empty/DebugEmptyStates.cy.tsx +++ b/packages/app/src/debug/empty/DebugEmptyStates.cy.tsx @@ -119,12 +119,10 @@ describe('Debug page empty states', { defaultCommandTimeout: 250 }, () => { }) }) - context('error', () => { + context('not using git', () => { it('renders', () => { mountWithGql() - 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.percySnapshot() }) }) diff --git a/packages/app/src/debug/empty/DebugEmptyView.vue b/packages/app/src/debug/empty/DebugEmptyView.vue index db4624830c27..cd890ab4ed44 100644 --- a/packages/app/src/debug/empty/DebugEmptyView.vue +++ b/packages/app/src/debug/empty/DebugEmptyView.vue @@ -1,7 +1,13 @@ diff --git a/packages/frontend-shared/src/locales/en-US.json b/packages/frontend-shared/src/locales/en-US.json index bd604e098335..74aca61cfefa 100644 --- a/packages/frontend-shared/src/locales/en-US.json +++ b/packages/frontend-shared/src/locales/en-US.json @@ -743,6 +743,8 @@ "learnAboutRecordingSrText": "about recording a run to Cypress Cloud", "learnAboutDebuggingSrText": "about debugging CI failures in Cypress", "learnAboutProjectSetupSrText": "about project setup in Cypress", + "noRunsFoundForBranch": "No runs found for your branch", + "noRunsForBranchMessage": "Cypress uses Git to show runs for your branch. Ensure that version control is properly configured and that you are sending Git information to Cypress Cloud.", "slideshow": { "tour": { "title": "Record your first test run to Cypress Cloud", From a7bc3f5bdc91008c8a1d3fa1bd820d42e1ee68ab Mon Sep 17 00:00:00 2001 From: jordanpowell88 Date: Mon, 15 May 2023 11:28:18 -0400 Subject: [PATCH 06/24] feat(app): add warning for no runs for branch on runs container --- packages/app/src/runs/RunsContainer.cy.tsx | 28 +++++++++++++++++++ packages/app/src/runs/RunsContainer.vue | 8 ++++++ .../frontend-shared/src/warning/Warning.vue | 7 +++++ 3 files changed, 43 insertions(+) diff --git a/packages/app/src/runs/RunsContainer.cy.tsx b/packages/app/src/runs/RunsContainer.cy.tsx index 691f6fdcaafe..5e23d8168263 100644 --- a/packages/app/src/runs/RunsContainer.cy.tsx +++ b/packages/app/src/runs/RunsContainer.cy.tsx @@ -147,4 +147,32 @@ describe('', { keystrokeDelay: 0 }, () => { cy.get('p').contains('Cypress uses git to associate runs with your local state. Please ensure that git is properly configured for your project.') }) }) + + context('when using git but no runs for current branch', () => { + it('renders alert message', () => { + const { setUserFlag, setProjectFlag, cloudStatusMatches } = useUserProjectStatusStore() + + setUserFlag('isLoggedIn', true) + setUserFlag('isMemberOfOrganization', true) + setProjectFlag('isProjectConnected', true) + setProjectFlag('hasNoRecordedRuns', true) + setProjectFlag('hasNonExampleSpec', true) + setProjectFlag('isConfigLoaded', true) + setProjectFlag('isUsingGit', true) + + expect(cloudStatusMatches('needsRecordedRun')).equals(true) + cy.mountFragment(RunsContainerFragmentDoc, { + onResult: (result) => { + result.cloudViewer = cloudViewer + }, + render (gqlVal) { + return + }, + }) + + cy.get('h3').contains('No runs found for your branch') + cy.get('p').contains('Cypress uses Git to show runs for your branch. Ensure that version control is properly configured and that you are sending Git information to Cypress Cloud.') + cy.contains('Learn more') + }) + }) }) diff --git a/packages/app/src/runs/RunsContainer.vue b/packages/app/src/runs/RunsContainer.vue index 2d441124e3cf..8106f5aa3928 100644 --- a/packages/app/src/runs/RunsContainer.vue +++ b/packages/app/src/runs/RunsContainer.vue @@ -8,15 +8,23 @@ :gql="currentProject" :class="{ 'absolute left-[24px] right-[24px] top-[24px]': currentProject?.cloudProject?.__typename === 'CloudProject' && !currentProject.cloudProject.runs?.nodes.length }" /> + + + diff --git a/packages/frontend-shared/src/warning/Warning.vue b/packages/frontend-shared/src/warning/Warning.vue index 4f6a7004b46c..26aa96d75c61 100644 --- a/packages/frontend-shared/src/warning/Warning.vue +++ b/packages/frontend-shared/src/warning/Warning.vue @@ -46,12 +46,14 @@ const props = withDefaults(defineProps<{ title: string message: string details?: string | null + helpLinkHref?: string | null modelValue?: boolean dismissible?: boolean retryable?: boolean }>(), { modelValue: true, details: undefined, + helpLinkHref: undefined, dismissible: true, retryable: false, }) @@ -64,6 +66,11 @@ let message = computed(() => { return [props.message, ` ${ props.details }`].join('\n\n') } + if (props.helpLinkHref) { + // eslint-disable-next-line prefer-template + return props.message + ` ${t('links.learnMoreButton')}` + } + return props.message }) From 16c42b49624d676f3bbd220be6ef594e89bd8fd8 Mon Sep 17 00:00:00 2001 From: jordanpowell88 Date: Mon, 15 May 2023 11:41:48 -0400 Subject: [PATCH 07/24] chore: add feat to CHANGELOG --- cli/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index fc6441362e3f..b9e876b116a2 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -3,6 +3,9 @@ _Released 05/23/2023 (PENDING)_ +**Features:** +- Add Git related messages for the Runs and Debug Page when users aren't using Git or their 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). From dc4cfd1be1908f2f29450aa01be2b31911d55b14 Mon Sep 17 00:00:00 2001 From: jordanpowell88 Date: Mon, 15 May 2023 14:17:20 -0400 Subject: [PATCH 08/24] chore: remove logged status value --- packages/app/src/debug/DebugContainer.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/app/src/debug/DebugContainer.vue b/packages/app/src/debug/DebugContainer.vue index 62151146520f..2aca19de5db0 100644 --- a/packages/app/src/debug/DebugContainer.vue +++ b/packages/app/src/debug/DebugContainer.vue @@ -1,6 +1,5 @@ diff --git a/packages/app/src/debug/empty/DebugEmptyView.vue b/packages/app/src/debug/empty/DebugEmptyView.vue index f9e071a86622..16d762f9235b 100644 --- a/packages/app/src/debug/empty/DebugEmptyView.vue +++ b/packages/app/src/debug/empty/DebugEmptyView.vue @@ -64,6 +64,7 @@ const props = defineProps<{ exampleTestName?: string helpLinkHref?: string helpLinkSrText?: string + utm?: { utm_campaign: string } cohort?: string }>() @@ -72,7 +73,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', }, }) diff --git a/packages/app/src/runs/RunsContainer.cy.tsx b/packages/app/src/runs/RunsContainer.cy.tsx index 5e23d8168263..7967fe15e22e 100644 --- a/packages/app/src/runs/RunsContainer.cy.tsx +++ b/packages/app/src/runs/RunsContainer.cy.tsx @@ -170,9 +170,10 @@ describe('', { keystrokeDelay: 0 }, () => { }, }) - cy.get('h3').contains('No runs found for your branch') - cy.get('p').contains('Cypress uses Git to show runs for your branch. Ensure that version control is properly configured and that you are sending Git information to Cypress Cloud.') - cy.contains('Learn more') + cy.get('h3').contains(defaultMessages.debugPage.emptyStates.noRunsFoundForBranch) + cy.get('p').contains(defaultMessages.debugPage.emptyStates.noRunsForBranchMessage) + // This will fail locally as the utm_source will be Binary%3A+Lauanchpad in `open` mode + cy.contains(defaultMessages.links.learnMoreButton).should('have.attr', 'href', 'https://on.cypress.io/git-info?utm_source=Binary%3A+App&utm_medium=Debug+Tab&utm_campaign=No+Runs+Found') }) }) }) diff --git a/packages/app/src/runs/RunsContainer.vue b/packages/app/src/runs/RunsContainer.vue index 8106f5aa3928..a469670933e5 100644 --- a/packages/app/src/runs/RunsContainer.vue +++ b/packages/app/src/runs/RunsContainer.vue @@ -17,7 +17,7 @@ v-else-if="userProjectStatusStore.cloudStatusMatches('needsRecordedRun') && userProjectStatusStore.project.isUsingGit" :title="t('debugPage.emptyStates.noRunsFoundForBranch')" :message="t('debugPage.emptyStates.noRunsForBranchMessage')" - help-link-href="https://on.cypress.io/git-info" + :help-link-href="learnMoreLink" /> !props.gql.currentProject?.cloudProject && props.online) +const learnMoreLink = getUrlWithParams({ + url: 'https://on.cypress.io/git-info', + params: { + utm_source: getUtmSource(), + utm_medium: DEBUG_TAB_MEDIUM, + utm_campaign: 'No Runs Found', + }, +}) + const userProjectStatusStore = useUserProjectStatusStore() watch(() => userProjectStatusStore.project.isProjectConnected, (newVal, oldVal) => { diff --git a/packages/frontend-shared/src/warning/Warning.cy.tsx b/packages/frontend-shared/src/warning/Warning.cy.tsx index 0289c69a92df..9e422e4e1514 100644 --- a/packages/frontend-shared/src/warning/Warning.cy.tsx +++ b/packages/frontend-shared/src/warning/Warning.cy.tsx @@ -54,7 +54,8 @@ describe('', () => { cy.mount(() => (
)) diff --git a/packages/frontend-shared/src/warning/Warning.vue b/packages/frontend-shared/src/warning/Warning.vue index b3ae7e48a15b..9002f7858e4f 100644 --- a/packages/frontend-shared/src/warning/Warning.vue +++ b/packages/frontend-shared/src/warning/Warning.vue @@ -13,12 +13,6 @@ class="warning-markdown" v-html="markdown" /> - - {{ t('links.learnMoreButton') }} -