+ {showOnboardingContainer &&
}
{ownerData?.isCurrentUserPartOfOrg && (
)}
diff --git a/src/pages/OwnerPage/OwnerPage.test.jsx b/src/pages/OwnerPage/OwnerPage.test.jsx
index d9868db345..8be19eebba 100644
--- a/src/pages/OwnerPage/OwnerPage.test.jsx
+++ b/src/pages/OwnerPage/OwnerPage.test.jsx
@@ -4,6 +4,7 @@ import { graphql, HttpResponse } from 'msw'
import { setupServer } from 'msw/node'
import { MemoryRouter, Route } from 'react-router-dom'
+import { OnboardingContainerProvider } from './OnboardingContainerContext/context'
import OwnerPage from './OwnerPage'
const mocks = vi.hoisted(() => ({
@@ -31,14 +32,16 @@ let testLocation
const wrapper = ({ children }) => (
- {children}
- {
- testLocation = location
- return null
- }}
- />
+
+ {children}
+ {
+ testLocation = location
+ return null
+ }}
+ />
+
)
diff --git a/src/shared/AppInstallModal/AppInstallModal.test.tsx b/src/shared/AppInstallModal/AppInstallModal.test.tsx
index 938d23f0e4..6e8d31e2d1 100644
--- a/src/shared/AppInstallModal/AppInstallModal.test.tsx
+++ b/src/shared/AppInstallModal/AppInstallModal.test.tsx
@@ -89,4 +89,95 @@ describe('AppInstallModal', () => {
expect(onComplete).toHaveBeenCalled()
})
})
+
+ describe('when isShareRequestVersion is true (default)', () => {
+ it('renders share request version of modal', () => {
+ render(
+
+ )
+
+ expect(
+ screen.getByText('Share GitHub app installation')
+ ).toBeInTheDocument()
+ expect(
+ screen.getByText(
+ "Copy the link below and share it with your organization's admin or owner to assist."
+ )
+ ).toBeInTheDocument()
+
+ const doneButton = screen.getByText('Done')
+ expect(doneButton).toBeInTheDocument()
+ expect(screen.queryByText('Cancel')).not.toBeInTheDocument()
+ })
+
+ it('calls onComplete when Done button is clicked', async () => {
+ render(
+
+ )
+
+ await userEvent.click(screen.getByText('Done'))
+ expect(onComplete).toHaveBeenCalledTimes(1)
+ })
+ })
+
+ describe('when isShareRequestVersion is false', () => {
+ it('renders install version of modal', () => {
+ render(
+
+ )
+
+ expect(screen.getByText('Install Codecov app')).toBeInTheDocument()
+ expect(
+ screen.getByText(
+ 'You need to install Codecov app on your GitHub organization as an admin.'
+ )
+ ).toBeInTheDocument()
+
+ expect(screen.getByText('Cancel')).toBeInTheDocument()
+ expect(
+ screen.getByText('Install Codecov app via GitHub')
+ ).toBeInTheDocument()
+ })
+
+ it('calls onClose when Cancel button is clicked', async () => {
+ render(
+
+ )
+
+ await userEvent.click(screen.getByText('Cancel'))
+ expect(onClose).toHaveBeenCalledTimes(1)
+ })
+
+ it('calls onComplete when Install button is clicked', async () => {
+ render(
+
+ )
+
+ await userEvent.click(screen.getByText('Install Codecov app via GitHub'))
+ expect(onComplete).toHaveBeenCalledTimes(1)
+ })
+ })
})
diff --git a/src/shared/AppInstallModal/AppInstallModal.tsx b/src/shared/AppInstallModal/AppInstallModal.tsx
index 22820087f6..d1c3eeacce 100644
--- a/src/shared/AppInstallModal/AppInstallModal.tsx
+++ b/src/shared/AppInstallModal/AppInstallModal.tsx
@@ -1,3 +1,4 @@
+import clickHereToInstall from 'assets/onboarding/click_here_to_install.png'
import Button from 'ui/Button'
import { CodeSnippet } from 'ui/CodeSnippet'
import Modal from 'ui/Modal'
@@ -7,12 +8,14 @@ const COPY_APP_INSTALL_STRING =
interface AppInstallModalProps {
isOpen: boolean
+ isShareRequestVersion?: boolean
onClose: () => void
onComplete: () => void
}
function AppInstallModal({
isOpen,
+ isShareRequestVersion = true,
onClose,
onComplete,
}: AppInstallModalProps) {
@@ -20,21 +23,58 @@ function AppInstallModal({
-
- Copy the link below and share it with your organization's admin
- or owner to assist.
-
-
- {COPY_APP_INSTALL_STRING}
-
-
+ isShareRequestVersion ? (
+
+
+ {!isShareRequestVersion && (
+
+ )}
}
diff --git a/src/shared/ListRepo/ListRepo.jsx b/src/shared/ListRepo/ListRepo.jsx
index 3c33e5e4f6..c93c6d130f 100644
--- a/src/shared/ListRepo/ListRepo.jsx
+++ b/src/shared/ListRepo/ListRepo.jsx
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
import { Suspense, useContext } from 'react'
import { useParams } from 'react-router-dom'
+import { ONBOARDING_SOURCE } from 'pages/DefaultOrgSelector'
import { useLocationParams } from 'services/navigation'
import { orderingOptions } from 'services/repos'
import { TierNames, useTier } from 'services/tier'
@@ -54,7 +55,7 @@ function ListRepo({ canRefetch }) {
)
- const cameFromOnboarding = params['source'] === 'onboarding'
+ const cameFromOnboarding = params['source'] === ONBOARDING_SOURCE
const isMyOwnerPage = currentUser?.user?.username === owner
const showDemoAlert = cameFromOnboarding && isMyOwnerPage