XRM-OSS / D365-UI-Test

An unopinionated UI testing library for Dynamics 365 CE and Dynamics Portals. Powered by TypeScript and playwright
https://xrm-oss.github.io/D365-UI-Test/
MIT License
60 stars 15 forks source link

Add Support for Connecting to an Existing Browser in Playwright Tests #53

Open harryepstein opened 10 months ago

harryepstein commented 10 months ago

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.

DigitalFlow commented 9 months ago

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