Skip to content

Commit

Permalink
chore: cleanup pr
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanpowell88 committed May 18, 2023
1 parent eee6aec commit e1f23d0
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 45 deletions.
25 changes: 13 additions & 12 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,39 +125,40 @@
"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",
"types": "./vue/dist/index.d.ts"
"require": "./vue/dist/cypress-vue.cjs.js"
},
"./vue2": {
"types": "./vue2/dist/index.d.ts",
"import": "./vue2/dist/cypress-vue2.esm-bundler.js",
"require": "./vue2/dist/cypress-vue2.cjs.js",
"types": "./vue2/dist/index.d.ts"
"require": "./vue2/dist/cypress-vue2.cjs.js"
},
"./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",
"types": "./react/dist/index.d.ts"
"require": "./react/dist/cypress-react.cjs.js"
},
"./react18": {
"types": "./react18/dist/index.d.ts",
"import": "./react18/dist/cypress-react.esm-bundler.js",
"require": "./react18/dist/cypress-react.cjs.js",
"types": "./react18/dist/index.d.ts"
"require": "./react18/dist/cypress-react.cjs.js"
},
"./mount-utils": {
"require": "./mount-utils/dist/index.js",
"types": "./mount-utils/dist/index.d.ts"
"types": "./mount-utils/dist/index.d.ts",
"require": "./mount-utils/dist/index.js"
},
"./angular": {
"types": "./angular/dist/index.d.ts",
"import": "./angular/dist/index.js",
"require": "./angular/dist/index.js",
"types": "./angular/dist/index.d.ts"
"require": "./angular/dist/index.js"
},
"./svelte": {
"types": "./svelte/dist/index.d.ts",
"import": "./svelte/dist/cypress-svelte.esm-bundler.js",
"require": "./svelte/dist/cypress-svelte.cjs.js"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/debug/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const DEBUG_TAB_MEDIUM = 'Debug Tab'

export const RUNS_TAB_MEDIUM = 'Runs Tab'

export const DEBUG_PROMO_CAMPAIGNS = {
login: 'Debug Login Empty State',
connectProject: 'Debug Connect Project Empty State',
Expand Down
10 changes: 5 additions & 5 deletions packages/app/src/runs/RunsContainer.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ describe('<RunsContainer />', { keystrokeDelay: 0 }, () => {
},
})

cy.get('h3').contains('Git repository not detected')
cy.get('p').contains(defaultMessages.debugPage.emptyStates.ensureGitSetupCorrectly)
cy.get('h3').contains(defaultMessages.runs.empty.gitRepositoryNotDetected)
cy.get('p').contains(defaultMessages.runs.empty.ensureGitSetupCorrectly)
})
})

Expand All @@ -170,10 +170,10 @@ describe('<RunsContainer />', { keystrokeDelay: 0 }, () => {
},
})

