Skip to content

[Feature]: Harden playwright against core object manipulation #34328

Open
@hakito

Description

🚀 Feature Request

We have a situation, where we have to test a System, that replaces the core Map with some other object.

function Map()
{
  // some custom map stuff
}

Map.prototype.customMethod = function ...

Playwright crashes because it also relies on the Map object.

My proposal would be to make copies/references for the core objects and work with them within playwright.

Example

It would be also great to provide the core objects for own javascript calls:

browserContext.ProvideCoreObjectsAs("coreObjects");

And access them in for example in an init script:

myMap = new globalThis.coreObjects.Map()

Motivation

We have no option to get rid of this replacement by the external library. Our current (dirty) workaround is to inject a route, that overwrites the map replacement with another one that is compatible for playwright and the target application.

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