@@ -1769,6 +1769,33 @@ def test_update_dashboard_with_widget_filter_requiring_environment(self):
1769
1769
)
1770
1770
assert response .status_code == 200 , response .data
1771
1771
1772
+
1773
+ class OrganizationDashboardDetailsOnDemandTest (OrganizationDashboardDetailsTestCase ):
1774
+ widget_type = DashboardWidgetTypes .DISCOVER
1775
+
1776
+ def setUp (self ):
1777
+ super ().setUp ()
1778
+ self .project = self .create_project ()
1779
+ self .create_user_member_role ()
1780
+ self .widget_3 = DashboardWidget .objects .create (
1781
+ dashboard = self .dashboard ,
1782
+ order = 2 ,
1783
+ title = "Widget 3" ,
1784
+ display_type = DashboardWidgetDisplayTypes .LINE_CHART ,
1785
+ widget_type = self .widget_type ,
1786
+ )
1787
+ self .widget_4 = DashboardWidget .objects .create (
1788
+ dashboard = self .dashboard ,
1789
+ order = 3 ,
1790
+ title = "Widget 4" ,
1791
+ display_type = DashboardWidgetDisplayTypes .LINE_CHART ,
1792
+ widget_type = self .widget_type ,
1793
+ )
1794
+ self .widget_ids = [self .widget_1 .id , self .widget_2 .id , self .widget_3 .id , self .widget_4 .id ]
1795
+
1796
+ def get_widget_queries (self , widget ):
1797
+ return DashboardWidgetQuery .objects .filter (widget = widget ).order_by ("order" )
1798
+
1772
1799
def test_ondemand_without_flags (self ):
1773
1800
data : dict [str , Any ] = {
1774
1801
"title" : "First dashboard" ,
@@ -1777,6 +1804,7 @@ def test_ondemand_without_flags(self):
1777
1804
"title" : "Errors per project" ,
1778
1805
"displayType" : "table" ,
1779
1806
"interval" : "5m" ,
1807
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
1780
1808
"queries" : [
1781
1809
{
1782
1810
"name" : "Errors" ,
@@ -1813,6 +1841,7 @@ def test_ondemand_with_unapplicable_query(self):
1813
1841
"title" : "Errors per project" ,
1814
1842
"displayType" : "table" ,
1815
1843
"interval" : "5m" ,
1844
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
1816
1845
"queries" : [
1817
1846
{
1818
1847
"name" : "Errors" ,
@@ -1850,6 +1879,7 @@ def test_ondemand_with_flags(self):
1850
1879
"title" : "Errors per project" ,
1851
1880
"displayType" : "table" ,
1852
1881
"interval" : "5m" ,
1882
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
1853
1883
"queries" : [
1854
1884
{
1855
1885
"name" : "Errors" ,
@@ -1888,6 +1918,7 @@ def test_ondemand_hits_spec_limit(self, mock_max):
1888
1918
"title" : "Errors per project" ,
1889
1919
"displayType" : "table" ,
1890
1920
"interval" : "5m" ,
1921
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
1891
1922
"queries" : [
1892
1923
{
1893
1924
"name" : "Errors" ,
@@ -1932,6 +1963,7 @@ def test_ondemand_hits_card_limit(self, mock_query):
1932
1963
"title" : "errors per project" ,
1933
1964
"displayType" : "table" ,
1934
1965
"interval" : "5m" ,
1966
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
1935
1967
"queries" : [
1936
1968
{
1937
1969
"name" : "errors" ,
@@ -1973,6 +2005,7 @@ def test_ondemand_updates_existing_widget(self, mock_query):
1973
2005
"title" : "errors per project" ,
1974
2006
"displayType" : "table" ,
1975
2007
"interval" : "5m" ,
2008
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
1976
2009
"queries" : [
1977
2010
{
1978
2011
"name" : "errors" ,
@@ -2009,6 +2042,7 @@ def test_ondemand_updates_existing_widget(self, mock_query):
2009
2042
"title" : "errors per project" ,
2010
2043
"displayType" : "table" ,
2011
2044
"interval" : "5m" ,
2045
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
2012
2046
"queries" : [
2013
2047
{
2014
2048
"id" : str (queries [0 ].id ),
@@ -2055,6 +2089,7 @@ def test_ondemand_updates_new_widget(self, mock_query):
2055
2089
"title" : "errors per project" ,
2056
2090
"displayType" : "table" ,
2057
2091
"interval" : "5m" ,
2092
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
2058
2093
"queries" : [
2059
2094
{
2060
2095
"name" : "errors" ,
@@ -2091,6 +2126,7 @@ def test_ondemand_updates_new_widget(self, mock_query):
2091
2126
"title" : "errors per project" ,
2092
2127
"displayType" : "table" ,
2093
2128
"interval" : "5m" ,
2129
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
2094
2130
"queries" : [
2095
2131
{
2096
2132
# without id here we'll make a new query and delete the old one
@@ -2137,6 +2173,7 @@ def test_cardinality_precedence_over_feature_checks(self, mock_query):
2137
2173
"title" : "errors per project" ,
2138
2174
"displayType" : "table" ,
2139
2175
"interval" : "5m" ,
2176
+ "widgetType" : DashboardWidgetTypes .get_type_name (self .widget_type ),
2140
2177
"queries" : [
2141
2178
{
2142
2179
"name" : "errors" ,
@@ -2267,6 +2304,13 @@ def test_add_widget_with_split_widget_type_writes_to_split_decision(self):
2267
2304
assert widgets [2 ].discover_widget_split is None
2268
2305
2269
2306
2307
+ class OrganizationDashboardDetailsOnDemandTransactionLikeTest (
2308
+ OrganizationDashboardDetailsOnDemandTest
2309
+ ):
2310
+ # Re-run the on-demand tests with the transaction-like widget type
2311
+ widget_type = DashboardWidgetTypes .TRANSACTION_LIKE
2312
+
2313
+
2270
2314
class OrganizationDashboardVisitTest (OrganizationDashboardDetailsTestCase ):
2271
2315
def url (self , dashboard_id ):
2272
2316
return reverse (
0 commit comments