microsoft / PowerApps-TestEngine

MIT License
93 stars 28 forks source link

'Selected.Value', 'SelectedText.Value' isn't recognized inside the Assert Function. #315

Closed shrutirani15 closed 7 months ago

shrutirani15 commented 8 months ago

Description: Created some test suites in Power Apps Test Studio, downloaded the Test Suites(YAML Files) and running it through Power Apps Test Engine. Some keywords/properties inside Assert function are not being recognized and throwing exception while the running the Test Suites. *Note:** Same test suites and functions are working in Test Studio without any error.

Actual Result: Codes we are using: _Assert(MandatoryFieldsDrop.SelectedText.Value ="Not Available","Actual Result: Not Available Option is not selected");__

SetProperty(MandatoryFieldsDrop.Selected, Blank()); Assert(IsBlank(MandatoryFieldsDrop.SelectedText.Value),"Actual Result: Dropdown option is not blank");

SetProperty(partiallyDeniedDrop.Selected, {Value:"Yes"}); If(partiallyDeniedDrop.Selected.Value = "Yes","Yes option is selected", Error("Test case failed: Expected 'Yes'"));

Debug Log 1:

Running OnTestCaseStart for test case: To verify Review dropdown


Executing Screenshot function.

Successfully finished executing Screenshot function.


Executing SetProperty function.

Successfully finished executing SetProperty function.

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

System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Errors: Error 32-38: Name isn't valid. 'Value' isn't recognized. Error 39-40: Incompatible types for comparison. These types can't be compared: Error, Text. at Microsoft.PowerFx.CheckResult.ThrowOnErrors() at Microsoft.PowerFx.RecalcEngine.d20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.PowerFx.RecalcEngine.d18.MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.PowerApps.TestEngine.PowerFx.PowerFxEngine.Execute(String testSteps, CultureInfo culture) at Microsoft.PowerApps.TestEngine.PowerFx.PowerFxEngine.d14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.PowerApps.TestEngine.SingleTestRunner.d26.MoveNext()

Debug Log 2:

Running OnTestCaseStart for test case: To verify Status dropdown

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

System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Errors: Error 33-46: Name isn't valid. 'SelectedText' isn't recognized. Error 46-52: Invalid use of '.' Error 8-53: The function 'IsBlank' has some invalid arguments. at Microsoft.PowerFx.CheckResult.ThrowOnErrors() at Microsoft.PowerFx.RecalcEngine.d20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.PowerFx.RecalcEngine.d18.MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.PowerApps.TestEngine.PowerFx.PowerFxEngine.Execute(String testSteps, CultureInfo culture) at Microsoft.PowerApps.TestEngine.PowerFx.PowerFxEngine.d14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.PowerApps.TestEngine.SingleTestRunner.d26.MoveNext()

- How to use 'Assert' to verify and validate the results? or how to resolve above issues.

@landonarogers

landonmsft commented 7 months ago

Hey, @shrutirani15! Thanks for submitting your question. Not everything that is supported in Test Studio is supported in Test Engine. For example, Blank(), If(), and Error() are not necessarily supported. You also may have to modify what the expected return message is, to what Test Engine says it's actually receiving, as it may be different. Here's a link to the currently supported functions: https://github.com/microsoft/PowerApps-TestEngine/tree/main/docs/PowerFX . Thanks!