MCPcopy
hub / github.com/ampproject/amphtml / performVisualTests

Function performVisualTests

build-system/tasks/visual-diff/index.js:630–664  ·  view source on GitHub ↗

* Runs the AMP visual diff tests. * * @return {Promise }

()

Source from the content-addressed store, hash-verified

628 * @return {Promise<void>}
629 */
630async function performVisualTests() {
631 setDebuggingLevel();
632
633 const browser = await launchBrowser();
634 const handlerProcess = createCtrlcHandler(
635 'visual-diff:browser',
636 browser.process()?.pid
637 );
638 await startServer(
639 {host: HOST, port: PORT},
640 {quiet: !argv.webserver_debug},
641 {minified: true}
642 );
643
644 try {
645 if (!argv.empty) {
646 // Load and parse the config. Use JSON5 due to JSON comments in file.
647 const visualTestsConfig = JSON5.parse(
648 fs.readFileSync(
649 path.resolve(
650 __dirname,
651 '../../../test/visual-diff/visual-tests.jsonc'
652 ),
653 'utf8'
654 )
655 );
656 await runVisualTests(browser, visualTestsConfig.webpages);
657 }
658 await createEmptyBuild(browser);
659 } finally {
660 await browser.close();
661 exitCtrlcHandler(handlerProcess);
662 await stopServer();
663 }
664}
665
666/**
667 * @return {Promise<void>}

Callers 1

visualDiffFunction · 0.85

Calls 9

setDebuggingLevelFunction · 0.85
launchBrowserFunction · 0.85
startServerFunction · 0.85
runVisualTestsFunction · 0.85
createEmptyBuildFunction · 0.85
stopServerFunction · 0.85
resolveMethod · 0.80
parseMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected