mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
a4ead704ba
Builds on top of the existing Playwright tests to plug in the test selector API: https://gist.github.com/bvaughn/d3c8b8842faf2ac2439bb11773a19cec My goals in doing this are to... 1. Experiment with the new API to see what works and what doesn't. 2. Add some test selector attributes (and remove DOM-structure based selectors). 3. Focus the tests on DevTools itself (rather than the test app). I also took this opportunity to add a few new test cases– like named hooks, editable props, component search, and profiling- just to play around more with the Playwright API. Relates to issue #22646
22 lines
669 B
JavaScript
22 lines
669 B
JavaScript
/** @flow */
|
|
|
|
// This test harness mounts each test app as a separate root to test multi-root applications.
|
|
|
|
import * as React from 'react';
|
|
import * as ReactDOM from 'react-dom';
|
|
|
|
const container = document.createElement('div');
|
|
|
|
((document.body: any): HTMLBodyElement).appendChild(container);
|
|
|
|
// TODO We may want to parameterize this app
|
|
// so that it can load things other than just ToDoList.
|
|
const App = require('./apps/ListApp').default;
|
|
|
|
// $FlowFixMe Flow doesn't know about createRoot() yet.
|
|
const root = ReactDOM.createRoot(container);
|
|
root.render(<App />);
|
|
|
|
// ReactDOM Test Selector APIs used by Playwright e2e tests
|
|
window.parent.REACT_DOM_APP = ReactDOM;
|