microsoft / PowerApps-TestEngine

MIT License
93 stars 28 forks source link

Yaml credentials not working #266

Closed arpalmares closed 12 months ago

arpalmares commented 1 year ago

To Reproduce

Steps to reproduce the behavior:

  1. Used sample "basicgallery". Imported to environment.
  2. Account used has MFA disabled. Also set as owner to the app.
  3. Setup config.dev.json with proper values for environmentId, tenantId, testPlanFile and outputDirectory.
  4. Setup credentials in testPlanFile.
  5. dotnet run -l trace

Expected Behavior: Run Tests with success
Actual Behavior: Test ran with failure. Looks like it did not log in.

image

NavneetThekkumpat commented 1 year ago

Can you check the debuglogs within the test results folder 0b03a5 and paste here what the error is?

arpalmares commented 1 year ago

System.InvalidOperationException: Operation is not valid due to the current state of the object. at Microsoft.PowerApps.TestEngine.Users.UserManager.LoginAsUserAsync(String desiredUrl) in E:\repo\testengine\PowerApps-TestEngine\src\Microsoft.PowerApps.TestEngine\Users\UserManager.cs:line 80 at Microsoft.PowerApps.TestEngine.SingleTestRunner.RunTestAsync(String testRunId, String testRunDirectory, TestSuiteDefinition testSuiteDefinition, BrowserConfiguration browserConfig, String domain, String queryParams, CultureInfo locale) in E:\repo\testengine\PowerApps-TestEngine\src\Microsoft.PowerApps.TestEngine\SingleTestRunner.cs:line 119

NavneetThekkumpat commented 1 year ago

@arpalmares : Thank you, can you paste the full debuglogs here. Looks like this exception is thrown @ \UserManager.cs:line 80 when User email cannot be null . Can you confirm if it logs the same, if so please confirm or check if the username was set properly.

arpalmares commented 1 year ago

Username and password was populated. Account has MFA disabled and works when used manually.

arpalmares commented 1 year ago

RUNNING TEST SUITE: Basic Gallery

Browser configuration: {"Browser":"Chromium","Device":null,"ScreenWidth":null,"ScreenHeight":null,"ConfigName":null}

Browser setup finished

Browser context created

Test infrastructure setup finished

Desired URL: https://apps.powerapps.com/play/e/0f27908d-8a03-434e-a8f5-80e7230b5a9e/an/new_galleryapp_80360?tenantId=e0793d39-0939-496d-b129-198edd916feb&source=testengine

Successfully navigated to target URL

[Error]: User email cannot be null

[Error]: Encountered an error. See the debug log for this test suite for more information.

Test suite summary Total cases: 1 Cases passed: 0 Cases failed: 1

System.InvalidOperationException: Operation is not valid due to the current state of the object. at Microsoft.PowerApps.TestEngine.Users.UserManager.LoginAsUserAsync(String desiredUrl) in E:\repo\testengine\PowerApps-TestEngine\src\Microsoft.PowerApps.TestEngine\Users\UserManager.cs:line 80 at Microsoft.PowerApps.TestEngine.SingleTestRunner.RunTestAsync(String testRunId, String testRunDirectory, TestSuiteDefinition testSuiteDefinition, BrowserConfiguration browserConfig, String domain, String queryParams, CultureInfo locale) in E:\repo\testengine\PowerApps-TestEngine\src\Microsoft.PowerApps.TestEngine\SingleTestRunner.cs:line 119

arpalmares commented 1 year ago

basicgallery testPlan.fx.yaml was updated with email and password in this section.

image

Am I missing anything?

NavneetThekkumpat commented 12 months ago

basicgallery testPlan.fx.yaml was updated with email and password in this section.

image

Am I missing anything?

@arpalmares Setting the values here is not supported. Please set user1Password and user1Email environment variables to the values here and then try running TestEngine again. That is the supported way of running TestEngine.

arpalmares commented 12 months ago

I get it now. PS environment variables. Thank you.

NavneetThekkumpat commented 12 months ago

Closing this issue since it is resolved now. Thank you

arpavan commented 10 months ago

Adding this here just in case anyone else runs into this. The testSettings section of the test plan file expects the name of the environment variable used for setting the credential values, and not the credentials themselves.

Here's the section from the documentation that explains how the credentials need to be setup - https://github.com/microsoft/PowerApps-TestEngine#set-up-user-authentication