mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
27 lines
840 B
TypeScript
27 lines
840 B
TypeScript
import { test, expect } from '../playwright.extend'
|
|
import { StatusCodeColor } from '../../../src/core/utils/logging/getStatusCodeColor'
|
|
import { waitFor } from '../../support/waitFor'
|
|
|
|
test('prints the intercepted request info into browser console', async ({
|
|
loadExample,
|
|
spyOnConsole,
|
|
fetch,
|
|
}) => {
|
|
const consoleSpy = spyOnConsole()
|
|
await loadExample(new URL('./basic.mocks.ts', import.meta.url))
|
|
|
|
await fetch('https://example.com/users/octocat')
|
|
|
|
await waitFor(() => {
|
|
expect(consoleSpy.get('raw')!.get('startGroupCollapsed')).toEqual(
|
|
expect.arrayContaining([
|
|
expect.stringMatching(
|
|
new RegExp(
|
|
`^\\[MSW\\] \\d{2}:\\d{2}:\\d{2} GET https://example.com/users/octocat \\(%c200 OK%c\\) color:${StatusCodeColor.Success} color:inherit$`,
|
|
),
|
|
),
|
|
]),
|
|
)
|
|
})
|
|
})
|