microsoft / PowerAppsTestAutomation

MIT License
63 stars 677 forks source link

System.Exception: Login page failed using Cloud Identity Login. #25

Open arexms opened 1 year ago

arexms commented 1 year ago

Hello,

I'm trying to automate my canvas app tests I followed instruction from here: https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/test-studio-classic-pipeline-editor Unfortunatelly I got error during execution of 'Run Power Apps Test Automation Tests via Firefox': (same issue is visible for Chrome)

A total of 1 test files matched the specified pattern.
  Failed RunTestAutomation [7 m 32 s]
  Error Message:
   Test method Microsoft.PowerApps.TestAutomation.Tests.TestAutomation.RunTestAutomation threw exception: 
System.InvalidOperationException: Login failed after 3 attempts. Exception Details: System.Exception: Login page failed using Cloud Identity Login.
   at Microsoft.PowerApps.TestAutomation.Api.OnlineLogin.<>c.<Login>b__12_3(IWebDriver f) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Api\Pages\OnlineLogin.cs:line 160
   at Microsoft.PowerApps.TestAutomation.Browser.SeleniumExtensions.WaitUntilVisible(IWebDriver driver, By by, TimeSpan timeout, Action`1 successCallback, Action`1 failureCallback) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\Extensions\SeleniumExtensions.cs:line 737
   at Microsoft.PowerApps.TestAutomation.Api.OnlineLogin.Login(IWebDriver driver, Uri uri, SecureString username, SecureString password, Action`1 redirectAction) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Api\Pages\OnlineLogin.cs:line 141
   at Microsoft.PowerApps.TestAutomation.Browser.DelegateBrowserCommand`5.ExecuteCommand(IWebDriver driver, Object[] params) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\DelegateBrowserCommand.cs:line 134
   at Microsoft.PowerApps.TestAutomation.Browser.BrowserCommand`1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\BrowserCommand.cs:line 136
   at Microsoft.PowerApps.TestAutomation.Browser.BrowserCommand`1.Execute[T1,T2,T3,T4](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\BrowserCommand.cs:line 60
   at Microsoft.PowerApps.TestAutomation.Browser.BrowserPage.Execute[TResult,T1,T2,T3,T4](BrowserCommandOptions options, Func`6 delegate, T1 p1, T2 p2, T3 p3, T4 p4) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\BrowserPage.cs:line 230
   at Microsoft.PowerApps.TestAutomation.Api.OnlineLogin.Login(Uri uri, SecureString username, SecureString password) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Api\Pages\OnlineLogin.cs:line 73
   at Microsoft.PowerApps.TestAutomation.Tests.TestAutomation.RunTestAutomation() in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Tests\TestAutomation\RunTestAutomation.cs:line 113
  Stack Trace:
      at Microsoft.PowerApps.TestAutomation.Tests.TestAutomation.RunTestAutomation() in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Tests\TestAutomation\RunTestAutomation.cs:line 189
  Standard Output Messages:
 Login.MainPage failed to load in 2 minutes using Cloud Identity Login.
 Exception on Attempt #1: System.Exception: Login page failed using Cloud Identity Login.
    at Microsoft.PowerApps.TestAutomation.Api.OnlineLogin.<>c.<Login>b__12_3(IWebDriver f) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Api\Pages\OnlineLogin.cs:line 160
    at Microsoft.PowerApps.TestAutomation.Browser.SeleniumExtensions.WaitUntilVisible(IWebDriver driver, By by, TimeSpan timeout, Action`1 successCallback, Action`1 failureCallback) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\Extensions\SeleniumExtensions.cs:line 737
    at Microsoft.PowerApps.TestAutomation.Api.OnlineLogin.Login(IWebDriver driver, Uri uri, SecureString username, SecureString password, Action`1 redirectAction) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Api\Pages\OnlineLogin.cs:line 141
    at Microsoft.PowerApps.TestAutomation.Browser.DelegateBrowserCommand`5.ExecuteCommand(IWebDriver driver, Object[] params) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\DelegateBrowserCommand.cs:line 134
    at Microsoft.PowerApps.TestAutomation.Browser.BrowserCommand`1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\BrowserCommand.cs:line 136
    at Microsoft.PowerApps.TestAutomation.Browser.BrowserCommand`1.Execute[T1,T2,T3,T4](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\BrowserCommand.cs:line 60
    at Microsoft.PowerApps.TestAutomation.Browser.BrowserPage.Execute[TResult,T1,T2,T3,T4](BrowserCommandOptions options, Func`6 delegate, T1 p1, T2 p2, T3 p3, T4 p4) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Browser\BrowserPage.cs:line 230
    at Microsoft.PowerApps.TestAutomation.Api.OnlineLogin.Login(Uri uri, SecureString username, SecureString password) in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Api\Pages\OnlineLogin.cs:line 73
    at Microsoft.PowerApps.TestAutomation.Tests.TestAutomation.RunTestAutomation() in D:\a\1\s\Microsoft.PowerApps.TestAutomation.Tests\TestAutomation\RunTestAutomation.cs:line 113

I verified my credentials few time and it workd. Any hints where the problem is or what shall I check as a next step?

tcspras commented 1 year ago

Hi, Any updates on this issue, please?

arexms commented 1 year ago

Unfortunatelly not from my side :/

CesarCalvoCobo commented 1 year ago

Hi @arexms @tcspras , I needed to dive into these errors for a chapter in a book that I'm writing about utilizing this method. As the Power Apps homepage has recently changed,it seems to be breaking some of the xpath selectors. The two that were giving me issues were:

I also updated the framework to 4.8 to clear up other errors from the classic pipeline mode and some NuGet packages like Selenium . It's all working for me now following these fixes and they are simple to apply in your own fork. But you're welcome to check out my fork at https://github.com/CesarCalvoCobo/PowerAppsTestAutomation if it could be helpful. The core test logic where the Test Studio tests are applied seems more robust, and the only changes needed are caused by the changes in the power apps homepage.

29ema commented 11 months ago

@CesarCalvoCobo Thank you, this solution worked for me as well! :)

leeleeleeleeleeleelee commented 6 months ago

Hi @CesarCalvoCobo . I have used your repo (https://github.com/CesarCalvoCobo/PowerAppsTestAutomation/tree/master) successfully also to get past this issue shown above. I am however now getting an error:

An error occurred during Test Run #1 of 1: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.PowerApps.TestAutomation.Api.TestAutomation.ReportResultsToDevOps(JObject jObject, Int32 testRunNumber) in D:\a\1\s\PowerAppsTestAutomation\Microsoft.PowerApps.TestAutomation.Api\Pages\TestAutomation.cs:line 166 at Microsoft.PowerApps.TestAutomation.Tests.TestAutomation.RunTestAutomation() in D:\a\1\s\PowerAppsTestAutomation\Microsoft.PowerApps.TestAutomation.Tests\TestAutomation\RunTestAutomation.cs:line 178

TestAutomation.cs : if (testCaseResults.Success) RunTestAutomation.cs : var testResultCount = appBrowser.TestAutomation.ReportResultsToDevOps(testAutomationResults, testRunCounter);

Honestly, I don't know enough yet to resolve the issue, do you encounter the same issue?