Skip to content

Commit 376c85c

Browse files
committed
remove http mock command and skip http tests on WebdriverIO
1 parent 2c6baf3 commit 376c85c

File tree

3 files changed

+6
-58
lines changed

3 files changed

+6
-58
lines changed

packages/browser-webdriverio/src/commands/http.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

packages/browser-webdriverio/src/commands/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { click, dblClick, tripleClick } from './click'
33
import { dragAndDrop } from './dragAndDrop'
44
import { fill } from './fill'
55
import { hover } from './hover'
6-
import { http } from './http'
76
import { keyboard, keyboardCleanup } from './keyboard'
87
import { takeScreenshot } from './screenshot'
98
import { selectOptions } from './select'
@@ -28,5 +27,4 @@ export default {
2827
__vitest_hover: hover as typeof hover,
2928
__vitest_cleanup: keyboardCleanup as typeof keyboardCleanup,
3029
__vitest_viewport: viewport as typeof viewport,
31-
__vitest_http: http as typeof http,
3230
}

test/browser/test/http.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, test } from 'vitest'
1+
import { test as baseTest, expect } from 'vitest'
22
import { page, server } from 'vitest/browser'
33

44
const httpMethods = [
@@ -9,6 +9,9 @@ const httpMethods = [
99
{ method: 'DELETE' as const, url: '/api/route-delete', status: 200, body: { ok: true } },
1010
] as const
1111

12+
const skipWebdriver = server.provider === 'webdriverio'
13+
const test = baseTest.runIf(!skipWebdriver)
14+
1215
test.each(httpMethods)('fulfills mocked %s request', async (entry) => {
1316
const { method, url, body, status } = entry
1417
const methodName = method.toLowerCase() as Lowercase<typeof method>
@@ -59,8 +62,7 @@ test('fulfills mocked OPTIONS request', async () => {
5962
expect(response.headers.get('Allow')).toBe('GET, POST, OPTIONS')
6063
})
6164

62-
// For some reason, this test only works in Playwright
63-
test.runIf(server.provider === 'playwright')('fulfills mocked request with wildcard path', async () => {
65+
test('fulfills mocked request with wildcard path', async () => {
6466
await page.http.get('/api/products/*', () => {
6567
return new Response(JSON.stringify({ wildcard: true }), {
6668
status: 200,
@@ -73,8 +75,7 @@ test.runIf(server.provider === 'playwright')('fulfills mocked request with wildc
7375
expect(await simple.json()).toEqual({ wildcard: true })
7476
})
7577

76-
// For WebdriverIO, it uses URLPattern internally, and matching with RegExp does not work correctly, so this test is only run in Playwright
77-
test.runIf(server.provider === 'playwright')('fulfills mocked request with RegExp path', async () => {
78+
test('fulfills mocked request with RegExp path', async () => {
7879
await page.http.get(/\/api\/files\/(\d+)$/, () => {
7980
return new Response(JSON.stringify({ matched: true }), {
8081
status: 200,

0 commit comments

Comments
 (0)