cy.get('h3').contains(defaultMessages.debugPage.emptyStates.noRunsFoundForBranch)
cy.get('p').contains(defaultMessages.debugPage.emptyStates.noRunsForBranchMessage)
cy.get('h3').contains(defaultMessages.runs.empty.noRunsFoundForBranch)
cy.get('p').contains(defaultMessages.runs.empty.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')
cy.contains(defaultMessages.links.learnMoreButton).should('have.attr', 'href', 'https://on.cypress.io/git-info?utm_source=Binary%3A+Launchpad&utm_medium=Runs+Tab&utm_campaign=No+Runs+Found')
})
})
})
33 changes: 19 additions & 14 deletions packages/app/src/runs/RunsContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
/>
<Warning
v-else-if="userProjectStatusStore.cloudStatusMatches('needsRecordedRun') && userProjectStatusStore.project.isUsingGit"
:title="t('debugPage.emptyStates.noRunsFoundForBranch')"
:message="t('debugPage.emptyStates.noRunsForBranchMessage')"
:help-link-href="learnMoreLink"
:title="t('runs.empty.noRunsFoundForBranch')"
:message="noRunsForBranchMessage"
/>
<RunsErrorRenderer
v-else-if="currentProject?.cloudProject?.__typename !== 'CloudProject' || connectionFailed"
Expand All @@ -42,8 +41,8 @@
/>
<Warning
v-if="!userProjectStatusStore.project.isUsingGit"
:title="t('debugPage.emptyStates.gitRepositoryNotDetected')"
:message="t('debugPage.emptyStates.ensureGitSetupCorrectly')"
:title="t('runs.empty.gitRepositoryNotDetected')"
:message="t('runs.empty.ensureGitSetupCorrectly')"
/>
<RunCard
v-for="run of currentProject?.cloudProject?.runs?.nodes"
Expand All @@ -67,10 +66,9 @@ import { RunsContainerFragment, RunsContainer_FetchNewerRunsDocument } from '../
import Warning from '@packages/frontend-shared/src/warning/Warning.vue'
import RunsErrorRenderer from './RunsErrorRenderer.vue'
import { useUserProjectStatusStore } from '@packages/frontend-shared/src/store/user-project-status-store'
import { RUNS_PROMO_CAMPAIGNS } from './utils/constants'
import { RUNS_PROMO_CAMPAIGNS, RUNS_TAB_MEDIUM } from './utils/constants'
import { getUrlWithParams } from '@packages/frontend-shared/src/utils/getUrlWithParams'
import { getUtmSource } from '@packages/frontend-shared/src/utils/getUtmSource'
import { DEBUG_TAB_MEDIUM } from '../debug/utils/constants'
const { t } = useI18n()
Expand Down Expand Up @@ -206,13 +204,20 @@ const props = defineProps<{
const showConnectSuccessAlert = ref(false)
const connectionFailed = computed(() => !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 noRunsForBranchMessage = computed(() => {
const learnMoreLink = getUrlWithParams({
url: 'https://on.cypress.io/git-info',
params: {
utm_source: getUtmSource(),
utm_medium: RUNS_TAB_MEDIUM,
utm_campaign: 'No Runs Found',
},
})
const message = t('runs.empty.noRunsForBranchMessage')
const link = `[${t('links.learnMoreButton')}](${learnMoreLink})`
return `${message} ${link}`
})
const userProjectStatusStore = useUserProjectStatusStore()
Expand Down
6 changes: 5 additions & 1 deletion packages/frontend-shared/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,11 @@
"empty": {
"title": "Copy the command below to record your first run",
"description": "Review the {0} to Cypress Cloud",
"link": "guide on recording runs"
"link": "guide on recording runs",
"gitRepositoryNotDetected": "Git repository not detected",
"ensureGitSetupCorrectly": "Cypress uses Git to associate runs with your local state. As a fallback, all runs for your project are shown. Please ensure that version control is set up correctly.",
"noRunsFoundForBranch": "No runs found for your branch",
"noRunsForBranchMessage": "Cypress uses Git to show runs for your branch. As a fallback, all runs for your project are shown. Ensure that version control is properly configured and that you are sending Git information to Cypress Cloud."
},
"results": {
"skipped": "skipped",
Expand Down
9 changes: 4 additions & 5 deletions packages/frontend-shared/src/warning/Warning.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ describe('<Warning />', () => {
})

it('renders with a Learn more Link', () => {
const link = 'https://on.cypress.io/git-info'
// eslint-disable-next-line prefer-template
const messagePlusLink = message + '[Learn more](https://on.cypress.io/git-info)'

cy.mount(() => (<div class="p-4"><Warning
title={title}
// Trim the message so you can validate that helpLinkHref is displaying in line
message={message.substring(0, 50)}
helpLinkHref={link}
message={messagePlusLink}
/></div>))

cy.contains('Learn more').should('have.attr', 'href', link)
cy.contains('Learn more').should('have.attr', 'href', 'https://on.cypress.io/git-info')
})
})
8 changes: 0 additions & 8 deletions packages/frontend-shared/src/warning/Warning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ 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,
})
Expand All @@ -66,12 +64,6 @@ let message = computed(() => {
return [props.message, ` ${ props.details }`].join('\n\n')
}
if (props.helpLinkHref) {
const learnMoreLabel = t('links.learnMoreButton')
return `${props.message} [${learnMoreLabel}](${props.helpLinkHref})`
}
return props.message
})
Expand Down

0 comments on commit e1f23d0

Please sign in to comment.