microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
513 stars 285 forks source link

How to resolve sing in pop up issue #1338

Open rohitjadhavmsft opened 1 year ago

rohitjadhavmsft commented 1 year ago

Question

I am getting follow screen while UI test is running for MDA. Here is the piece of code I use to sign in into dataverse environment and then launch MDA. Initial sing in session work fine but while test case is clicking through MDA suddenly another sign in pop up comes.

Here it is https://ibb.co/dBw7pbn

It looks like initial session is not maintained. Can you confirm is if I need to update any driver or use different method to sign in.

       ```
         var client = DataverseTestUtilities.GetWebClient();
        using (var xrmApp = new XrmApp(client))
        {
            DataverseTestUtilities.LoginToDynamicsPowerAppsAsAdmin(xrmApp);

            DataverseTestUtilities.WaitForXSeconds(xrmApp, 10000);

            xrmApp.Navigation.OpenApp("Remote Assist"); // Open MDA App
            DataverseTestUtilities.WaitForXSeconds(xrmApp, 10000);

            xrmApp.Navigation.OpenSubArea("Content", "One-time Call"); // navigation in MDA

           // at this point, above sing in pop up shows up. https://ibb.co/dBw7pbn

Here is the pop up https://ibb.co/dBw7pbn
Shakevg commented 1 year ago

@rohitjadhavmsft Did you try https://github.com/microsoft/EasyRepro/issues/1320#issuecomment-1248775349 ?

rohitjadhavmsft commented 1 year ago

Yes, that is helping but I have to manually enable the third-party cookie on the chrome instance created by Ui test. I am looking for ways to set it programmatically. I came across var CookieСontrolsMode

and by setting it to 0 didnt help. Here is what I intend to do.

` var client = DataverseTestUtilities.GetWebClient(); using (var xrmApp = new XrmApp(client)) { DataverseTestUtilities.LoginToDynamicsPowerAppsAsAdmin(xrmApp);

            xrmApp.Navigation.OpenApp("Remote Assist");

            xrmApp.Navigation.OpenSubArea("Content", "One-time Call");
            DataverseTestUtilities.WaitForASecond(xrmApp);

            client.Browser.Options.CookieСontrolsMode = 0; // This does not help. 
             // Find a way to set 'Allow all cookies' option on chrome instance automatically.

            var seleniumWebDriver = client.Browser.Driver;`
Shakevg commented 1 year ago

rohitjadhavmsft Did I correctly understand the set CookieСontrolsMode = 0 is not enabled third-party cookie? This is mean that google changes this option in the latest version and needs to investigate what new option should be changed, then update the EasyRepro code or use your options to create a chrome driver instance. Steps described here https://stackoverflow.com/a/65007362/8951897