MCPcopy Index your code
hub / github.com/react/react / validate

Function validate

scripts/release/shared-commands/test-packaging-fixture.js:12–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10const {logPromise} = require('../utils');
11
12const validate = async () => {
13 const browser = await puppeteer.launch();
14 const page = await browser.newPage();
15
16 await page.goto('http://localhost:9000/fixtures/packaging');
17
18 try {
19 return await page.evaluate(() => {
20 const iframes = document.querySelectorAll('iframe');
21
22 if (iframes.length === 0) {
23 return 'No iframes were found.';
24 }
25
26 for (let i = 0; i < iframes.length; i++) {
27 const iframe = iframes[i];
28 // Don't include the <script> Babel tag
29 const container =
30 iframe.contentDocument.body.getElementsByTagName('div')[0];
31 if (container.textContent !== 'Hello World!') {
32 return `Unexpected fixture content, "${container.textContent}"`;
33 }
34 }
35
36 return null;
37 });
38 } finally {
39 await browser.close();
40 }
41};
42
43const run = async ({cwd}) => {
44 await logPromise(

Callers 1

runFunction · 0.70

Calls 1

closeMethod · 0.65

Tested by

no test coverage detected