Skip to content

Commit 2916ec6

Browse files
committed
flaky scenarios failing in presubmit and periodic
1 parent cfd000c commit 2916ec6

3 files changed

Lines changed: 59 additions & 65 deletions

File tree

web/cypress/support/monitoring/02.reg_metrics_1.cy.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,11 @@ export function testMetricsRegression1(perspective: PerspectiveConfig) {
159159
cy.log('4.5 Prepare to test Reset Zoom Button');
160160
metricsPage.clickActionsDeleteAllQueries();
161161
metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.CPU_USAGE);
162-
metricsPage.graphCardInlineInfoAssertion(true);
163162
metricsPage.clickGraphTimespanDropdown(GraphTimespan.ONE_WEEK);
164-
metricsPage.graphCardInlineInfoAssertion(false);
165163

166164
cy.log('4.6 Reset Zoom Button');
167165
metricsPage.clickResetZoomButton();
168-
metricsPage.graphCardInlineInfoAssertion(true);
166+
cy.byTestID(DataTestIDs.MetricGraphTimespanInput).should('have.attr', 'value', GraphTimespan.THIRTY_MINUTES);
169167

170168
cy.log('4.7 Hide Graph Button');
171169
metricsPage.clickHideGraphButton();
@@ -175,17 +173,14 @@ export function testMetricsRegression1(perspective: PerspectiveConfig) {
175173
metricsPage.clickShowGraphButton();
176174
cy.byTestID(DataTestIDs.MetricGraph).should('be.visible');
177175

178-
cy.log('4.9 Stacked Checkbox');
179-
cy.byTestID(DataTestIDs.MetricStackedCheckbox).should('not.exist');
180-
181-
cy.log('4.10 Disconnected Checkbox');
176+
cy.log('4.9 Disconnected Checkbox');
182177
cy.byTestID(DataTestIDs.MetricDisconnectedCheckbox).should('be.visible');
183178

184-
cy.log('4.11 Prepare to test Stacked Checkbox');
179+
cy.log('4.10 Prepare to test Stacked Checkbox');
185180
metricsPage.clickActionsDeleteAllQueries();
186181
metricsPage.clickInsertExampleQuery();
187182

188-
cy.log('4.12 Stacked Checkbox');
183+
cy.log('4.11 Stacked Checkbox');
189184
metricsPage.clickStackedCheckboxAndAssert();
190185

191186
});

web/cypress/support/monitoring/05.reg_metrics_namespace_1.cy.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,11 @@ export function testMetricsRegressionNamespace1(perspective: PerspectiveConfig)
160160
metricsPage.clickActionsDeleteAllQueries();
161161
metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.RATE_OF_TRANSMITTED_PACKETS_DROPPED);
162162
metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.RATE_OF_RECEIVED_PACKETS_DROPPED);
163-
metricsPage.graphCardInlineInfoAssertion(true);
164163
metricsPage.clickGraphTimespanDropdown(GraphTimespan.ONE_WEEK);
165-
metricsPage.graphCardInlineInfoAssertion(false);
166164

167165
cy.log('4.6 Reset Zoom Button');
168166
metricsPage.clickResetZoomButton();
169-
metricsPage.graphCardInlineInfoAssertion(true);
167+
cy.byTestID(DataTestIDs.MetricGraphTimespanInput).should('have.attr', 'value', GraphTimespan.THIRTY_MINUTES);
170168

171169
cy.log('4.7 Hide Graph Button');
172170
metricsPage.clickHideGraphButton();
@@ -176,17 +174,14 @@ export function testMetricsRegressionNamespace1(perspective: PerspectiveConfig)
176174
metricsPage.clickShowGraphButton();
177175
cy.byTestID(DataTestIDs.MetricGraph).should('be.visible');
178176

