Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/browser/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const RPC_ID: string
const METHOD = getBrowserState().method
export const ENTRY_URL: string = `${
location.protocol === 'https:' ? 'wss:' : 'ws:'
}//${HOST}/__vitest_browser_api__?type=${PAGE_TYPE}&rpcId=${RPC_ID}&sessionId=${getBrowserState().sessionId}&projectName=${getBrowserState().config.name || ''}&method=${METHOD}&token=${(window as any).VITEST_API_TOKEN || '0'}`
}//${HOST}/__vitest_browser_api__?type=${PAGE_TYPE}&rpcId=${RPC_ID}&sessionId=${getBrowserState().sessionId}&projectName=${encodeURIComponent(getBrowserState().config.name || '')}&method=${METHOD}&token=${(window as any).VITEST_API_TOKEN || '0'}`

const onCancelCallbacks: ((reason: CancelReason) => void)[] = []

Expand Down
5 changes: 5 additions & 0 deletions test/browser/fixtures/project-name-encoding/basic.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { expect, test } from 'vitest'

test('basic test', () => {
expect(true).toBe(true)
})
14 changes: 14 additions & 0 deletions test/browser/fixtures/project-name-encoding/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'vitest/config'
import { playwright } from '@vitest/browser-playwright'

export default defineConfig({
test: {
name: 'Components & Hooks',
browser: {
enabled: true,
provider: playwright(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (provider and instances) should be imported from ./utils, not hardcoded. They are assigned based on PROVIDER variable, so tests can run for both playwright and webdriverio

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay thank you for noticing:) i will fix it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: WebDriver Bidi command "session.subscribe" failed with error: invalid argument - browsingContext.navigationStarted is not a valid event name

The error appears when I try webdriverio PROVIDER in my local environment... any hint for it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's just in the log, ignore it

instances: [{ browser: 'chromium' }, { browser: 'firefox' }, { browser: 'webkit' }],
headless: true,
},
},
})
16 changes: 16 additions & 0 deletions test/browser/specs/project-name-encoding.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, test } from 'vitest'
import { instances, runBrowserTests } from './utils'

test('runs tests correctly when project name contains special characters', async () => {
const { stderr, stdout, exitCode, ctx } = await runBrowserTests({
root: './fixtures/project-name-encoding',
})

expect(stderr).toBe('')
expect(exitCode).toBe(0)

const projectName = ctx.config.name
instances.forEach(({ browser }) => {
expect(stdout).toReportPassedTest('basic.test.ts', `${projectName} (${browser})`)
})
})
Loading