"use strict";
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Object.defineProperty(exports, "__esModule", { value: true });
const performance_helpers_js_1 = require("../helpers/performance-helpers.js");
describe('The Performance panel', function () {
    setup({ dockingMode: 'undocked' });
    (0, performance_helpers_js_1.increaseTimeoutForPerfPanel)(this);
    it('supports the user manually starting and stopping a recording', async ({ devToolsPage, inspectedPage }) => {
        await (0, performance_helpers_js_1.navigateToPerformanceTab)('empty', devToolsPage, inspectedPage);
        await (0, performance_helpers_js_1.startRecording)(devToolsPage);
        await (0, performance_helpers_js_1.stopRecording)(devToolsPage);
        await devToolsPage.waitForFunction(async () => {
            const totalTime = await (0, performance_helpers_js_1.getTotalTimeFromSummary)(devToolsPage);
            return totalTime > 0;
        });
    });
    it('can reload and record a trace', async ({ devToolsPage, inspectedPage }) => {
        await (0, performance_helpers_js_1.navigateToPerformanceTab)('fake-website', devToolsPage, inspectedPage);
        await (0, performance_helpers_js_1.reloadAndRecord)(devToolsPage);
        await devToolsPage.waitForFunction(async () => {
            const totalTime = await (0, performance_helpers_js_1.getTotalTimeFromSummary)(devToolsPage);
            return totalTime > 0;
        });
    });
    it('can import a stored trace file', async ({ devToolsPage, inspectedPage }) => {
        await (0, performance_helpers_js_1.navigateToPerformanceTab)('empty', devToolsPage, inspectedPage);
        await (0, performance_helpers_js_1.uploadTraceFile)(devToolsPage, 'test/e2e/resources/performance/timeline/web.dev-trace.json.gz');
        const canvas = await devToolsPage.waitFor('canvas.flame-chart-canvas');
        // Check that we have rendered the timeline canvas.
        await devToolsPage.waitForFunction(async () => {
            const height = await canvas.evaluate(elem => elem.clientHeight);
            return height > 200;
        });
    });
});
//# sourceMappingURL=recording.test.js.map