XRM-OSS/D365-UI-Test

Add Support for Connecting to an Existing Browser in Playwright Tests

Opened this issue · 1 comments

In our tests, we have a requirement to connect to an existing browser instance. This is particularly useful when we need to maintain the session state across multiple tests, especially in scenarios where manual intervention is required (like entering a pin for an SSL certificate).

Currently, we're using the playwright.chromium.connectOverCDP() method to connect to an existing Chromium-based browser (Microsoft Edge) that's already running with remote debugging enabled:

beforeAll(async() => {
    jest.setTimeout(60000);
    browser = await playwright.chromium.connectOverCDP('http://localhost:9223');  
});

However, we believe it would be beneficial to have built-in support for this functionality in the d365-ui-test library. This could potentially be implemented as an option in the XrmUiTest constructor or as a separate method.

We're looking forward to your thoughts on this. Any help or guidance would be greatly appreciated.

HI @harryepstein,

sounds like a good use case, I would be willing to add it.

Is all that is needed a CDP URL that we use for populating the browser property via the connectOverCDP call?

That would be fairly easy to add. Would have to check whether the other browser have support for that as well.

Kind regards,
Florian