"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 chai_1 = require("chai");
const console_helpers_js_1 = require("../helpers/console-helpers.js");
describe('The Console Tab', () => {
    it('does not break when global `eval` is overwritten', async ({ devToolsPage }) => {
        await (0, console_helpers_js_1.navigateToConsoleTab)(devToolsPage);
        await (0, console_helpers_js_1.focusConsolePrompt)(devToolsPage);
        await devToolsPage.typeText('const foo = \'fooValue\'; globalThis.eval = \'non-function\';');
        await devToolsPage.page.keyboard.press('Enter');
        // Wait for the console to be usable again.
        await devToolsPage.waitForFunction(() => devToolsPage.evaluate(() => document.querySelectorAll('.console-user-command-result').length === 1));
        await devToolsPage.typeText('foo;');
        await devToolsPage.page.keyboard.press('Enter');
        // Wait for the console to be usable again.
        await devToolsPage.waitForFunction(() => devToolsPage.evaluate(() => document.querySelectorAll('.console-user-command-result').length === 2));
        const messages = await (0, console_helpers_js_1.getCurrentConsoleMessages)(false, undefined, undefined, devToolsPage);
        chai_1.assert.deepEqual(messages, [
            '\'non-function\'',
            '\'fooValue\'',
        ]);
    });
});
//# sourceMappingURL=console-eval-fake.test.js.map