|
@@ -1,4 +1,5 @@
|
|
|
import {browserHistory} from 'react-router';
|
|
|
+import {Dashboard as DashboardFixture} from 'sentry-fixture/dashboard';
|
|
|
import LocationFixture from 'sentry-fixture/locationFixture';
|
|
|
import {Organization} from 'sentry-fixture/organization';
|
|
|
import {Project as ProjectFixture} from 'sentry-fixture/project';
|
|
@@ -45,13 +46,13 @@ describe('Dashboards > Detail', function () {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/',
|
|
|
body: [
|
|
|
- TestStubs.Dashboard([], {id: 'default-overview', title: 'Default'}),
|
|
|
- TestStubs.Dashboard([], {id: '1', title: 'Custom Errors'}),
|
|
|
+ DashboardFixture([], {id: 'default-overview', title: 'Default'}),
|
|
|
+ DashboardFixture([], {id: '1', title: 'Custom Errors'}),
|
|
|
],
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/default-overview/',
|
|
|
- body: TestStubs.Dashboard([], {id: 'default-overview', title: 'Default'}),
|
|
|
+ body: DashboardFixture([], {id: 'default-overview', title: 'Default'}),
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/visit/',
|
|
@@ -103,7 +104,7 @@ describe('Dashboards > Detail', function () {
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/default-overview/',
|
|
|
- body: TestStubs.Dashboard(
|
|
|
+ body: DashboardFixture(
|
|
|
[
|
|
|
TestStubs.Widget(
|
|
|
[
|
|
@@ -288,21 +289,25 @@ describe('Dashboards > Detail', function () {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/',
|
|
|
body: [
|
|
|
- TestStubs.Dashboard([], {
|
|
|
- id: 'default-overview',
|
|
|
- title: 'Default',
|
|
|
+ {
|
|
|
+ ...DashboardFixture([], {
|
|
|
+ id: 'default-overview',
|
|
|
+ title: 'Default',
|
|
|
+ }),
|
|
|
widgetDisplay: ['area'],
|
|
|
- }),
|
|
|
- TestStubs.Dashboard([], {
|
|
|
- id: '1',
|
|
|
- title: 'Custom Errors',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ...DashboardFixture([], {
|
|
|
+ id: '1',
|
|
|
+ title: 'Custom Errors',
|
|
|
+ }),
|
|
|
widgetDisplay: ['area'],
|
|
|
- }),
|
|
|
+ },
|
|
|
],
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(widgets, {
|
|
|
+ body: DashboardFixture(widgets, {
|
|
|
id: '1',
|
|
|
title: 'Custom Errors',
|
|
|
filters: {},
|
|
@@ -311,7 +316,7 @@ describe('Dashboards > Detail', function () {
|
|
|
mockPut = MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
method: 'PUT',
|
|
|
- body: TestStubs.Dashboard(widgets, {id: '1', title: 'Custom Errors'}),
|
|
|
+ body: DashboardFixture(widgets, {id: '1', title: 'Custom Errors'}),
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/events-stats/',
|
|
@@ -365,7 +370,7 @@ describe('Dashboards > Detail', function () {
|
|
|
const updateMock = MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
method: 'PUT',
|
|
|
- body: TestStubs.Dashboard([widgets[0]], {id: '1', title: 'Custom Errors'}),
|
|
|
+ body: DashboardFixture([widgets[0]], {id: '1', title: 'Custom Errors'}),
|
|
|
});
|
|
|
render(
|
|
|
<OrganizationContext.Provider value={initialData.organization}>
|
|
@@ -412,7 +417,7 @@ describe('Dashboards > Detail', function () {
|
|
|
it('appends dashboard-level filters to series request', async function () {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(widgets, {
|
|
|
+ body: DashboardFixture(widgets, {
|
|
|
id: '1',
|
|
|
title: 'Custom Errors',
|
|
|
filters: {release: ['abc@1.2.0']},
|
|
@@ -535,7 +540,7 @@ describe('Dashboards > Detail', function () {
|
|
|
// A case where someone has async added widgets to a dashboard
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(
|
|
|
+ body: DashboardFixture(
|
|
|
[
|
|
|
TestStubs.Widget(
|
|
|
[
|
|
@@ -595,7 +600,7 @@ describe('Dashboards > Detail', function () {
|
|
|
it('does not trigger request if layout not updated', async () => {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(
|
|
|
+ body: DashboardFixture(
|
|
|
[
|
|
|
TestStubs.Widget(
|
|
|
[
|
|
@@ -642,7 +647,7 @@ describe('Dashboards > Detail', function () {
|
|
|
it('renders the custom resize handler for a widget', async () => {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(
|
|
|
+ body: DashboardFixture(
|
|
|
[
|
|
|
TestStubs.Widget(
|
|
|
[
|
|
@@ -691,7 +696,7 @@ describe('Dashboards > Detail', function () {
|
|
|
it('does not trigger an alert when the widgets have no layout and user cancels without changes', async () => {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(
|
|
|
+ body: DashboardFixture(
|
|
|
[
|
|
|
TestStubs.Widget(
|
|
|
[
|
|
@@ -756,7 +761,7 @@ describe('Dashboards > Detail', function () {
|
|
|
);
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard([widget], {id: '1', title: 'Custom Errors'}),
|
|
|
+ body: DashboardFixture([widget], {id: '1', title: 'Custom Errors'}),
|
|
|
});
|
|
|
|
|
|
render(
|
|
@@ -787,7 +792,7 @@ describe('Dashboards > Detail', function () {
|
|
|
const openWidgetViewerModal = jest.spyOn(modals, 'openWidgetViewerModal');
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard([], {id: '1', title: 'Custom Errors'}),
|
|
|
+ body: DashboardFixture([], {id: '1', title: 'Custom Errors'}),
|
|
|
});
|
|
|
render(
|
|
|
<ViewEditDashboard
|
|
@@ -937,7 +942,7 @@ describe('Dashboards > Detail', function () {
|
|
|
const openWidgetViewerModal = jest.spyOn(modals, 'openWidgetViewerModal');
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(widgets, {
|
|
|
+ body: DashboardFixture(widgets, {
|
|
|
id: '1',
|
|
|
filters: {release: ['sentry-android-shop@1.2.0']},
|
|
|
}),
|
|
@@ -968,7 +973,7 @@ describe('Dashboards > Detail', function () {
|
|
|
const openWidgetViewerModal = jest.spyOn(modals, 'openWidgetViewerModal');
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(widgets, {
|
|
|
+ body: DashboardFixture(widgets, {
|
|
|
id: '1',
|
|
|
filters: {release: ['sentry-android-shop@1.2.0']},
|
|
|
}),
|
|
@@ -1057,7 +1062,7 @@ describe('Dashboards > Detail', function () {
|
|
|
it('can clear dashboard filters in compact select', async () => {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(widgets, {
|
|
|
+ body: DashboardFixture(widgets, {
|
|
|
id: '1',
|
|
|
title: 'Custom Errors',
|
|
|
filters: {release: ['sentry-android-shop@1.2.0']},
|
|
@@ -1289,7 +1294,7 @@ describe('Dashboards > Detail', function () {
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(widgets, {
|
|
|
+ body: DashboardFixture(widgets, {
|
|
|
id: '1',
|
|
|
title: 'Custom Errors',
|
|
|
filters: {},
|
|
@@ -1384,7 +1389,7 @@ describe('Dashboards > Detail', function () {
|
|
|
it('resets release in URL params', async function () {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/dashboards/1/',
|
|
|
- body: TestStubs.Dashboard(widgets, {
|
|
|
+ body: DashboardFixture(widgets, {
|
|
|
id: '1',
|
|
|
title: 'Custom Errors',
|
|
|
filters: {
|