Этот коммит содержится в:
Mario Vitale
2023-03-27 16:28:42 +02:00
родитель da7a6825ce
Коммит ba6b97fb62
1142 изменённых файлов: 44 добавлений и 44 удалений

29
e2e-tests/cypress/tests/utils/benchmark.js Обычный файл
Просмотреть файл

@@ -0,0 +1,29 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
export function reportBenchmarkResults(cy, win) {
const testName = getTestName();
const selectors = win.getSortedTrackedSelectors();
win.dumpTrackedSelectorsStatistics();
cy.log(selectors.length);
cy.writeFile(`tests/integration/benchmark/__benchmarks__/${testName}.json`, JSON.stringify(selectors));
}
// From https://github.com/cypress-io/cypress/issues/2972#issuecomment-577072392
function getTestName() {
const cypressContext = Cypress.mocha.getRunner().suite.ctx.test;
const testTitles = [];
function extractTitles(obj) {
if (obj.hasOwnProperty('parent')) {
testTitles.push(obj.title);
const nextObj = obj.parent;
extractTitles(nextObj);
}
}
extractTitles(cypressContext);
const orderedTitles = testTitles.reverse();
const fileName = orderedTitles.join(' -- ');
return fileName;
}