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: drop HMR leftovers (#37950)
Simon Knott1377d26c9013
diff --git a/packages/html-reporter/src/index.tsx b/packages/html-reporter/src/index.tsxindex df1f9b2ab7..f7263ea865 100644--- a/packages/html-reporter/src/index.tsx+++ b/packages/html-reporter/src/index.tsx@@ -55,35 +55,12 @@ window.onload = () => {ReactDOM.createRoot(document.querySelector('#root')!).render(<ReportLoader />);};-const kPlaywrightReportStorageForHMR = 'playwrightReportStorageForHMR';-class ZipReport implements LoadedReport {private _entries = new Map<string, zip.Entry>();private _json!: HTMLReport;async load() {- const zipURI = await new Promise<string>(resolve => {- const element = document.getElementById('playwrightReportBase64');- if (!!element?.textContent)- return resolve(element.textContent);- if (window.opener) {- const listener = (event: MessageEvent) => {- if (event.source === window.opener) {- localStorage.setItem(kPlaywrightReportStorageForHMR, event.data);- resolve(event.data);- window.removeEventListener('message', listener);- }- };- window.addEventListener('message', listener);- window.opener.postMessage('ready', '*');- } else {- const oldReport = localStorage.getItem(kPlaywrightReportStorageForHMR);- if (oldReport)- return resolve(oldReport);- alert('couldnt find report, something with HMR is broken');- }- });-+ const zipURI = document.getElementById('playwrightReportBase64')!.textContent;const zipReader = new zipjs.ZipReader(new zipjs.Data64URIReader(zipURI), { useWebWorkers: false });for (const entry of await zipReader.getEntries())this._entries.set(entry.filename, entry);diff --git a/packages/trace-viewer/.gitignore b/packages/trace-viewer/.gitignoreindex 9c0fa8b116..a547bf36d8 100644--- a/packages/trace-viewer/.gitignore+++ b/packages/trace-viewer/.gitignore@@ -22,5 +22,3 @@ dist-ssr*.njsproj*.sln*.sw?--public/sw.bundle.jsdiff --git a/packages/trace-viewer/vite.config.ts b/packages/trace-viewer/vite.config.tsindex 071cfee623..ed150fb6b1 100644--- a/packages/trace-viewer/vite.config.ts+++ b/packages/trace-viewer/vite.config.ts@@ -43,7 +43,7 @@ export default defineConfig({},build: {outDir: path.resolve(__dirname, '../playwright-core/lib/vite/traceViewer'),- emptyOutDir: true,+ emptyOutDir: false,rollupOptions: {input: {index: path.resolve(__dirname, 'index.html'),diff --git a/packages/trace-viewer/vite.sw.config.ts b/packages/trace-viewer/vite.sw.config.tsindex 1db9593644..6f55ec04ce 100644--- a/packages/trace-viewer/vite.sw.config.ts+++ b/packages/trace-viewer/vite.sw.config.ts@@ -39,8 +39,8 @@ export default defineConfig({},publicDir: false,build: {- // outputs into the public dir, where the build of vite.config.ts will pick it up- outDir: path.resolve(__dirname, 'public'),+ outDir: path.resolve(__dirname, '../playwright-core/lib/vite/traceViewer'),+ // Output dir is shared with vite.config.ts, clearing it here is racy.emptyOutDir: false,rollupOptions: {input: {diff --git a/utils/build/build.js b/utils/build/build.jsindex bdd7b15451..3ec5981c92 100644--- a/utils/build/build.js+++ b/utils/build/build.js@@ -532,29 +532,9 @@ steps.push(new ProgramStep({],shell: true,cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),- concurrent: watchMode, // feeds into trace-viewer's `public` directory, so it needs to be finished before trace-viewer build starts+ concurrent: true,}));-if (watchMode) {- // the build above outputs into `packages/trace-viewer/public`, where the `vite build` for `packages/trace-viewer` is supposed to pick it up.- // there's a bug in `vite build --watch` though where the public dir is only copied over initially, but its not watched.- // to work around this, we run a second watch build of the service worker into the final output.- // bug: https://github.com/vitejs/vite/issues/18655- steps.push(new ProgramStep({- command: 'npx',- args: [- 'vite', '--config', 'vite.sw.config.ts',- 'build', '--watch', '--minify=false',- '--outDir', path.join(__dirname, '..', '..', 'packages', 'playwright-core', 'lib', 'vite', 'traceViewer'),- '--emptyOutDir=false',- '--clearScreen=false',- ],- shell: true,- cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),- concurrent: true- }));-}-// Build/watch web packages.for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {steps.push(new ProgramStep({@@ -572,31 +552,6 @@ for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {}));}-// web packages dev server-if (watchMode) {- steps.push(new ProgramStep({- command: 'npx',- args: ['vite', '--port', '44223', '--base', '/trace/', '--clearScreen=false'],- shell: true,- cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),- concurrent: true,- }));- steps.push(new ProgramStep({- command: 'npx',- args: ['vite', '--port', '44224', '--clearScreen=false'],- shell: true,- cwd: path.join(__dirname, '..', '..', 'packages', 'html-reporter'),- concurrent: true,- }));- steps.push(new ProgramStep({- command: 'npx',- args: ['vite', '--port', '44225', '--clearScreen=false'],- shell: true,- cwd: path.join(__dirname, '..', '..', 'packages', 'recorder'),- concurrent: true,- }));-}-// Generate injected.onChanges.push({inputs: [