Skip to content

Commit 34d176a

Browse files
Fix non-GH onboard links (#3517)
1 parent b2c5487 commit 34d176a

File tree

12 files changed

+122
-91
lines changed

12 files changed

+122
-91
lines changed
Loading

src/pages/RepoPage/CoverageOnboarding/CircleCI/CircleCI.test.tsx

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ describe('CircleCI', () => {
104104
return HttpResponse.json({ data: { storeEventMetric: null } })
105105
})
106106
)
107-
return { mockMetricMutationVariables }
107+
const user = userEvent.setup()
108+
return { mockMetricMutationVariables, user }
108109
}
109110

110111
describe('step one', () => {
@@ -114,23 +115,19 @@ describe('CircleCI', () => {
114115

115116
const header = await screen.findByRole('heading', { name: /Step 1/ })
116117
expect(header).toBeInTheDocument()
117-
118-
const environmentVariableLink = await screen.findByRole('link', {
119-
name: /environment variables/,
120-
})
121-
expect(environmentVariableLink).toBeInTheDocument()
122-
expect(environmentVariableLink).toHaveAttribute(
123-
'href',
124-
'https://app.circleci.com/settings/project/github/codecov/cool-repo/environment-variables'
125-
)
126118
})
127119

128120
it('renders body', async () => {
129121
setup({})
130122
render(<CircleCI />, { wrapper })
131123

124+
const link = await screen.findByRole('link', {
125+
name: 'Environment variables',
126+
})
127+
expect(link).toBeInTheDocument()
128+
132129
const body = await screen.findByText(
133-
'Environment variables in CircleCI can be found in project settings.'
130+
/in CircleCI can be found in project settings/
134131
)
135132
expect(body).toBeInTheDocument()
136133
})
@@ -170,6 +167,41 @@ describe('CircleCI', () => {
170167
expect(token).toBeInTheDocument()
171168
})
172169
})
170+
171+
describe('has dropdown', () => {
172+
it('renders dropdown click target', async () => {
173+
setup({})
174+
render(<CircleCI />, { wrapper })
175+
176+
const trigger = await screen.findByText((content) =>
177+
content.startsWith(
178+
'Your environment variable in CircleCI should look like this:'
179+
)
180+
)
181+
expect(trigger).toBeInTheDocument()
182+
})
183+
it('renders dropdown content after clicked', async () => {
184+
const { user } = setup({})
185+
render(<CircleCI />, { wrapper })
186+
187+
let content = screen.queryByRole('img', {
188+
name: /settings environment variable/,
189+
})
190+
expect(content).not.toBeInTheDocument()
191+
192+
const trigger = await screen.findByText((content) =>
193+
content.startsWith(
194+
'Your environment variable in CircleCI should look like this:'
195+
)
196+
)
197+
await user.click(trigger)
198+
199+
content = await screen.findByRole('img', {
200+
name: /settings environment variable/,
201+
})
202+
expect(content).toBeInTheDocument()
203+
})
204+
})
173205
})
174206

