Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: move vite root dir into template folder (#29081)

Pavel Feldman41c15cb1767b
diff --git a/packages/html-reporter/playwright/index.html b/packages/html-reporter/playwright/index.html
index 9bba58cfa3..b18a1e9c7d 100644
--- a/packages/html-reporter/playwright/index.html
+++ b/packages/html-reporter/playwright/index.html
@@ -24,6 +24,6 @@
</head>
<body>
<div id='root'></div>
- <script type='module' src='/playwright/index.ts'></script>
+ <script type='module' src='/index.ts'></script>
</body>
</html>
diff --git a/packages/playwright-ct-core/src/vitePlugin.ts b/packages/playwright-ct-core/src/vitePlugin.ts
index 147278587b..ca012c272f 100644
--- a/packages/playwright-ct-core/src/vitePlugin.ts
+++ b/packages/playwright-ct-core/src/vitePlugin.ts
@@ -76,8 +76,9 @@ export function createPlugin(
// Compose base config from the playwright config only.
const baseConfig: InlineConfig = {
- root: configDir,
+ root: templateDir,
configFile: false,
+ publicDir: path.join(configDir, 'public'),
define: {
__VUE_PROD_DEVTOOLS__: true,
},
@@ -189,7 +190,6 @@ export function createPlugin(
if (sourcesDirty) {
log('build');
await build(finalConfig);
- await fs.promises.rename(`${finalConfig.build.outDir}/${relativeTemplateDir}/index.html`, `${finalConfig.build.outDir}/index.html`);
buildInfo.deps = Object.fromEntries(depsCollector.entries());
}
diff --git a/tests/components/ct-svelte-vite/svelte.config.js b/tests/components/ct-svelte-vite/playwright/svelte.config.js
similarity index 100%
rename from tests/components/ct-svelte-vite/svelte.config.js
rename to tests/components/ct-svelte-vite/playwright/svelte.config.js
diff --git a/tests/playwright-test/playwright.ct-build.spec.ts b/tests/playwright-test/playwright.ct-build.spec.ts
index a9421c39aa..6fd4f6d474 100644
--- a/tests/playwright-test/playwright.ct-build.spec.ts
+++ b/tests/playwright-test/playwright.ct-build.spec.ts
@@ -39,7 +39,7 @@ test('should work with the empty component list', async ({ runInlineTest }, test
expect(result.passed).toBe(1);
const output = result.output;
expect(output).toContain('transforming...');
- expect(output.replace(/\\+/g, '/')).toContain('playwright/.cache/playwright/index.html');
+ expect(output.replace(/\\+/g, '/')).toContain('.cache/index.html');
const metainfo = JSON.parse(fs.readFileSync(testInfo.outputPath('playwright/.cache/metainfo.json'), 'utf-8'));
expect(metainfo.version).toEqual(require('playwright-core/package.json').version);