Skip to content

Commit de8cf2d

Browse files
test(browser): unskipped https test for browser (#5290)
1 parent 5bb8b38 commit de8cf2d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

test/browser/fixtures/server-url/vitest.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ import basicSsl from '@vitejs/plugin-basic-ssl'
99
const provider = process.env.PROVIDER || 'webdriverio';
1010
const browser = process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome');
1111

12+
// ignore https errors due to self-signed certificate from plugin-basic-ssl
13+
// https://playwright.dev/docs/api/class-browser#browser-new-context-option-ignore-https-errors
14+
// https://webdriver.io/docs/configuration/#strictssl and acceptInsecureCerts in https://webdriver.io/docs/api/browser/#properties
15+
const providerOptions = (function () {
16+
switch (provider) {
17+
case 'playwright': return { page: { ignoreHTTPSErrors: true } }
18+
case 'webdriverio': return { strictSSL: false, capabilities: { acceptInsecureCerts: true } }
19+
}
20+
})()
21+
1222
export default defineConfig({
1323
plugins: [
1424
!!process.env.TEST_HTTPS && basicSsl(),
@@ -18,6 +28,7 @@ export default defineConfig({
1828
enabled: true,
1929
provider,
2030
name: browser,
31+
providerOptions,
2132
},
2233
},
2334
// separate cacheDir from test/browser/vite.config.ts

test/browser/specs/server-url.test.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ test('server-url http', async () => {
1313
assert.match(result.stdout, /Test Files {2}1 passed/)
1414
})
1515

16-
// this test is skipped since browser warns self-signed https and it requires manual interaction.
17-
// you can toggle "skip" to verify it locally.
18-
test('server-url https', { skip: true }, async () => {
19-
const result = await execa('npx', ['vitest', 'run', '--root=./fixtures/server-url'], {
16+
test('server-url https', async () => {
17+
const result = await execa('npx', ['vitest', 'run', '--root=./fixtures/server-url', '--browser.headless'], {
2018
env: {
19+
CI: '1',
2120
NO_COLOR: '1',
2221
TEST_HTTPS: '1',
2322
},

0 commit comments

Comments
 (0)