Skip to content

Commit a9223ea

Browse files
authored
feat(codecov): Add in routes for new Codecov views (#88712)
This PR adds in the routes that are being used to display the various pages for Codecov content. As well as renaming directories from `pipeline` to `codecov` and updating the codeowners file accordingly.
1 parent fb8560d commit a9223ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+287
-252
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ tests/sentry/api/endpoints/test_organization_dashboard_widget_details.py @ge
369369
## End of DevToolbar
370370

371371
## Codecov Merge UX
372-
/static/app/components/pipeline/ @getsentry/codecov-merge-ux
373-
/static/app/utils/pipeline/ @getsentry/codecov-merge-ux
374-
/static/app/views/pipeline/ @getsentry/codecov-merge-ux
372+
/static/app/components/codecov/ @getsentry/codecov-merge-ux
373+
/static/app/utils/codecov/ @getsentry/codecov-merge-ux
374+
/static/app/views/codecov/ @getsentry/codecov-merge-ux
375375
## End of Codecov Merge UX
376376

377377
## Frontend

static/app/routes.tsx

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,101 @@ function buildRoutes() {
20072007
/>
20082008
);
20092009

2010+
const codecovCommitRoutes = (
2011+
/* This is a layout route that will render a header for a commit */
2012+
<Route
2013+
path="commits/:sha/"
2014+
component={make(
2015+
() => import('sentry/views/codecov/coverage/commits/commitWrapper')
2016+
)}
2017+
>
2018+
<IndexRoute
2019+
component={make(
2020+
() => import('sentry/views/codecov/coverage/commits/commitDetail')
2021+
)}
2022+
/>
2023+
<Route
2024+
path="history/"
2025+
component={make(
2026+
() => import('sentry/views/codecov/coverage/commits/commitHistory')
2027+
)}
2028+
/>
2029+
<Route
2030+
path="yaml/"
2031+
component={make(() => import('sentry/views/codecov/coverage/commits/commitYaml'))}
2032+
/>
2033+
</Route>
2034+
);
2035+
const codecovPRRoutes = (
2036+
/* This is a layout route that will render a header for a pull request */
2037+
<Route
2038+
path="pulls/:pullId/"
2039+
component={make(() => import('sentry/views/codecov/coverage/pulls/pullWrapper'))}
2040+
>
2041+
<IndexRoute
2042+
component={make(() => import('sentry/views/codecov/coverage/pulls/pullDetail'))}
2043+
/>
2044+
</Route>
2045+
);
2046+
const codecovChildrenRoutes = (
2047+
<Fragment>
2048+
<Route path="coverage/">
2049+
{/* This is a layout route that will render a header for coverage */}
2050+
<Route
2051+
component={make(() => import('sentry/views/codecov/coverage/coverageWrapper'))}
2052+
>
2053+
<IndexRoute
2054+
component={make(() => import('sentry/views/codecov/coverage/coverage'))}
2055+
/>
2056+
<Route
2057+
path="commits/"
2058+
component={make(() => import('sentry/views/codecov/coverage/commits'))}
2059+
/>
2060+
<Route
2061+
path="pulls/"
2062+
component={make(() => import('sentry/views/codecov/coverage/pulls'))}
2063+
/>
2064+
<Route
2065+
path="coverage-trend/"
2066+
component={make(() => import('sentry/views/codecov/coverage/coverageTrend'))}
2067+
/>
2068+
</Route>
2069+
2070+
{/* Render coverage onboarding without any layout wrapping */}
2071+
<Route
2072+
path="new/"
2073+
component={make(() => import('sentry/views/codecov/coverage/onboarding'))}
2074+
/>
2075+
2076+
{codecovCommitRoutes}
2077+
{codecovPRRoutes}
2078+
</Route>
2079+
<Route path="tests/">
2080+
{/* Render tests onboarding with layout wrapper */}
2081+
<Route component={make(() => import('sentry/views/codecov/tests/testsWrapper'))}>
2082+
<IndexRoute
2083+
component={make(() => import('sentry/views/codecov/tests/tests'))}
2084+
/>
2085+
</Route>
2086+
2087+
{/* Render tests onboarding without any layout wrapping */}
2088+
<Route
2089+
path="new/"
2090+
component={make(() => import('sentry/views/codecov/tests/onboarding'))}
2091+
/>
2092+
</Route>
2093+
</Fragment>
2094+
);
2095+
const codecovRoutes = (
2096+
<Route
2097+
path="/codecov/"
2098+
withOrgPath
2099+
component={make(() => import('sentry/views/codecov/index'))}
2100+
>
2101+
{codecovChildrenRoutes}
2102+
</Route>
2103+
);
2104+
20102105
const feedbackV2ChildRoutes = (
20112106
<Fragment>
20122107
<IndexRoute
@@ -2402,6 +2497,7 @@ function buildRoutes() {
24022497
{feedbackv2Routes}
24032498
{issueRoutes}
24042499
{alertRoutes}
2500+
{codecovRoutes}
24052501
{cronsRoutes}
24062502
{replayRoutes}
24072503
{releasesRoutes}

static/app/views/pipeline/coverage/commits.spec.tsx renamed to static/app/views/codecov/coverage/commits.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import CommitsListPage from 'sentry/views/pipeline/coverage/commits';
5+
import CommitsListPage from 'sentry/views/codecov/coverage/commits';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

static/app/views/pipeline/coverage/commits/commitDetail.spec.tsx renamed to static/app/views/codecov/coverage/commits/commitDetail.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import CommitDetailPage from 'sentry/views/pipeline/coverage/commits/commitDetail';
5+
import CommitDetailPage from 'sentry/views/codecov/coverage/commits/commitDetail';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

static/app/views/pipeline/coverage/commits/commitHistory.spec.tsx renamed to static/app/views/codecov/coverage/commits/commitHistory.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import CommitHistoryPage from 'sentry/views/pipeline/coverage/commits/commitHistory';
5+
import CommitHistoryPage from 'sentry/views/codecov/coverage/commits/commitHistory';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {OrganizationFixture} from 'sentry-fixture/organization';
2+
3+
import {render, screen} from 'sentry-test/reactTestingLibrary';
4+
5+
import CommitDetailWrapper from 'sentry/views/codecov/coverage/commits/commitWrapper';
6+
7+
const COVERAGE_FEATURE = 'codecov-ui';
8+
9+
describe('CommitDetailWrapper', () => {
10+
describe('when the wrapper is used', () => {
11+
it('renders the document title', () => {
12+
render(<CommitDetailWrapper />, {
13+
organization: OrganizationFixture({features: [COVERAGE_FEATURE]}),
14+
});
15+
16+
const testTitle = screen.getByText('Commit Page Wrapper');
17+
expect(testTitle).toBeInTheDocument();
18+
});
19+
});
20+
});

static/app/views/pipeline/coverage/commits/commitWrapper.tsx renamed to static/app/views/codecov/coverage/commits/commitWrapper.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
import {Outlet} from 'react-router-dom';
12
import styled from '@emotion/styled';
23

34
import {FeatureBadge} from 'sentry/components/core/badge/featureBadge';
45
import * as Layout from 'sentry/components/layouts/thirds';
56
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
67
import useOrganization from 'sentry/utils/useOrganization';
78

8-
interface Props {
9-
children: React.ReactNode;
10-
}
11-
12-
export default function CommitDetailWrapper({children}: Props) {
9+
export default function CommitDetailWrapper() {
1310
const organization = useOrganization();
1411

1512
return (
@@ -26,7 +23,9 @@ export default function CommitDetailWrapper({children}: Props) {
2623
</Layout.HeaderContent>
2724
</Layout.Header>
2825
<Layout.Body>
29-
<Layout.Main fullWidth>{children}</Layout.Main>
26+
<Layout.Main fullWidth>
27+
<Outlet />
28+
</Layout.Main>
3029
</Layout.Body>
3130
</SentryDocumentTitle>
3231
);

static/app/views/pipeline/coverage/commits/commitYaml.spec.tsx renamed to static/app/views/codecov/coverage/commits/commitYaml.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import CommitYamlPage from 'sentry/views/pipeline/coverage/commits/commitYaml';
5+
import CommitYamlPage from 'sentry/views/codecov/coverage/commits/commitYaml';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

static/app/views/pipeline/coverage/coverage.spec.tsx renamed to static/app/views/codecov/coverage/coverage.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import CoveragePage from 'sentry/views/pipeline/coverage/coverage';
5+
import CoveragePage from 'sentry/views/codecov/coverage/coverage';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

static/app/views/pipeline/coverage/coverageTrend.spec.tsx renamed to static/app/views/codecov/coverage/coverageTrend.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import CoverageTrendPage from 'sentry/views/pipeline/coverage/coverageTrend';
5+
import CoverageTrendPage from 'sentry/views/codecov/coverage/coverageTrend';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {OrganizationFixture} from 'sentry-fixture/organization';
2+
3+
import {render, screen} from 'sentry-test/reactTestingLibrary';
4+
5+
import CoveragePageWrapper from 'sentry/views/codecov/coverage/coverageWrapper';
6+
import {COVERAGE_PAGE_TITLE} from 'sentry/views/codecov/settings';
7+
8+
const COVERAGE_FEATURE = 'codecov-ui';
9+
10+
describe('CoveragePageWrapper', () => {
11+
describe('when the wrapper is used', () => {
12+
it('renders the document title', () => {
13+
render(<CoveragePageWrapper />, {
14+
organization: OrganizationFixture({features: [COVERAGE_FEATURE]}),
15+
});
16+
17+
const testTitle = screen.getByText(COVERAGE_PAGE_TITLE);
18+
expect(testTitle).toBeInTheDocument();
19+
});
20+
});
21+
});

static/app/views/pipeline/coverage/index.tsx renamed to static/app/views/codecov/coverage/coverageWrapper.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1+
import {Outlet} from 'react-router-dom';
12
import styled from '@emotion/styled';
23

34
import {FeatureBadge} from 'sentry/components/core/badge/featureBadge';
45
import * as Layout from 'sentry/components/layouts/thirds';
56
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
67
import useOrganization from 'sentry/utils/useOrganization';
7-
import {COVERAGE_PAGE_TITLE} from 'sentry/views/pipeline/settings';
8+
import {COVERAGE_PAGE_TITLE} from 'sentry/views/codecov/settings';
89

9-
interface Props {
10-
children: React.ReactNode;
11-
}
12-
13-
export default function CoveragePageWrapper({children}: Props) {
10+
export default function CoveragePageWrapper() {
1411
const organization = useOrganization();
1512

1613
return (
@@ -26,7 +23,9 @@ export default function CoveragePageWrapper({children}: Props) {
2623
</Layout.HeaderContent>
2724
</Layout.Header>
2825
<Layout.Body>
29-
<Layout.Main fullWidth>{children}</Layout.Main>
26+
<Layout.Main fullWidth>
27+
<Outlet />
28+
</Layout.Main>
3029
</Layout.Body>
3130
</SentryDocumentTitle>
3231
);

static/app/views/pipeline/coverage/onboarding.spec.tsx renamed to static/app/views/codecov/coverage/onboarding.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import CoverageOnboardingPage from 'sentry/views/pipeline/coverage/onboarding';
5+
import CoverageOnboardingPage from 'sentry/views/codecov/coverage/onboarding';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

static/app/views/pipeline/coverage/pulls.spec.tsx renamed to static/app/views/codecov/coverage/pulls.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import PullsListPage from 'sentry/views/pipeline/coverage/pulls';
5+
import PullsListPage from 'sentry/views/codecov/coverage/pulls';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

static/app/views/pipeline/coverage/pulls/pullDetail.spec.tsx renamed to static/app/views/codecov/coverage/pulls/pullDetail.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import PullDetailPage from 'sentry/views/pipeline/coverage/pulls/pullDetail';
5+
import PullDetailPage from 'sentry/views/codecov/coverage/pulls/pullDetail';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {OrganizationFixture} from 'sentry-fixture/organization';
2+
3+
import {render, screen} from 'sentry-test/reactTestingLibrary';
4+
5+
import PullDetailWrapper from 'sentry/views/codecov/coverage/pulls/pullWrapper';
6+
7+
const COVERAGE_FEATURE = 'codecov-ui';
8+
9+
describe('PullDetailWrapper', () => {
10+
describe('when the wrapper is used', () => {
11+
it('renders the document title', () => {
12+
render(<PullDetailWrapper />, {
13+
organization: OrganizationFixture({features: [COVERAGE_FEATURE]}),
14+
});
15+
16+
const testTitle = screen.getByText('Pull Page Wrapper');
17+
expect(testTitle).toBeInTheDocument();
18+
});
19+
});
20+
});

static/app/views/pipeline/coverage/pulls/pullWraper.tsx renamed to static/app/views/codecov/coverage/pulls/pullWrapper.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
import {Outlet} from 'react-router-dom';
12
import styled from '@emotion/styled';
23

34
import {FeatureBadge} from 'sentry/components/core/badge/featureBadge';
45
import * as Layout from 'sentry/components/layouts/thirds';
56
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
67
import useOrganization from 'sentry/utils/useOrganization';
78

8-
interface Props {
9-
children: React.ReactNode;
10-
}
11-
12-
export default function PullDetailWrapper({children}: Props) {
9+
export default function PullDetailWrapper() {
1310
const organization = useOrganization();
1411

1512
return (
@@ -26,7 +23,9 @@ export default function PullDetailWrapper({children}: Props) {
2623
</Layout.HeaderContent>
2724
</Layout.Header>
2825
<Layout.Body>
29-
<Layout.Main fullWidth>{children}</Layout.Main>
26+
<Layout.Main fullWidth>
27+
<Outlet />
28+
</Layout.Main>
3029
</Layout.Body>
3130
</SentryDocumentTitle>
3231
);

static/app/views/pipeline/index.spec.tsx renamed to static/app/views/codecov/index.spec.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {render, screen} from 'sentry-test/reactTestingLibrary';
44

5-
import PipelinePage from 'sentry/views/pipeline';
5+
import CodecovPage from 'sentry/views/codecov';
66

77
const COVERAGE_FEATURE = 'codecov-ui';
88

9-
describe('PipelinePage', () => {
9+
describe('CodecovPage', () => {
1010
describe('when the user has access to the feature', () => {
1111
it('renders the passed children', () => {
1212
render(
13-
<PipelinePage>
13+
<CodecovPage>
1414
<p>Test content</p>
15-
</PipelinePage>,
15+
</CodecovPage>,
1616
{organization: OrganizationFixture({features: [COVERAGE_FEATURE]})}
1717
);
1818

@@ -24,9 +24,9 @@ describe('PipelinePage', () => {
2424
describe('when the user does not have access to the feature', () => {
2525
it('renders the NoAccess component', () => {
2626
render(
27-
<PipelinePage>
27+
<CodecovPage>
2828
<p>Test content</p>
29-
</PipelinePage>,
29+
</CodecovPage>,
3030
{organization: OrganizationFixture({features: []})}
3131
);
3232

0 commit comments

Comments
 (0)