Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arexms opened this issue Dec 29, 2022 · 5 comments
Open

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

arexms opened this issue Dec 29, 2022 · 5 comments

Comments

@arexms
Copy link

arexms commented Dec 29, 2022

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
Copy link

tcspras commented Jun 7, 2023

Hi, Any updates on this issue, please?

@arexms
Copy link
Author

arexms commented Jun 7, 2023

Unfortunatelly not from my side :/

@CesarCalvoCobo
Copy link

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:

  • In RunTestAutomation.cs and OnLineLogin.cs : Reference.Login.MainPage, which was using //div[contains(@Class,"home-page-component")]. I switched to //div[@id='ppuxOfficeHeaderSearchBox_container'] which is working for me now.
  • In RunTestAutomation.cs and OnLineLogin.cs too : By.ClassName("apps-list"), which I updated by creating a new property in ElementReference.cs called Login_AppsList pointing to "//div[@aria-label='Your apps']".

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
Copy link

29ema commented Oct 8, 2023

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

@leeleeleeleeleeleelee
Copy link

leeleeleeleeleeleelee commented Feb 27, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants