Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: move html report to package (#10898)
Pavel Feldmana82a3f1128d1
diff --git a/packages/html-reporter/build.js b/packages/html-reporter/build.jsdeleted file mode 100644index 20719c4e5e..0000000000--- a/packages/html-reporter/build.js+++ /dev/null@@ -1,2 +0,0 @@-// write something to playwright-core/lib/web/ with webpack-diff --git a/packages/playwright-core/src/web/htmlReport/bundleJsPlugin.js b/packages/html-reporter/bundleJsPlugin.jssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/bundleJsPlugin.jsrename to packages/html-reporter/bundleJsPlugin.jsdiff --git a/packages/playwright-core/src/web/htmlReport/chip.css b/packages/html-reporter/src/chip.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/chip.cssrename to packages/html-reporter/src/chip.cssdiff --git a/packages/playwright-core/src/web/htmlReport/chip.tsx b/packages/html-reporter/src/chip.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/chip.tsxrename to packages/html-reporter/src/chip.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/colors.css b/packages/html-reporter/src/colors.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/colors.cssrename to packages/html-reporter/src/colors.cssdiff --git a/packages/playwright-core/src/web/htmlReport/common.css b/packages/html-reporter/src/common.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/common.cssrename to packages/html-reporter/src/common.cssdiff --git a/packages/playwright-core/src/web/htmlReport/filter.ts b/packages/html-reporter/src/filter.tssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/filter.tsrename to packages/html-reporter/src/filter.tsdiff --git a/packages/playwright-core/src/web/htmlReport/headerView.tsx b/packages/html-reporter/src/headerView.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/headerView.tsxrename to packages/html-reporter/src/headerView.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/icons.tsx b/packages/html-reporter/src/icons.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/icons.tsxrename to packages/html-reporter/src/icons.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/images.ts b/packages/html-reporter/src/images.tssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/images.tsrename to packages/html-reporter/src/images.tsdiff --git a/packages/playwright-core/src/web/htmlReport/index.html b/packages/html-reporter/src/index.htmlsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/index.htmlrename to packages/html-reporter/src/index.htmldiff --git a/packages/playwright-core/src/web/htmlReport/index.tsx b/packages/html-reporter/src/index.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/index.tsxrename to packages/html-reporter/src/index.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/links.css b/packages/html-reporter/src/links.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/links.cssrename to packages/html-reporter/src/links.cssdiff --git a/packages/playwright-core/src/web/htmlReport/links.tsx b/packages/html-reporter/src/links.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/links.tsxrename to packages/html-reporter/src/links.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/loadedReport.ts b/packages/html-reporter/src/loadedReport.tssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/loadedReport.tsrename to packages/html-reporter/src/loadedReport.tsdiff --git a/packages/playwright-core/src/web/htmlReport/reportView.css b/packages/html-reporter/src/reportView.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/reportView.cssrename to packages/html-reporter/src/reportView.cssdiff --git a/packages/playwright-core/src/web/htmlReport/reportView.tsx b/packages/html-reporter/src/reportView.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/reportView.tsxrename to packages/html-reporter/src/reportView.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/statusIcon.tsx b/packages/html-reporter/src/statusIcon.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/statusIcon.tsxrename to packages/html-reporter/src/statusIcon.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/tabbedPane.css b/packages/html-reporter/src/tabbedPane.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/tabbedPane.cssrename to packages/html-reporter/src/tabbedPane.cssdiff --git a/packages/playwright-core/src/web/htmlReport/tabbedPane.tsx b/packages/html-reporter/src/tabbedPane.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/tabbedPane.tsxrename to packages/html-reporter/src/tabbedPane.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/testCaseView.css b/packages/html-reporter/src/testCaseView.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/testCaseView.cssrename to packages/html-reporter/src/testCaseView.cssdiff --git a/packages/playwright-core/src/web/htmlReport/testCaseView.tsx b/packages/html-reporter/src/testCaseView.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/testCaseView.tsxrename to packages/html-reporter/src/testCaseView.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/testFileView.css b/packages/html-reporter/src/testFileView.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/testFileView.cssrename to packages/html-reporter/src/testFileView.cssdiff --git a/packages/playwright-core/src/web/htmlReport/testFileView.tsx b/packages/html-reporter/src/testFileView.tsxsimilarity index 98%rename from packages/playwright-core/src/web/htmlReport/testFileView.tsxrename to packages/html-reporter/src/testFileView.tsxindex d50d09c008..cf55ca1450 100644--- a/packages/playwright-core/src/web/htmlReport/testFileView.tsx+++ b/packages/html-reporter/src/testFileView.tsx@@ -16,7 +16,7 @@import type { HTMLReport, TestFileSummary } from '@playwright/test/src/reporters/html';import * as React from 'react';-import { msToString } from '../uiUtils';+import { msToString } from './uiUtils';import { Chip } from './chip';import { Filter } from './filter';import { Link, ProjectLink } from './links';diff --git a/packages/playwright-core/src/web/htmlReport/testFilesView.tsx b/packages/html-reporter/src/testFilesView.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/testFilesView.tsxrename to packages/html-reporter/src/testFilesView.tsxdiff --git a/packages/playwright-core/src/web/htmlReport/testResultView.css b/packages/html-reporter/src/testResultView.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/testResultView.cssrename to packages/html-reporter/src/testResultView.cssdiff --git a/packages/playwright-core/src/web/htmlReport/testResultView.tsx b/packages/html-reporter/src/testResultView.tsxsimilarity index 99%rename from packages/playwright-core/src/web/htmlReport/testResultView.tsxrename to packages/html-reporter/src/testResultView.tsxindex 175e218840..f859cb2db6 100644--- a/packages/playwright-core/src/web/htmlReport/testResultView.tsx+++ b/packages/html-reporter/src/testResultView.tsx@@ -19,7 +19,7 @@ import ansi2html from 'ansi-to-html';import * as React from 'react';import { TreeItem } from './treeItem';import { TabbedPane } from './tabbedPane';-import { msToString } from '../uiUtils';+import { msToString } from './uiUtils';import { Chip } from './chip';import { traceImage } from './images';import { AttachmentLink } from './links';diff --git a/packages/playwright-core/src/web/htmlReport/treeItem.css b/packages/html-reporter/src/treeItem.csssimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/treeItem.cssrename to packages/html-reporter/src/treeItem.cssdiff --git a/packages/playwright-core/src/web/htmlReport/treeItem.tsx b/packages/html-reporter/src/treeItem.tsxsimilarity index 100%rename from packages/playwright-core/src/web/htmlReport/treeItem.tsxrename to packages/html-reporter/src/treeItem.tsxdiff --git a/packages/html-reporter/src/uiUtils.ts b/packages/html-reporter/src/uiUtils.tsnew file mode 100644index 0000000000..34ad57731f--- /dev/null+++ b/packages/html-reporter/src/uiUtils.ts@@ -0,0 +1,41 @@+/*+ Copyright (c) Microsoft Corporation.++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+*/++export function msToString(ms: number): string {+ if (!isFinite(ms))+ return '-';++ if (ms === 0)+ return '0';++ if (ms < 1000)+ return ms.toFixed(0) + 'ms';++ const seconds = ms / 1000;+ if (seconds < 60)+ return seconds.toFixed(1) + 's';++ const minutes = seconds / 60;+ if (minutes < 60)+ return minutes.toFixed(1) + 'm';++ const hours = minutes / 60;+ if (hours < 24)+ return hours.toFixed(1) + 'h';++ const days = hours / 24;+ return days.toFixed(1) + 'd';+}diff --git a/packages/playwright-core/src/web/htmlReport/webpack.config.js b/packages/html-reporter/webpack.config.jssimilarity index 84%rename from packages/playwright-core/src/web/htmlReport/webpack.config.jsrename to packages/html-reporter/webpack.config.jsindex 7f8e0606b5..059d769852 100644--- a/packages/playwright-core/src/web/htmlReport/webpack.config.js+++ b/packages/html-reporter/webpack.config.js@@ -23,8 +23,8 @@ const mode = process.env.NODE_ENV === 'production' ? 'production' : 'developmentmodule.exports = {mode,entry: {- zip: path.resolve(__dirname, '../../../../../node_modules/@zip.js/zip.js/dist/zip-no-worker-inflate.min.js'),- app: path.join(__dirname, 'index.tsx'),+ zip: require.resolve('@zip.js/zip.js/dist/zip-no-worker-inflate.min.js'),+ app: path.join(__dirname, 'src', 'index.tsx'),},resolve: {extensions: ['.ts', '.js', '.tsx', '.jsx']@@ -33,7 +33,7 @@ module.exports = {output: {globalObject: 'self',filename: '[name].bundle.js',- path: path.resolve(__dirname, '../../../lib/webpack/htmlReport')+ path: path.resolve(__dirname, '..', 'playwright-core', 'lib', 'webpack', 'htmlReport')},module: {rules: [@@ -57,7 +57,7 @@ module.exports = {plugins: [new HtmlWebPackPlugin({title: 'Playwright Test Report',- template: path.join(__dirname, 'index.html'),+ template: path.join(__dirname, 'src', 'index.html'),inject: true,}),new BundleJsPlugin(),diff --git a/utils/build/build.js b/utils/build/build.jsindex 3213cf87ea..4737907a43 100644--- a/utils/build/build.js+++ b/utils/build/build.js@@ -159,7 +159,7 @@ const webPackFiles = ['packages/playwright-core/src/web/traceViewer/webpack.config.js','packages/playwright-core/src/web/traceViewer/webpack-sw.config.js','packages/playwright-core/src/web/recorder/webpack.config.js',- 'packages/playwright-core/src/web/htmlReport/webpack.config.js',+ 'packages/html-reporter/webpack.config.js',];for (const file of webPackFiles) {steps.push({diff --git a/utils/check_deps.js b/utils/check_deps.jsindex 9d563e1021..9a8ad6d6c0 100644--- a/utils/check_deps.js+++ b/utils/check_deps.js@@ -238,12 +238,6 @@ DEPS['src/server/trace/viewer/'] = ['src/server/trace/common/', 'src/server/trac// DEPS['src/test/'] = ['src/test/**', 'src/utils/utils.ts', 'src/utils/**', 'src/protocol/channels.ts'];// DEPS['src/test/index.ts'] = [... DEPS['src/test/'], 'src/grid/gridClient.ts' ];-// HTML report-DEPS['src/web/htmlReport/'] = [- // 'src/test/**',- 'src/web/'-];-// GridDEPS['src/grid/'] = ['src/utils/**', 'src/dispatchers/**', 'src/server/', 'src/client/'];