"use strict";
// Copyright 2021 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 issues_helpers_js_1 = require("../helpers/issues-helpers.js");
describe('Client Hint issues test', () => {
    it('should display issue when Client Hints are used with invalid origin for DelegateCH', async ({ devToolsPage, inspectedPage, }) => {
        await inspectedPage.goToResource('issues/client-hint-issue-DelegateCH-MetaTagAllowListInvalidOrigin.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        await (0, issues_helpers_js_1.expandIssue)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getIssueByTitle)('Client Hint meta tag contained invalid origin', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('2 sources', issueElement, '.affected-resource-label', devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [
            ['client-hint-issue-DelegateCH-MetaTagAllowListInvalidOrigin.html:1'],
            ['client-hint-issue-DelegateCH-MetaTagAllowListInvalidOrigin.html:4'],
        ];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
    it('should display issue when Client Hints are modified by javascript for DelegateCH', async ({ devToolsPage, inspectedPage, }) => {
        await inspectedPage.goToResource('issues/client-hint-issue-DelegateCH-MetaTagModifiedHTML.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        await (0, issues_helpers_js_1.expandIssue)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getIssueByTitle)('Client Hint meta tag modified by javascript', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('1 source', issueElement, '.affected-resource-label', devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [['client-hint-issue-DelegateCH-MetaTagModifiedHTML.html:7']];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
});
//# sourceMappingURL=client-hint-issues.test.js.map