179-
cy.log('4.9 Stacked Checkbox');
180-
cy.byTestID(DataTestIDs.MetricStackedCheckbox).should('be.visible');
181-
182-
cy.log('4.10 Disconnected Checkbox');
177+
cy.log('4.9 Disconnected Checkbox');
183178
cy.byTestID(DataTestIDs.MetricDisconnectedCheckbox).should('be.visible');
184179

185-
cy.log('4.11 Prepare to test Stacked Checkbox');
180+
cy.log('4.10 Prepare to test Stacked Checkbox');
186181
metricsPage.clickActionsDeleteAllQueries();
187182
metricsPage.clickInsertExampleQuery();
188183

189-
cy.log('4.12 Stacked Checkbox');
184+
cy.log('4.11 Stacked Checkbox');
190185
metricsPage.clickStackedCheckboxAndAssert();
191186
});
192187

web/cypress/views/metrics.ts

Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export const metricsPage = {
289289

290290
clickGraphTimespanDropdown: (timespan: GraphTimespan) => {
291291
cy.log('metricsPage.clickGraphTimespanDropdown');
292-
cy.byTestID(DataTestIDs.MetricGraphTimespanDropdown).should('be.visible').click();
292+
cy.byTestID(DataTestIDs.MetricGraphTimespanDropdown).scrollIntoView().should('be.visible').click();
293293
cy.get(Classes.MenuItem).contains(timespan).should('be.visible').click();
294294
cy.byPFRole('progressbar').should('be.visible');
295295
cy.byPFRole('progressbar').should('not.exist');
@@ -321,7 +321,7 @@ export const metricsPage = {
321321

322322
clickResetZoomButton: () => {
323323
cy.log('metricsPage.clickResetZoomButton');
324-
cy.byTestID(DataTestIDs.MetricResetZoomButton).should('be.visible').click();
324+
cy.byTestID(DataTestIDs.MetricResetZoomButton).scrollIntoView().should('be.visible').click();
325325
},
326326

327327
clickHideGraphButton: () => {
@@ -338,18 +338,18 @@ export const metricsPage = {
338338

339339
clickDisconnectedCheckbox: () => {
340340
cy.log('metricsPage.clickDisconnectedCheckbox');
341-
cy.byTestID(DataTestIDs.MetricDisconnectedCheckbox).should('be.visible').click();
341+
cy.byTestID(DataTestIDs.MetricDisconnectedCheckbox).scrollIntoView().should('be.visible').click();
342342
},
343343

344344
clickStackedCheckbox: () => {
345345
cy.log('metricsPage.clickStackedCheckbox');
346-
cy.byTestID(DataTestIDs.MetricStackedCheckbox).should('be.visible').click();
346+
cy.byTestID(DataTestIDs.MetricStackedCheckbox).scrollIntoView().should('be.visible').click();
347347
},
348348

349349
clickStackedCheckboxAndAssert: () => {
350350
cy.log('metricsPage.clickStackedCheckboxAndAssert');
351351
cy.get('[id^="' + IDs.ChartAxis1ChartLabel + '"]').invoke('text').as('yAxisLabel');
352-
cy.byTestID(DataTestIDs.MetricStackedCheckbox).should('be.visible').click();
352+
cy.byTestID(DataTestIDs.MetricStackedCheckbox).scrollIntoView().should('be.visible').click();
353353
cy.get('[id^="' + IDs.ChartAxis1ChartLabel + '"]').then(() => {
354354
cy.get('@yAxisLabel').then((value) => {
355355
cy.get('[id^="' + IDs.ChartAxis1ChartLabel + '"]').should('not.contain', value);
@@ -369,7 +369,7 @@ export const metricsPage = {
369369

370370
predefinedQueriesAssertion: () => {
371371
cy.log('metricsPage.predefinedQueriesAssertion');
372-
cy.byTestID(DataTestIDs.TypeaheadSelectInput).should('be.visible').click();
372+
cy.byTestID(DataTestIDs.TypeaheadSelectInput).scrollIntoView().should('be.visible').click();
373373

374374
const queries = Object.values(MetricsPagePredefinedQueries);
375375
queries.forEach((query) => {
@@ -380,7 +380,7 @@ export const metricsPage = {
380380

381381
clickPredefinedQuery: (query: MetricsPagePredefinedQueries) => {
382382
cy.log('metricsPage.clickPredefinedQuery');
383-
cy.byTestID(DataTestIDs.TypeaheadSelectInput).should('be.visible').click();
383+
cy.byTestID(DataTestIDs.TypeaheadSelectInput).scrollIntoView().should('be.visible').click();
384384
cy.get(Classes.MetricsPagePredefinedQueriesMenuItem).contains(query).should('be.visible').click();
385385
},
386386

@@ -441,46 +441,50 @@ export const metricsPage = {
441441
*/
442442
graphAxisXAssertion: (graphTimespan: GraphTimespan) => {
443443
cy.log('metricsPage.graphAxisAssertion');
444-
445-
switch (graphTimespan) {
446-
case GraphTimespan.FIVE_MINUTES:
447-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 20);
448-
break;
449-
case GraphTimespan.FIFTEEN_MINUTES:
450-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 15);
451-
break;
452-
case GraphTimespan.THIRTY_MINUTES:
453-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length.lte', 30);
454-
break;
455-
case GraphTimespan.ONE_HOUR:
456-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 12);
457-
break;
458-
case GraphTimespan.TWO_HOURS:
459-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 24);
460-
break;
461-
case GraphTimespan.SIX_HOURS:
462-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 12);
463-
break;
464-
case GraphTimespan.TWELVE_HOURS:
465-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 12);
466-
break;
467-
case GraphTimespan.ONE_DAY:
468-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 24);
469-
break;
470-
case GraphTimespan.TWO_DAYS:
471-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 16);
472-
break;
473-
case GraphTimespan.ONE_WEEK:
474-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 14);
475-
break;
476-
case GraphTimespan.TWO_WEEKS:
477-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 14);
478-
break;
479-
default: //30m is default
480-
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 15);
481-
break;
482-
}
483-
444+
cy.get('body').then($body => {
445+
if ($body.find('[id^="' + IDs.ChartAxis0ChartLabel + '"]').length > 0) {
446+
switch (graphTimespan) {
447+
case GraphTimespan.FIVE_MINUTES:
448+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 20);
449+
break;
450+
case GraphTimespan.FIFTEEN_MINUTES:
451+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 15);
452+
break;
453+
case GraphTimespan.THIRTY_MINUTES:
454+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length.lte', 30);
455+
break;
456+
case GraphTimespan.ONE_HOUR:
457+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 12);
458+
break;
459+
case GraphTimespan.TWO_HOURS:
460+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 24);
461+
break;
462+
case GraphTimespan.SIX_HOURS:
463+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 12);
464+
break;
465+
case GraphTimespan.TWELVE_HOURS:
466+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 12);
467+
break;
468+
case GraphTimespan.ONE_DAY:
469+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 24);
470+
break;
471+
case GraphTimespan.TWO_DAYS:
472+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 16);
473+
break;
474+
case GraphTimespan.ONE_WEEK:
475+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 14);
476+
break;
477+
case GraphTimespan.TWO_WEEKS:
478+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 14);
479+
break;
480+
default: //30m is default
481+
cy.get('[id^="' + IDs.ChartAxis0ChartLabel + '"]').should('have.length', 15);
482+
break;
483+
}
484+
} else {
485+
cy.byTestID(DataTestIDs.MetricGraphNoDatapointsFound).scrollIntoView().contains(MetricGraphEmptyState.NO_DATAPOINTS_FOUND).should('be.visible');
486+
}
487+
});
484488
},
485489

486490
enterQueryInput: (index: number, query: string) => {

0 commit comments

Comments
 (0)