175207
describe('step two', () => {
@@ -181,13 +213,18 @@ describe('CircleCI', () => {
181213
const header = await screen.findByRole('heading', { name: /Step 2/ })
182214
expect(header).toBeInTheDocument()
183215

184-
const CircleCIWorkflowLink = await screen.findByRole('link', {
185-
name: /config.yml/,
216+
const CircleCIJSWorkflowLink = await screen.findByRole('link', {
217+
name: 'config.yml',
218+
})
219+
expect(CircleCIJSWorkflowLink).toBeInTheDocument()
220+
221+
const CircleCIJSExampleLink = await screen.findByRole('link', {
222+
name: /javascript config.yml/,
186223
})
187-
expect(CircleCIWorkflowLink).toBeInTheDocument()
188-
expect(CircleCIWorkflowLink).toHaveAttribute(
224+
expect(CircleCIJSExampleLink).toBeInTheDocument()
225+
expect(CircleCIJSExampleLink).toHaveAttribute(
189226
'href',
190-
'https://github.com/codecov/cool-repo/tree/main/.circleci/config'
227+
'https://github.com/codecov/example-javascript/blob/main/.circleci/config.yml'
191228
)
192229
})
193230

@@ -203,7 +240,7 @@ describe('CircleCI', () => {
203240
it('renders yaml code', async () => {
204241
render(<CircleCI />, { wrapper })
205242

206-
const yamlCode = await screen.findByText(/codecov\/codecov@4.0.1/)
243+
const yamlCode = await screen.findByText(/codecov\/codecov@5/)
207244
expect(yamlCode).toBeInTheDocument()
208245
})
209246

src/pages/RepoPage/CoverageOnboarding/CircleCI/CircleCI.tsx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useParams } from 'react-router-dom'
22

3+
import envVarScreenshot from 'assets/onboarding/env_variable_screenshot.png'
34
import {
45
EVENT_METRICS,
56
useStoreCodecovEventMetric,
@@ -12,12 +13,13 @@ import { providerToInternalProvider } from 'shared/utils/provider'
1213
import A from 'ui/A'
1314
import { Card } from 'ui/Card'
1415
import { CodeSnippet } from 'ui/CodeSnippet'
16+
import { ExpandableSection } from 'ui/ExpandableSection'
1517

1618
import ExampleBlurb from '../ExampleBlurb'
1719
import LearnMoreBlurb from '../LearnMoreBlurb'
1820

1921
const orbsString = `orbs:
20-
codecov: codecov/codecov@4.0.1
22+
codecov: codecov/codecov@5
2123
workflows:
2224
upload-to-codecov:
2325
jobs:
@@ -48,7 +50,7 @@ function CircleCI() {
4850
const tokenCopy = orgUploadToken ? 'global' : 'repository'
4951

5052
return (
51-
<div className="flex flex-col gap-6">
53+
<div className="flex flex-col gap-5">
5254
<Step1
5355
tokenCopy={tokenCopy}
5456
uploadToken={uploadToken}
@@ -77,7 +79,11 @@ function Step1({ tokenCopy, uploadToken, providerName }: Step1Props) {
7779
<Card>
7880
<Card.Header>
7981
<Card.Title size="base">
80-
Step 1: add {tokenCopy} token to{' '}
82+
Step 1: add {tokenCopy} token to environment variables
83+
</Card.Title>
84+
</Card.Header>
85+
<Card.Content className="flex flex-col gap-4">
86+
<p>
8187
<A
8288
hook="circleCIEnvVarsLink"
8389
isExternal
@@ -86,13 +92,9 @@ function Step1({ tokenCopy, uploadToken, providerName }: Step1Props) {
8692
options: { provider: providerName },
8793
}}
8894
>
89-
environment variables
90-
</A>
91-
</Card.Title>
92-
</Card.Header>
93-
<Card.Content className="flex flex-col gap-4">
94-
<p>
95-
Environment variables in CircleCI can be found in project settings.
95+
Environment variables
96+
</A>{' '}
97+
in CircleCI can be found in project settings.
9698
</p>
9799
<div className="flex gap-4">
98100
<CodeSnippet className="basis-1/3" clipboard="CODECOV_TOKEN">
@@ -112,6 +114,20 @@ function Step1({ tokenCopy, uploadToken, providerName }: Step1Props) {
112114
{uploadToken}
113115
</CodeSnippet>
114116
</div>
117+
<ExpandableSection className="-mt-px">
118+
<ExpandableSection.Trigger>
119+
<p className="font-normal">
120+
Your environment variable in CircleCI should look like this:
121+
</p>
122+
</ExpandableSection.Trigger>
123+
<ExpandableSection.Content>
124+
<img
125+
className="size-full object-cover"
126+
alt="settings environment variable"
127+
src={envVarScreenshot}
128+
/>
129+
</ExpandableSection.Content>
130+
</ExpandableSection>
115131
</Card.Content>
116132
</Card>
117133
)
@@ -197,6 +213,7 @@ function FeedbackCTA() {
197213
>
198214
this issue
199215
</A>
216+
.
200217
</p>
201218
</Card.Content>
202219
</Card>

src/pages/RepoPage/CoverageOnboarding/ExampleBlurb/ExampleBlurb.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ describe('ExampleBlurb', () => {
1414
render(<ExampleBlurb />, { wrapper })
1515

1616
const docsLink = await screen.findByRole('link', {
17-
name: /repo here/,
17+
name: /javascript config.yml example/,
1818
})
1919
expect(docsLink).toBeInTheDocument()
2020
expect(docsLink).toHaveAttribute(
2121
'href',
22-
'https://github.com/codecov/example-python/blob/main/.github/workflows/ci.yml'
22+
'https://github.com/codecov/example-javascript/blob/main/.circleci/config.yml'
2323
)
2424
})
2525
it('renders correct CLI link', async () => {
2626
render(<ExampleBlurb />, { wrapper })
2727

2828
const docsLink = await screen.findByRole('link', {
29-
name: /our CLI/,
29+
name: /the setup on CircleCI/,
3030
})
3131
expect(docsLink).toBeInTheDocument()
3232
expect(docsLink).toHaveAttribute(
3333
'href',
34-
'https://github.com/codecov/codecov-action'
34+
'https://app.circleci.com/pipelines/github/codecov/example-javascript/148/workflows/180ae354-0d8c-4205-8815-f4c516a042a4/jobs/130/steps'
3535
)
3636
})
3737
})

src/pages/RepoPage/CoverageOnboarding/ExampleBlurb/ExampleBlurb.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@ import A from 'ui/A'
33
const ExampleBlurb = () => {
44
return (
55
<div data-testid="example-blurb">
6-
&#128193; See an example{' '}
6+
&#128193; View a{' '}
77
<A
8-
to={{ pageName: 'codecovExampleWorkflow' }}
8+
to={{ pageName: 'codecovExampleJSCircleCIWorkflow' }}
99
isExternal
1010
hook="codecov-workflow-intro"
1111
>
12-
repo here
12+
javascript config.yml example
1313
</A>{' '}
14-
and{' '}
14+
and see{' '}
1515
<A
16-
to={{ pageName: 'codecovActionRepo' }}
16+
to={{ pageName: 'codecovExampleJSCircleCIWorkflowSteps' }}
1717
isExternal
1818
hook="codecov-cli-intro"
1919
>
20-
our CLI.
20+
the setup on CircleCI
2121
</A>
22+
.
2223
</div>
2324
)
2425
}

src/pages/RepoPage/CoverageOnboarding/GitHubActions/GitHubActions.test.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,14 @@ describe('GitHubActions', () => {
465465
blurb = await screen.findByText(/about generating coverage reports/)
466466
expect(blurb).toBeInTheDocument()
467467
})
468+
469+
it('uses correct version of codecov-action', async () => {
470+
setup({})
471+
render(<GitHubActions />, { wrapper })
472+
473+
const version = await screen.findByText(/codecov\/codecov-action@v5/)
474+
expect(version).toBeInTheDocument()
475+
})
468476
})
469477
})
470478
})

src/pages/RepoPage/CoverageOnboarding/GitHubActions/GitHubActions.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
run: npx jest --coverage
6969
7070
- name: Upload results to Codecov
71-
uses: codecov/codecov-action@v4
71+
uses: codecov/codecov-action@v5
7272
with:
7373
token: \${{ secrets.CODECOV_TOKEN }}${
7474
orgUploadToken
@@ -106,7 +106,7 @@ jobs:
106106
run: npx vitest run --coverage
107107
108108
- name: Upload results to Codecov
109-
uses: codecov/codecov-action@v4
109+
uses: codecov/codecov-action@v5
110110
with:
111111
token: \${{ secrets.CODECOV_TOKEN }}${
112112
orgUploadToken
@@ -144,7 +144,7 @@ jobs:
144144
run: pytest --cov --cov-report=xml
145145
146146
- name: Upload results to Codecov
147-
uses: codecov/codecov-action@v4
147+
uses: codecov/codecov-action@v5
148148
with:
149149
token: \${{ secrets.CODECOV_TOKEN }}${
150150
orgUploadToken
@@ -182,7 +182,7 @@ jobs:
182182
run: go test -coverprofile=coverage.txt
183183
184184
- name: Upload results to Codecov
185-
uses: codecov/codecov-action@v4
185+
uses: codecov/codecov-action@v5
186186
with:
187187
token: \${{ secrets.CODECOV_TOKEN }}${
188188
orgUploadToken
@@ -195,7 +195,7 @@ jobs:
195195
}
196196

197197
return (
198-
<div className="flex flex-col gap-6">
198+
<div className="flex flex-col gap-5">
199199
<Step1
200200
framework={framework}
201201
frameworkInstructions={frameworkInstructions}
@@ -379,7 +379,7 @@ function Step3({
379379
const { mutate: storeEventMetric } = useStoreCodecovEventMetric()
380380

381381
const step3Config = `- name: Upload coverage reports to Codecov
382-
uses: codecov/codecov-action@v4
382+
uses: codecov/codecov-action@v5
383383
with:
384384
token: \${{ secrets.CODECOV_TOKEN }}${
385385
orgUploadToken

src/pages/RepoPage/CoverageOnboarding/OtherCI/OtherCI.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function OtherCI() {
4141
}`
4242

4343
return (
44-
<div className="flex flex-col gap-6">
44+
<div className="flex flex-col gap-5">
4545
<Step1 tokenCopy={tokenCopy} uploadToken={uploadToken} />
4646
<Step2 />
4747
<Step3 uploadCommand={uploadCommand} />

src/services/navigation/useNavLinks/useNavLinks.test.tsx

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,34 +1761,6 @@ describe('useNavLinks', () => {
17611761
})
17621762
})
17631763

1764-
describe('circleCIEnvVars', () => {
1765-
it('returns the correct link with nothing passed', () => {
1766-
const { result } = renderHook(() => useNavLinks(), {
1767-
wrapper: wrapper('/gh/codecov/cool-repo'),
1768-
})
1769-
1770-
const path = result.current.circleCIEnvVars.path()
1771-
expect(path).toBe(
1772-
'https://app.circleci.com/settings/project/gh/codecov/cool-repo/environment-variables'
1773-
)
1774-
})
1775-
1776-
it('can override the params', () => {
1777-
const { result } = renderHook(() => useNavLinks(), {
1778-
wrapper: wrapper('/gh/codecov/cool-repo'),
1779-
})
1780-
1781-
const path = result.current.circleCIEnvVars.path({
1782-
provider: 'bb',
1783-
owner: 'test-owner',
1784-
repo: 'test-repo',
1785-
})
1786-
expect(path).toBe(
1787-
'https://app.circleci.com/settings/project/bb/test-owner/test-repo/environment-variables'
1788-
)
1789-
})
1790-
})
1791-
17921764
describe('circleCI yaml', () => {
17931765
it('returns the correct link with nothing passed', () => {
17941766
const { result } = renderHook(() => useNavLinks(), {

src/services/navigation/useNavLinks/useNavLinks.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -788,19 +788,6 @@ export function useNavLinks() {
788788
isExternalLink: true,
789789
openNewTab: true,
790790
},
791-
circleCIEnvVars: {
792-
text: 'environment variables',
793-
path: (
794-
{ provider = p, owner = o, repo = r } = {
795-
provider: p,
796-
owner: o,
797-
repo: r,
798-
}
799-
) =>
800-
`https://app.circleci.com/settings/project/${provider}/${owner}/${repo}/environment-variables`,
801-
isExternalLink: true,
802-
openNewTab: true,
803-
},
804791
circleCIyaml: {
805792
text: 'config.yml',
806793
path: ({

0 commit comments

Comments
 (0)