microsoft / EasyRepro

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

Getting sign-in error when we are running automation tests #1332

Open VictoriaB81 opened 1 year ago

VictoriaB81 commented 1 year ago

UCI or Classic Web

Online or On Premise

Browser Chrome

Issue Description: We are using EasyRepro framework with C# selenium in our solution to automate test cases. We run the tests in Azure pipeline. We are running our automation scripts on Windows parallel installed on MAC machine. When we are running automation tests we are getting below sign in error. If we clear the cache in the chrome browser, we are able to sign-in and tests are running fine. Most of the time we are facing this issue and it is blocker for us. It is happening frequently. Manually we are able to login to D365 application in Service account. It was working fine for past one month through automation.
From past 2 days we are getting sign error and it is happening frequently. It is an intermittent issue. Sometimes if we clear the cache in the chrome browser, we are able to sign-in and tests are running fine in automation mode But now even after clearing the chrome browser cache, we are getting the sign in issue. I cannot reproduce the issue manually or when DEBUG the test. The error appears only in the RUN mode of the test through automation.

Steps to reproduce:

  1. Navigate to https://zuoracpqtest.crm.dynamics.com
  2. Enter the username  zuoracpqauto@zuoracloudeng.onmicrosoft.com
  3. Enter the password.
  4. Click on Sign-in button. Actual Result: It is showing sign-in error page. Expected Result: After sign-in it has to navigated to 3 screens (Next, Skip MFA and Stay Signed In screens) before it lands in Dynamic 365 Apps page.

Dynamics 365 Organization URL : https://zuoracpqtest.crm.dynamics.com Username: zuoracpqauto@zuoracloudeng.onmicrosoft.com This is a service account for Dynamics 365 application. We have given the option to skip MFA.

Code to reproduce

WebClient.cs

private static void EnterPassword(IWebDriver driver, SecureString password) { var input = driver.FindElement(By.XPath(Elements.Xpath[Reference.Login.LoginPassword])); input.SendKeys(password.ToUnsecureString()); input.Submit(); }

TC01_MVP_ValidateZuoraNewButtonTests.cs

 public void TC01_ValidateNewZuoraQuoteButton(String accntName, String primaryContactName, String billToContactName, String soldToContactName)
    {
        var client = new WebClient(TestSettings.Options);
        using (var xrmApp = new XrmApp(client))
        {
            var datetime = xrmApp.ZuoraCPQFeature_Call.GetDateTime();
           // var date =xrmApp.Z

            xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

            xrmApp.Navigation.OpenApp(UCIAppName.Sales);

            xrmApp.Navigation.OpenSubArea("Accounts");

Expected behavior

After sign-in it has to navigated to 3 screens (Next, Skip MFA and Stay Signed In screens) before it lands in Dynamic 365 Apps page.

Screenshots

Screenshot 2022-09-30 at 12 28 18 PM Next page skip_setup staySignedIn

Additional context
Sometimes after restarting or clearing the chrome browser cache, we were able to sign in through automation mode.