page(); $page->addStyleTag('* { transition: none !important; animation: none !important; font-family: Arial, sans-serif !important; body { -webkit-font-smoothing: antialiased !important; -moz-osx-font-smoothing: grayscale !important; } }'); $page->waitForFunction( 'document.readyState === "complete"' .' && document.fonts.status === "loaded"' ); usleep(300_000); try { $page->expectScreenshot(true, false); } catch (ExpectationFailedException $exception) { $this->exportMismatchScreenshots(); throw BrowserExpectationFailedException::from($page, $exception); } } private function exportMismatchScreenshots(): void { [$snapshotName] = TestSuite::getInstance()->snapshots->get(); $base = pathinfo($snapshotName, PATHINFO_FILENAME); $htmlPath = Screenshot::dir().'/ImageDiffView/'.$base.'.html'; if (! is_file($htmlPath)) { return; } MismatchScreenshotExporter::export($htmlPath, Screenshot::dir()); } }