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
fix(ct): restore public folder deployment (#15594)
Pavel Feldman00848b1bcfb5
diff --git a/packages/playwright-test/src/plugins/vitePlugin.ts b/packages/playwright-test/src/plugins/vitePlugin.tsindex 019f97618d..ce8a607ea0 100644--- a/packages/playwright-test/src/plugins/vitePlugin.ts+++ b/packages/playwright-test/src/plugins/vitePlugin.ts@@ -27,7 +27,7 @@ import { assert, calculateSha1 } from 'playwright-core/lib/utils';import type { AddressInfo } from 'net';let previewServer: PreviewServer;-const VERSION = 5;+const VERSION = 6;type CtConfig = {ctPort?: number;@@ -88,7 +88,6 @@ export function createPlugin(const sourcesDirty = !buildExists || hasNewComponents || await checkSources(buildInfo);viteConfig.root = rootDir;- viteConfig.publicDir = false;viteConfig.preview = { port };viteConfig.build = {outDirdiff --git a/tests/playwright-test/playwright.ct-react.spec.ts b/tests/playwright-test/playwright.ct-react.spec.tsindex 2fd9496aa7..a507b05895 100644--- a/tests/playwright-test/playwright.ct-react.spec.ts+++ b/tests/playwright-test/playwright.ct-react.spec.ts@@ -26,7 +26,6 @@ test('should work with TSX', async ({ runInlineTest }) => {//@no-headerexport const Button = () => <button>Button</button>;`,-'src/button.test.tsx': `//@no-headerimport { test, expect } from '@playwright/experimental-ct-react';@@ -321,3 +320,39 @@ test('should respect default property values', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);});++test('should bundle public folder', async ({ runInlineTest }) => {+ const result = await runInlineTest({+ 'playwright/index.html': `<script type="module" src="/playwright/index.ts"></script>`,+ 'playwright/index.ts': `+ //@no-header+ `,+ 'public/logo.svg': `+ //@no-header+ <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">+ <circle cx="50" cy="50" r="50"/>+ </svg>`,+ 'src/image.tsx': `+ //@no-header+ export const Image = () => <img src='/logo.svg' className="App-logo" alt="logo" />;+ `,+ 'src/image.test.tsx': `+ //@no-header+ import { test, expect } from '@playwright/experimental-ct-react';+ import { Image } from './image';++ test('pass', async ({ mount, page }) => {+ const urls = [];+ const [response] = await Promise.all([+ page.waitForResponse('**/*.svg'),+ mount(<Image></Image>)+ ]);+ const data = await response.body();+ await expect(data.toString()).toContain('</svg>');+ });+ `,+ }, { workers: 1 });++ expect(result.exitCode).toBe(0);+ expect(result.passed).toBe(1);+});