|
@@ -1,4 +1,4 @@
|
|
|
-import type {Location, Query} from 'history';
|
|
|
+import type {Query} from 'history';
|
|
|
import {OrganizationFixture} from 'sentry-fixture/organization';
|
|
|
import {ProjectFixture} from 'sentry-fixture/project';
|
|
|
|
|
@@ -12,9 +12,8 @@ import {
|
|
|
} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
import ProjectsStore from 'sentry/stores/projectsStore';
|
|
|
-import type {Organization as TOrganization, Project} from 'sentry/types';
|
|
|
+import type {Project} from 'sentry/types';
|
|
|
import {browserHistory} from 'sentry/utils/browserHistory';
|
|
|
-import {OrganizationContext} from 'sentry/views/organizationContext';
|
|
|
import TransactionVitals from 'sentry/views/performance/transactionSummary/transactionVitals';
|
|
|
import {
|
|
|
VITAL_GROUPS,
|
|
@@ -59,20 +58,6 @@ function initialize({
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
-function WrappedComponent({
|
|
|
- location,
|
|
|
- organization,
|
|
|
-}: {
|
|
|
- location: Location;
|
|
|
- organization: TOrganization;
|
|
|
-}) {
|
|
|
- return (
|
|
|
- <OrganizationContext.Provider value={organization}>
|
|
|
- <TransactionVitals location={location} organization={organization} />
|
|
|
- </OrganizationContext.Provider>
|
|
|
- );
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* These values are what we expect to see on the page based on the
|
|
|
* mocked api responses below.
|
|
@@ -193,8 +178,9 @@ describe('Performance > Web Vitals', function () {
|
|
|
features: [],
|
|
|
});
|
|
|
|
|
|
- render(<WrappedComponent organization={organization} location={router.location} />, {
|
|
|
+ render(<TransactionVitals organization={organization} location={router.location} />, {
|
|
|
context: routerContext,
|
|
|
+ organization,
|
|
|
});
|
|
|
expect(screen.getByText("You don't have access to this feature")).toBeInTheDocument();
|
|
|
});
|
|
@@ -204,8 +190,9 @@ describe('Performance > Web Vitals', function () {
|
|
|
transaction: '/organizations/:orgId/',
|
|
|
});
|
|
|
|
|
|
- render(<WrappedComponent organization={organization} location={router.location} />, {
|
|
|
+ render(<TransactionVitals organization={organization} location={router.location} />, {
|
|
|
context: routerContext,
|
|
|
+ organization,
|
|
|
});
|
|
|
|
|
|
expect(
|
|
@@ -220,8 +207,9 @@ describe('Performance > Web Vitals', function () {
|
|
|
it('renders the correct bread crumbs', function () {
|
|
|
const {organization, router, routerContext} = initialize();
|
|
|
|
|
|
- render(<WrappedComponent organization={organization} location={router.location} />, {
|
|
|
+ render(<TransactionVitals organization={organization} location={router.location} />, {
|
|
|
context: routerContext,
|
|
|
+ organization,
|
|
|
});
|
|
|
|
|
|
expect(screen.getByRole('navigation')).toHaveTextContent('PerformanceWeb Vitals');
|
|
@@ -232,8 +220,8 @@ describe('Performance > Web Vitals', function () {
|
|
|
|
|
|
beforeEach(() => {
|
|
|
render(
|
|
|
- <WrappedComponent organization={organization} location={router.location} />,
|
|
|
- {context: routerContext}
|
|
|
+ <TransactionVitals organization={organization} location={router.location} />,
|
|
|
+ {context: routerContext, organization}
|
|
|
);
|
|
|
});
|
|
|
|
|
@@ -248,8 +236,8 @@ describe('Performance > Web Vitals', function () {
|
|
|
const {organization, router, routerContext} = initialize();
|
|
|
|
|
|
render(
|
|
|
- <WrappedComponent organization={organization} location={router.location} />,
|
|
|
- {context: routerContext}
|
|
|
+ <TransactionVitals organization={organization} location={router.location} />,
|
|
|
+ {context: routerContext, organization}
|
|
|
);
|
|
|
|
|
|
expect(screen.getByRole('button', {name: 'Reset View'})).toBeDisabled();
|
|
@@ -263,8 +251,8 @@ describe('Performance > Web Vitals', function () {
|
|
|
});
|
|
|
|
|
|
render(
|
|
|
- <WrappedComponent organization={organization} location={router.location} />,
|
|
|
- {context: routerContext}
|
|
|
+ <TransactionVitals organization={organization} location={router.location} />,
|
|
|
+ {context: routerContext, organization}
|
|
|
);
|
|
|
|
|
|
expect(screen.getByRole('button', {name: 'Reset View'})).toBeEnabled();
|
|
@@ -278,8 +266,8 @@ describe('Performance > Web Vitals', function () {
|
|
|
});
|
|
|
|
|
|
render(
|
|
|
- <WrappedComponent organization={organization} location={router.location} />,
|
|
|
- {context: routerContext}
|
|
|
+ <TransactionVitals organization={organization} location={router.location} />,
|
|
|
+ {context: routerContext, organization}
|
|
|
);
|
|
|
|
|
|
expect(screen.getByRole('button', {name: 'Reset View'})).toBeEnabled();
|
|
@@ -294,8 +282,8 @@ describe('Performance > Web Vitals', function () {
|
|
|
});
|
|
|
|
|
|
render(
|
|
|
- <WrappedComponent organization={organization} location={router.location} />,
|
|
|
- {context: routerContext}
|
|
|
+ <TransactionVitals organization={organization} location={router.location} />,
|
|
|
+ {context: routerContext, organization}
|
|
|
);
|
|
|
|
|
|
expect(screen.getByRole('button', {name: 'Reset View'})).toBeEnabled();
|
|
@@ -310,8 +298,8 @@ describe('Performance > Web Vitals', function () {
|
|
|
});
|
|
|
|
|
|
render(
|
|
|
- <WrappedComponent organization={organization} location={router.location} />,
|
|
|
- {context: routerContext}
|
|
|
+ <TransactionVitals organization={organization} location={router.location} />,
|
|
|
+ {context: routerContext, organization}
|
|
|
);
|
|
|
|
|
|
await userEvent.click(screen.getByRole('button', {name: 'Reset View'}));
|
|
@@ -342,8 +330,8 @@ describe('Performance > Web Vitals', function () {
|
|
|
});
|
|
|
|
|
|
render(
|
|
|
- <WrappedComponent organization={organization} location={router.location} />,
|
|
|
- {context: routerContext}
|
|
|
+ <TransactionVitals organization={organization} location={router.location} />,
|
|
|
+ {context: routerContext, organization}
|
|
|
);
|
|
|
|
|
|
await waitForElementToBeRemoved(() =>
|
|
@@ -365,8 +353,8 @@ describe('Performance > Web Vitals', function () {
|
|
|
});
|
|
|
|
|
|
render(
|
|
|
- <WrappedComponent organization={organization} location={router.location} />,
|
|
|
- {context: routerContext}
|
|
|
+ <TransactionVitals organization={organization} location={router.location} />,
|
|
|
+ {context: routerContext, organization}
|
|
|
);
|
|
|
|
|
|
await waitForElementToBeRemoved(() =>
|
|
@@ -399,8 +387,9 @@ describe('Performance > Web Vitals', function () {
|
|
|
},
|
|
|
});
|
|
|
|
|
|
- render(<WrappedComponent organization={organization} location={router.location} />, {
|
|
|
+ render(<TransactionVitals organization={organization} location={router.location} />, {
|
|
|
context: routerContext,
|
|
|
+ organization,
|
|
|
});
|
|
|
|
|
|
await waitForElementToBeRemoved(() => screen.queryAllByTestId('loading-placeholder'));
|