From ae35906fb51f6a262135a04908be64806b0f3d2f Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 20 May 2021 09:46:50 -0700 Subject: [PATCH] devops: flakiness dashboard to support new folio report (#6677) JSON report will change again in https://github.com/microsoft/playwright/pull/6656 This patch modifies azure function to accomodate to the new format. Note: with the new notion of projects instead of per-test parameters, we can actually compress dashboard per commit much more efficient. If the format sticks, we'll follow-up with a `dashboard_compressed_v2.js`. --- .../processing/dashboard_compressed_v1.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/utils/flakiness-dashboard/processing/dashboard_compressed_v1.js b/utils/flakiness-dashboard/processing/dashboard_compressed_v1.js index 3cc36902a0..1973091a82 100644 --- a/utils/flakiness-dashboard/processing/dashboard_compressed_v1.js +++ b/utils/flakiness-dashboard/processing/dashboard_compressed_v1.js @@ -33,6 +33,18 @@ module.exports = {processDashboardCompressedV1, compressReports}; function compressReports(reports) { const files = {}; for (const report of reports) { + const projectNameToMetadata = new Map(); + if (report.config && report.config.projects) { + for (const project of report.config.projects) { + if (project.metadata.headful === false) + delete project.metadata.headful; + if (project.metadata.mode === 'default') + delete project.metadata.mode; + if (project.metadata.platform.toLowerCase() !== 'android') + delete project.metadata.platform; + projectNameToMetadata.set(project.name, project.metadata); + } + } for (const spec of flattenSpecs(report)) { let specs = files[spec.file]; if (!specs) { @@ -62,7 +74,9 @@ function compressReports(reports) { // Folio currently reports `data` as part of test results. // In our case, all data will be identical - so pick // from the first result. - const testParameters = test.results[0].data; + let testParameters = test.results[0].data; + if (!testParameters && test.projectName) + testParameters = projectNameToMetadata.get(test.projectName); // Prefer test platform when it exists, and fallback to // the host platform when it doesn't. This way we can attribute // android tests to android.