playwright
playwright copied to clipboard
[BUG] Component test does not respect https config from vite
Context:
- Playwright Version: 1.23.3
- Playwright CT Version: 1.23.3
- Operating System: MacOS
- Node.js version: 14.19.1
- Browser: All
- Extra: Own vite config, using @playwright/experimental-ct-vue2
Code Snippet
playwright.config.js
const viteConfig = require('./vite.config');
const config = {
....
use: {
ctPort: 8081,
ctViteConfig: {
...viteConfig,
},
},
....
};
module.exports = config;
vite.config.js
const { defineConfig } = require('vite');
const { readFileSync } = require('fs');
// export the main config
module.exports = defineConfig({
....
server: {
hmr: true,
port: 8080,
strictPort: true,
https: {
key: readFileSync('certs/localhost-key.pem'),
cert: readFileSync('certs/localhost.pem'),
},
},
preview: {
https: {
key: readFileSync('certs/localhost-key.pem'),
cert: readFileSync('certs/localhost.pem'),
},
},
....
});
Describe the bug
The problem is, that when I run the component test, it is using 'http://localhost:8081' instead of 'https://localhost:8081', which is resulting in a network error, even though the vite.config.js is defining https certificates. When I try to reach 'https://localhost:8081' manually in the browser, I am getting the 'playwright/index.html' served as expected. Also when I inspect the config parameter in the globalSetup script, the preview param only contains the port 8081 but no info about the https. Seems as if it's getting overwritten?