|
@@ -43,7 +43,23 @@ class OrganizationDashboardsAcceptanceTest(AcceptanceTestCase):
|
|
|
data={"event_id": "a" * 32, "message": "oh no", "timestamp": min_ago},
|
|
|
project_id=self.project.id,
|
|
|
)
|
|
|
- self.page = DashboardDetailPage(self.browser, self.client, organization=self.organization)
|
|
|
+ self.dashboard = Dashboard.objects.create(
|
|
|
+ title="Dashboard 1", created_by=self.user, organization=self.organization
|
|
|
+ )
|
|
|
+ self.existing_widget = DashboardWidget.objects.create(
|
|
|
+ dashboard=self.dashboard,
|
|
|
+ order=0,
|
|
|
+ title="Existing Widget",
|
|
|
+ display_type=DashboardWidgetDisplayTypes.LINE_CHART,
|
|
|
+ widget_type=DashboardWidgetTypes.DISCOVER,
|
|
|
+ interval="1d",
|
|
|
+ )
|
|
|
+ DashboardWidgetQuery.objects.create(
|
|
|
+ widget=self.existing_widget, fields=["count()"], order=0
|
|
|
+ )
|
|
|
+ self.page = DashboardDetailPage(
|
|
|
+ self.browser, self.client, organization=self.organization, dashboard=self.dashboard
|
|
|
+ )
|
|
|
self.login_as(self.user)
|
|
|
|
|
|
def test_view_dashboard(self):
|
|
@@ -97,6 +113,32 @@ class OrganizationDashboardsAcceptanceTest(AcceptanceTestCase):
|
|
|
|
|
|
self.browser.snapshot("dashboards - widget library")
|
|
|
|
|
|
+ def test_duplicate_widget_in_view_mode(self):
|
|
|
+ with self.feature(FEATURE_NAMES + EDIT_FEATURE):
|
|
|
+ self.page.visit_dashboard_detail()
|
|
|
+
|
|
|
+ self.browser.element('[data-test-id="context-menu"]').click()
|
|
|
+ self.browser.element('[data-test-id="duplicate-widget"]').click()
|
|
|
+ self.page.wait_until_loaded()
|
|
|
+
|
|
|
+ self.browser.elements('[data-test-id="context-menu"]')[0].click()
|
|
|
+ self.browser.element('[data-test-id="duplicate-widget"]').click()
|
|
|
+ self.page.wait_until_loaded()
|
|
|
+
|
|
|
+ self.browser.snapshot("dashboard widget - duplicate")
|
|
|
+
|
|
|
+ def test_delete_widget_in_view_mode(self):
|
|
|
+ with self.feature(FEATURE_NAMES + EDIT_FEATURE):
|
|
|
+ self.page.visit_dashboard_detail()
|
|
|
+
|
|
|
+ self.browser.element('[data-test-id="context-menu"]').click()
|
|
|
+ self.browser.element('[data-test-id="delete-widget"]').click()
|
|
|
+ self.browser.element('[data-test-id="confirm-button"]').click()
|
|
|
+
|
|
|
+ self.page.wait_until_loaded()
|
|
|
+
|
|
|
+ self.browser.snapshot("dashboard widget - delete")
|
|
|
+
|
|
|
|
|
|
class OrganizationDashboardLayoutAcceptanceTest(AcceptanceTestCase):
|
|
|
def setUp(self):
|
|
@@ -418,6 +460,54 @@ class OrganizationDashboardLayoutAcceptanceTest(AcceptanceTestCase):
|
|
|
self.page.wait_until_loaded()
|
|
|
self.browser.snapshot("dashboards - default layout when widgets do not have layout set")
|
|
|
|
|
|
+ def test_duplicate_widget_in_view_mode(self):
|
|
|
+ existing_widget = DashboardWidget.objects.create(
|
|
|
+ dashboard=self.dashboard,
|
|
|
+ order=0,
|
|
|
+ title="Big Number Widget",
|
|
|
+ display_type=DashboardWidgetDisplayTypes.BIG_NUMBER,
|
|
|
+ widget_type=DashboardWidgetTypes.DISCOVER,
|
|
|
+ interval="1d",
|
|
|
+ )
|
|
|
+ DashboardWidgetQuery.objects.create(
|
|
|
+ widget=existing_widget, fields=["count_unique(issue)"], order=0
|
|
|
+ )
|
|
|
+ with self.feature(FEATURE_NAMES + EDIT_FEATURE):
|
|
|
+ self.page.visit_dashboard_detail()
|
|
|
+
|
|
|
+ self.browser.element('[data-test-id="context-menu"]').click()
|
|
|
+ self.browser.element('[data-test-id="duplicate-widget"]').click()
|
|
|
+ self.page.wait_until_loaded()
|
|
|
+
|
|
|
+ self.browser.elements('[data-test-id="context-menu"]')[0].click()
|
|
|
+ self.browser.element('[data-test-id="duplicate-widget"]').click()
|
|
|
+ self.page.wait_until_loaded()
|
|
|
+
|
|
|
+ self.browser.snapshot("dashboard widget - duplicate")
|
|
|
+
|
|
|
+ def test_delete_widget_in_view_mode(self):
|
|
|
+ existing_widget = DashboardWidget.objects.create(
|
|
|
+ dashboard=self.dashboard,
|
|
|
+ order=0,
|
|
|
+ title="Big Number Widget",
|
|
|
+ display_type=DashboardWidgetDisplayTypes.BIG_NUMBER,
|
|
|
+ widget_type=DashboardWidgetTypes.DISCOVER,
|
|
|
+ interval="1d",
|
|
|
+ )
|
|
|
+ DashboardWidgetQuery.objects.create(
|
|
|
+ widget=existing_widget, fields=["count_unique(issue)"], order=0
|
|
|
+ )
|
|
|
+ with self.feature(FEATURE_NAMES + EDIT_FEATURE):
|
|
|
+ self.page.visit_dashboard_detail()
|
|
|
+
|
|
|
+ self.browser.element('[data-test-id="context-menu"]').click()
|
|
|
+ self.browser.element('[data-test-id="delete-widget"]').click()
|
|
|
+ self.browser.element('[data-test-id="confirm-button"]').click()
|
|
|
+
|
|
|
+ self.page.wait_until_loaded()
|
|
|
+
|
|
|
+ self.browser.snapshot("dashboard widget - delete")
|
|
|
+
|
|
|
def test_cancel_without_changes_does_not_trigger_confirm_with_widget_library_through_header(
|
|
|
self,
|
|
|
):
|