@@ -41,7 +41,101 @@ test.describe('Diagnostics Info tab', async () => {
41
41
expect ( utilization . memory . usage ) . toBeTruthy ( ) ;
42
42
} ) ;
43
43
44
- test ( 'Info tab shows healthcheck status' , async ( { page} ) => {
44
+ test ( 'Info tab shows healthcheck status when there are issues' , async ( { page} ) => {
45
+ // Mock healthcheck API to return DEGRADED status with issues
46
+ await page . route ( `**/viewer/json/healthcheck?*` , async ( route ) => {
47
+ await route . fulfill ( {
48
+ status : 200 ,
49
+ contentType : 'application/json' ,
50
+ body : JSON . stringify ( {
51
+ self_check_result : 'DEGRADED' ,
52
+ issue_log : [
53
+ {
54
+ id : 'issue-1' ,
55
+ status : 'YELLOW' ,
56
+ message : 'Some degraded component' ,
57
+ location : {
58
+ database : {
59
+ name : tenantName ,
60
+ } ,
61
+ } ,
62
+ } ,
63
+ ] ,
64
+ } ) ,
65
+ } ) ;
66
+ } ) ;
67
+
68
+ const pageQueryParams = {
69
+ schema : tenantName ,
70
+ database : tenantName ,
71
+ tenantPage : 'diagnostics' ,
72
+ } ;
73
+ const tenantPage = new TenantPage ( page ) ;
74
+ await tenantPage . goto ( pageQueryParams ) ;
75
+
76
+ const diagnostics = new Diagnostics ( page ) ;
77
+ await diagnostics . clickTab ( DiagnosticsTab . Info ) ;
78
+
79
+ // Healthcheck card should be visible when there are issues
80
+ const status = await diagnostics . getHealthcheckStatus ( ) ;
81
+ expect ( status ) . toBeTruthy ( ) ;
82
+
83
+ // Check for degraded status class
84
+ const isDegraded = await diagnostics . hasHealthcheckStatusClass (
85
+ 'ydb-healthcheck-preview__icon_degraded' ,
86
+ ) ;
87
+ expect ( isDegraded ) . toBe ( true ) ;
88
+ } ) ;
89
+
90
+ test ( 'Info tab hides healthcheck status when status is GOOD with no issues' , async ( { page} ) => {
91
+ // Mock healthcheck API to return GOOD status with no issues
92
+ await page . route ( `**/viewer/json/healthcheck?*` , async ( route ) => {
93
+ await route . fulfill ( {
94
+ json : {
95
+ self_check_result : 'GOOD' ,
96
+ issue_log : [ ] ,
97
+ } ,
98
+ } ) ;
99
+ } ) ;
100
+
101
+ const pageQueryParams = {
102
+ schema : tenantName ,
103
+ database : tenantName ,
104
+ tenantPage : 'diagnostics' ,
105
+ } ;
106
+ const tenantPage = new TenantPage ( page ) ;
107
+ await tenantPage . goto ( pageQueryParams ) ;
108
+
109
+ const diagnostics = new Diagnostics ( page ) ;
110
+ await diagnostics . clickTab ( DiagnosticsTab . Info ) ;
111
+
112
+ // Healthcheck card should not be visible when status is GOOD with no issues
113
+ const healthcheckCard = page . locator ( '.ydb-healthcheck-preview' ) ;
114
+ await expect ( healthcheckCard ) . toHaveCount ( 0 ) ;
115
+ } ) ;
116
+
117
+ test ( 'Info tab shows healthcheck status when status is GOOD but has issues' , async ( { page} ) => {
118
+ // Mock healthcheck API to return GOOD status but with issues (edge case)
119
+ await page . route ( `**/viewer/json/healthcheck?*` , async ( route ) => {
120
+ await route . fulfill ( {
121
+ json : {
122
+ self_check_result : 'GOOD' ,
123
+ issue_log : [
124
+ {
125
+ id : 'issue-1' ,
126
+ status : 'GREEN' ,
127
+ message : 'Some informational issue' ,
128
+ location : {
129
+ database : {
130
+ name : tenantName ,
131
+ } ,
132
+ } ,
133
+ } ,
134
+ ] ,
135
+ } ,
136
+ } ) ;
137
+ } ) ;
138
+
45
139
const pageQueryParams = {
46
140
schema : tenantName ,
47
141
database : tenantName ,
@@ -53,9 +147,11 @@ test.describe('Diagnostics Info tab', async () => {
53
147
const diagnostics = new Diagnostics ( page ) ;
54
148
await diagnostics . clickTab ( DiagnosticsTab . Info ) ;
55
149
150
+ // Healthcheck card should be visible when there are issues, even if status is GOOD
56
151
const status = await diagnostics . getHealthcheckStatus ( ) ;
57
152
expect ( status ) . toBeTruthy ( ) ;
58
153
154
+ // Check for good status class
59
155
const isGood = await diagnostics . hasHealthcheckStatusClass (
60
156
'ydb-healthcheck-preview__icon_good' ,
61
157
) ;
0 commit comments