Files
react-native-devtools-frontend/test/e2e/elements/reveal-correct-node_test.ts
T
Johan Bay f2ac64a53a Add test for revealing assigned slot elements
Bug: none
Change-Id: I04c2b99d05c121b7b39733686b5b118ec8edc78a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3642136
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Changhao Han <changhaohan@chromium.org>
Auto-Submit: Johan Bay <jobay@chromium.org>
2022-05-11 15:50:55 +00:00

55 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {click, goToResource, step, waitFor, waitForFunction} from '../../shared/helper.js';
import {describe, it} from '../../shared/mocha-extensions.js';
import {
expandSelectedNodeRecursively,
waitForPartialContentOfSelectedElementsNode,
waitForSelectedTreeElementSelectorWhichIncludesText,
} from '../helpers/elements-helpers.js';
import {expandIssue, navigateToIssuesTab, revealNodeInElementsPanel} from '../helpers/issues-helpers.js';
import {clickOnContextMenu} from '../helpers/sources-helpers.js';
// TODO: Add a second node reveal test, where am issue is produced by an OOPIF
describe('The Issues tab', async () => {
it('should reveal an element in the Elements panel when the node icon is clicked', async () => {
await goToResource('elements/element-reveal-inline-issue.html');
await navigateToIssuesTab();
await expandIssue();
await revealNodeInElementsPanel();
await waitForSelectedTreeElementSelectorWhichIncludesText('alert("This should be blocked by CSP");');
});
});
describe('The Elements panel', async () => {
it('has a context menu link from an iframe to the corresponding frame details view', async () => {
await goToResource('application/main-frame.html');
await clickOnContextMenu('[aria-label="</iframe>"]', 'Show iframe details');
await step('Frame details report with correct title is shown', async () => {
await waitForFunction(async () => {
const reportTitleNode = await waitFor('.report-title');
const reportTitle = await reportTitleNode.evaluate(e => e.textContent);
return reportTitle === 'frameId (iframe.html)';
});
});
await step('The correct frame is selected in the sidebar', async () => {
await waitFor('[aria-label="frameId (iframe.html)"][aria-selected="true"]');
});
});
it('has link from a slot to assigned elements', async () => {
await goToResource('elements/slot-element.html');
await expandSelectedNodeRecursively();
const revealLink = await waitFor('reveal[role="link"]', undefined, undefined, 'aria');
await click(revealLink);
await waitForPartialContentOfSelectedElementsNode('<h1>​headline​</h1>');
});
});