Skip to content

Why does my local MSW handler not override the global handler in Playwright tests? #26

@daniel-kfir-sage

Description

@daniel-kfir-sage

I'm trying to intercept a call -
i have this setup:
Fixture
import { type Page, test as baseTest } from '@playwright/test'; const testPages = baseTest.extend<POMpages>({ network: createNetworkFixture({ initialHandlers: handlers, }), export const test = testPages;

this is my global intercept method: http.get(*/objects/:tableName, ({ params, request }) => {

and in my local test
network.use( http.get('/v1/objects/actual', () => { return HttpResponse.json({}, { status: 201 }); }), );

I am getting to the global handler method instead of my local one - why is that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions