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`.
This commit is contained in:
Andrey Lushnikov 2021-05-20 09:46:50 -07:00 коммит произвёл GitHub
Родитель 447a0c4bb8
Коммит ae35906fb5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -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.