diff --git a/tests/metrics/verifyMongoDBCollectionFlags_test.js b/tests/metrics/verifyMongoDBCollectionFlags_test.js index 5f4a59dc0..f577fa3b9 100644 --- a/tests/metrics/verifyMongoDBCollectionFlags_test.js +++ b/tests/metrics/verifyMongoDBCollectionFlags_test.js @@ -7,7 +7,7 @@ const { Feature('MongoDB Collectors Parameters and Flags tests'); const collectionNames = ['col1', 'col2', 'col3', 'col4', 'col5']; -const dbNames = ['db1', 'db2', 'db3', 'db4']; +const dbNames = ['db1', 'db2', 'db3', 'db4', 'db5', 'db6', 'db7', 'db8', 'db9']; const mongodb_service_name = 'mongodb_test_collections_flag'; const containerName = 'rs101'; @@ -85,12 +85,12 @@ Scenario( // assert dbstats and topmetrics collectors are disabled // eslint-disable-next-line no-prototype-builtins assert.ok(!mongoDbOptions.enable_all_collectors, `Was expecting enable_all_collectors to be disabled for Mongo Exporter for service "${mongodb_service_name}"`); - I.say('Wait 150 seconds for Metrics being collected for the new service'); - await I.wait(150); - await grafanaAPI.checkMetricAbsent(metrics.dbstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.collstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.topmetrics, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.indexstats, { type: 'service_name', value: mongodb_service_name }); + I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricAbsent(metrics.dbstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.collstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.topmetrics, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.indexstats, { type: 'service_id', value: service_id }); }, ); @@ -115,12 +115,12 @@ Scenario( assert.ok(disabledCollectors[0] === collectorsToDisable, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "disabled_collectors: [ 'topmetrics' ]" property`); assert.ok(disabledCollectors.length === 1, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "disabled_collectors: [ 'topmetrics' ]" property`); assert.ok(mongoDbOptions.enable_all_collectors, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "enable_all_collectors" property with "true"`); - I.say('Wait 150 seconds for Metrics being collected for the new service'); - await I.wait(150); - await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.topmetrics, { type: 'service_name', value: mongodb_service_name }); + I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.topmetrics, { type: 'service_id', value: service_id }); }, ); @@ -135,12 +135,12 @@ Scenario( // assert dbstats and topmetrics collectors are enabled assert.ok(mongoDbOptions.enable_all_collectors, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "enable_all_collectors" property`); - await I.say('Wait 150 seconds for Metrics being collected for the new service'); - await I.wait(150); - await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.topmetrics, { type: 'service_name', value: mongodb_service_name }); + await I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.topmetrics, { type: 'service_id', value: service_id }); }, ); @@ -157,12 +157,12 @@ Scenario( // assert dbstats and topmetrics collectors are enabled // eslint-disable-next-line no-prototype-builtins assert.ok(mongoDbOptions.enable_all_collectors, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "enable_all_collectors" property`); - I.say('Wait 150 seconds for Metrics being collected for the new service'); - await I.wait(150); - await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.topmetrics, { type: 'service_name', value: mongodb_service_name }); + I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.topmetrics, { type: 'service_id', value: service_id }); }, ); @@ -191,10 +191,10 @@ Scenario( assert.ok(mongoDbOptions.enable_all_collectors, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "enable_all_collectors" property with "true"`); I.say('Wait 150 seconds for Metrics being collected for the new service'); await I.wait(150); - await grafanaAPI.checkMetricAbsent(metrics.dbstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.collstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.topmetrics, { type: 'service_name', value: mongodb_service_name }); + await grafanaAPI.checkMetricAbsent(metrics.dbstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.collstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.topmetrics, { type: 'service_id', value: service_id }); }, ); @@ -211,16 +211,16 @@ Scenario( // assert dbstats and topmetrics collectors are enabled // eslint-disable-next-line no-prototype-builtins assert.ok(mongoDbOptions.enable_all_collectors, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "enable_all_collectors" property`); - I.say('Wait 150 seconds for Metrics being collected for the new service'); - await I.wait(150); - await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.topmetrics, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db1' }]); - await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db3' }, { type: 'collection', value: 'col3' }]); - await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col1' }]); - await grafanaAPI.checkMetricExist(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col2' }]); + I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.topmetrics, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db1' }]); + await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db3' }, { type: 'collection', value: 'col3' }]); + await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col1' }]); + await grafanaAPI.checkMetricExist(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col2' }]); }, ); @@ -237,16 +237,16 @@ Scenario( // assert dbstats and topmetrics collectors are enabled // eslint-disable-next-line no-prototype-builtins assert.ok(mongoDbOptions.enable_all_collectors, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "enable_all_collectors" property`); - I.say('Wait 150 seconds for Metrics being collected for the new service'); - await I.wait(150); - await grafanaAPI.checkMetricAbsent(metrics.dbstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.collstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.indexstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.topmetrics, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db1' }]); - await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db3' }, { type: 'collection', value: 'col3' }]); - await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col1' }]); - await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col2' }]); + I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricAbsent(metrics.dbstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.collstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.indexstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.topmetrics, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db1' }]); + await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db3' }, { type: 'collection', value: 'col3' }]); + await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col1' }]); + await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col2' }]); }, ); @@ -263,16 +263,16 @@ Scenario( // assert dbstats and topmetrics collectors are enabled // eslint-disable-next-line no-prototype-builtins assert.ok(mongoDbOptions.enable_all_collectors, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "enable_all_collectors" property`); - I.say('Wait 150 seconds for Metrics being collected for the new service'); - await I.wait(150); - await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.topmetrics, { type: 'service_name', value: mongodb_service_name }); - await grafanaAPI.checkMetricExist(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db1' }]); - await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db3' }, { type: 'collection', value: 'col3' }]); - await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col1' }]); - await grafanaAPI.checkMetricExist(metrics.collstats, [{ type: 'service_name', value: mongodb_service_name }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col2' }]); + I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricExist(metrics.dbstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.collstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.indexstats, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.topmetrics, { type: 'service_id', value: service_id }); + await grafanaAPI.checkMetricExist(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db1' }]); + await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db3' }, { type: 'collection', value: 'col3' }]); + await grafanaAPI.checkMetricAbsent(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col1' }]); + await grafanaAPI.checkMetricExist(metrics.collstats, [{ type: 'service_id', value: service_id }, { type: 'database', value: 'db2' }, { type: 'collection', value: 'col2' }]); }, ); @@ -290,22 +290,23 @@ Scenario( // assert dbstats and topmetrics collectors are enabled // eslint-disable-next-line no-prototype-builtins assert.ok(mongoDbOptions.enable_all_collectors, `Was expecting Mongo Exporter for service ${mongodb_service_name} to have "enable_all_collectors" property`); - I.say('Wait 120 seconds for Metrics being collected for the new service'); - await I.wait(120); - await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: mongodb_service_name }, { type: 'collector', value: 'collstats' }]); - await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: mongodb_service_name }, { type: 'collector', value: 'dbstats' }]); - await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: mongodb_service_name }, { type: 'collector', value: 'diagnostic_data' }]); - await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: mongodb_service_name }, { type: 'collector', value: 'general' }]); - await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: mongodb_service_name }, { type: 'collector', value: 'indexstats' }]); - await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: mongodb_service_name }, { type: 'collector', value: 'replset_status' }]); - await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: mongodb_service_name }, { type: 'collector', value: 'top' }]); + I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: service_id }, { type: 'collector', value: 'collstats' }]); + await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: service_id }, { type: 'collector', value: 'dbstats' }]); + await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: service_id }, { type: 'collector', value: 'diagnostic_data' }]); + await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: service_id }, { type: 'collector', value: 'general' }]); + await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: service_id }, { type: 'collector', value: 'indexstats' }]); + await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: service_id }, { type: 'collector', value: 'replset_status' }]); + await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: service_id }, { type: 'collector', value: 'top' }]); await I.say(await I.verifyCommand(`docker exec ${containerName} pmm-admin remove mongodb ${mongodb_service_name}`)); // Re-add Service with Disable Top metrics, check no smart metrics for Top await I.say(await I.verifyCommand(`docker exec ${containerName} pmm-admin add mongodb --agent-password='testing' --password=${pmm_user_mongodb.password} --username=${pmm_user_mongodb.username} --enable-all-collectors --disable-collectors=topmetrics --max-collections-limit=400 --stats-collections=db1,db2.col2 --service-name=${mongodb_service_name} --replication-set=rs0s`)); - await I.wait(120); - await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: `${mongodb_service_name}` }, { type: 'collector', value: 'dbstats' }]); - await grafanaAPI.checkMetricAbsent(smartMetricName, [{ type: 'service_name', value: `${mongodb_service_name}` }, { type: 'collector', value: 'top' }]); + I.say('Wait 180 seconds for Metrics being collected for the new service'); + await I.wait(180); + await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: `${service_id}` }, { type: 'collector', value: 'dbstats' }]); + await grafanaAPI.checkMetricAbsent(smartMetricName, [{ type: 'service_id', value: `${service_id}` }, { type: 'collector', value: 'top' }]); }, ); @@ -360,6 +361,7 @@ Scenario( }) => { I.amOnPage(dashboardPage.mongoDbInstanceOverview.url); dashboardPage.waitForDashboardOpened(); + const service_name = 'testing_force_flag'; // adding service which will be used to verify various inventory addition commands @@ -370,9 +372,9 @@ Scenario( await I.say(await I.verifyCommand(`docker exec ${containerName} pmm-admin add mongodb --agent-password='testing' --password=${pmm_user_mongodb.password} --username=${pmm_user_mongodb.username} --enable-all-collectors --service-name=${service_name}`)); const { service_id } = await inventoryAPI.apiGetNodeInfoByServiceName(SERVICE_TYPE.MONGODB, service_name); - await grafanaAPI.waitForMetric('mongodb_up', [{ type: 'service_name', value: service_name }], 90); + await grafanaAPI.waitForMetric('mongodb_up', { type: 'service_id', value: service_id }, 90); await I.verifyCommand(`docker exec ${containerName} pmm-admin inventory remove service ${service_id} --force`); - await grafanaAPI.waitForMetricAbsent('mongodb_up', [{ type: 'service_name', value: service_name }], 90); + await grafanaAPI.waitForMetricAbsent('mongodb_up', { type: 'service_id', value: service_id }, 90); // PMM-T1352 Verify that Node exporter cannot be added by pmm-admin inventory add agent node-exporter with --log-level=fatal await I.verifyCommand(`docker exec ${containerName} pmm-admin inventory add agent node-exporter --log-level=fatal ${pmm_agent_id}`, 'pmm-admin: error: --log-level must be one of "debug","info","warn","error" but got "fatal"', 'fail'); }, diff --git a/tests/metrics/verifyMongoDBExperimental_test.js b/tests/metrics/verifyMongoDBExperimental_test.js index e382b4e04..a36d9ee14 100644 --- a/tests/metrics/verifyMongoDBExperimental_test.js +++ b/tests/metrics/verifyMongoDBExperimental_test.js @@ -55,6 +55,6 @@ Scenario( I.amOnPage(I.buildUrlWithParams(dashboardPage.mongoDbOplogDetails.clearUrl, { from: 'now-5m', service_name: mongodb_service_name_ac })); dashboardPage.waitForDashboardOpened(); await dashboardPage.verifyMetricsExistence(dashboardPage.mongoDbOplogDetails.metrics); - await dashboardPage.verifyThereAreNoGraphsWithoutData(1); + await dashboardPage.verifyThereAreNoGraphsWithoutData(2); }, ); diff --git a/tests/pages/api/grafanaAPI.js b/tests/pages/api/grafanaAPI.js index ba94eac11..4a217d6a9 100644 --- a/tests/pages/api/grafanaAPI.js +++ b/tests/pages/api/grafanaAPI.js @@ -361,11 +361,23 @@ module.exports = { async getMetric(metricName, refineBy) { const uid = await this.getDataSourceUidByName(); const currentTime = Date.now(); + let refineByString = ''; + + if (Array.isArray(refineBy)) { + // Handle refineBy as an array of objects + refineByString = refineBy + .filter(({ type, value }) => type && value) + .map(({ type, value }) => `${type}="${value}"`) + .join(','); + } else if (refineBy && refineBy.type && refineBy.value) { + // Handle refineBy as a single object with both type and value defined + refineByString = `${refineBy.type}="${refineBy.value}"`; + } const body = { queries: [ { refId: 'A', - expr: refineBy ? `${metricName}{${refineBy.type}="${refineBy.value}"}` : metricName, + expr: refineByString ? `${metricName}{${refineByString}}` : metricName, range: true, instant: false, datasource: { @@ -417,7 +429,7 @@ module.exports = { }; return await I.sendPostRequest( - 'graph/api/ds/query?ds_type=prometheus&requestId=explore_vmt', + 'graph/api/ds/query?ds_type=prometheus&requestId=explore_sbu', body, headers, ); @@ -480,7 +492,7 @@ module.exports = { // Main condition check: metric body is not empty const response = await this.getMetric(metricName, queryBy); - if (response.data.data.result.length === 0) { + if (response.data.results.A.frames[0].data.values.length === 0) { return response; } @@ -496,7 +508,13 @@ module.exports = { }, async checkMetricExist(metricName, refineBy) { - const response = await this.getMetric(metricName, refineBy); + let response; + + await I.asyncWaitFor(async () => { + response = await this.getMetric(metricName, refineBy); + + return response.data.results.A.frames[0].data.values.length !== 0; + }, 60); const result = JSON.stringify(response.data.results); @@ -509,13 +527,22 @@ module.exports = { }, async checkMetricAbsent(metricName, refineBy) { - const response = await this.getMetric(metricName, refineBy); - const result = JSON.stringify(response.data.data.result); + let response; + + await I.asyncWaitFor(async () => { + response = await this.getMetric(metricName, refineBy); + + return response.data.results.A.frames[0].data.values.length === 0; + }, 60); + + const result = JSON.stringify(response.data.results); I.assertEqual( - response.data.data.result.length, + response.data.results.A.frames[0].data.values.length, 0, `Metrics "${metricName}" with filters as ${JSON.stringify(refineBy)} should be empty but got available ${result}`, ); + + return response; }, }; diff --git a/tests/pages/dashboardPage.js b/tests/pages/dashboardPage.js index bbfbbf744..adca035a5 100644 --- a/tests/pages/dashboardPage.js +++ b/tests/pages/dashboardPage.js @@ -1023,9 +1023,10 @@ module.exports = { 'Top 5 Hottest Collections by Write (Total)', 'Top 5 Hottest Collections by Read (Rate)', 'Top 5 Hottest Collections by Write (Rate)', - 'Collections statistics for admin (rate)', - 'Collections statistics for admin (summary)', + 'Collections statistics for All (rate)', + 'Collections statistics for All (summary)', 'Collections statistics admin', + 'Collections statistics config', ], },