microsoft / PowerApps-TestEngine

MIT License
98 stars 29 forks source link

Cant SetProperty for ComboBox #244

Closed leodatavinci closed 11 months ago

leodatavinci commented 1 year ago

So our app has a Combo box were the inserted value in the combobox control cannot be be saved in Dataverse. Specifically, after using the SetProperty PowerFx method and inserting the value in the combo box, power apps still regards the combobox to be empty when clicking the next button which checks for the required fields. This also happens if I simulate this manually. In order for dataverse to be updated with the value in the Combobox, the user would have to explicitly select it first in the dropdown. With other words it is not enough to just write the value into the Combobox, you have to write in the value first, the filtered drop down will open and the according record has to be selected. Also when using a Selected PowerFx Method after the value is inserted into the ComboBox is used on the ComboBox it still regards the ComboBox to be empty.

PowerFX steps:

= Select('btn_StartAssessment'); SetProperty('cmb_BusinessSponsor'.SelectedItems, Table({'Id':"9bd6ffd3-2b5d-433f-b385-06676e0a063a",'AccountEnabled':"Faatimah Leonard",'BusinessPhones':Table(),'City':"Waterford Precinct, Century City",'CompanyName':"XXXX",'Country':"South Africa",'Department':"XXXXX",'DisplayName':"Person Name",'GivenName':"Person First Name",'JobTitle':"Civil Engineer",'Mail':"XXXX",'MailNickname':"Faatimah.Leonard",'mobilePhone':Blank(),'OfficeLocation':"Cape Town",'PostalCode':"7441",'Surname':"Person Last Name",'TelephoneNumber':Blank(),'UserPrincipalName':'Person Email"})); Select('cmb_BusinessSponsor'); Select('btn_Next_Technical');

Unfortunately, I am limited to share any details like screenshots and all the input data due to confidentiality reasons. Is anyone aware of issues with the SetProperty() PowerFx Method for ComboBoxes and are there any ways to resolve this?

NavneetThekkumpat commented 1 year ago

@leodatavinci : Okay, it looks like you have wrong syntax in the above mentioned SetProperty function near the closing statement ( 'UserPrincipalName':'Person Email"}));) . Please change that single quote to double quote and try running testengine again.

SetProperty('cmb_BusinessSponsor'.SelectedItems, Table({'Id':"9bd6ffd3-2b5d-433f-b385-06676e0a063a",'AccountEnabled':"Faatimah Leonard",'BusinessPhones':Table(),'City':"Waterford Precinct, Century City",'CompanyName':"XXXX",'Country':"South Africa",'Department':"XXXXX",'DisplayName':"Person Name",'GivenName':"Person First Name",'JobTitle':"Civil Engineer",'Mail':"XXXX",'MailNickname':"Faatimah.Leonard",'mobilePhone':Blank(),'OfficeLocation':"Cape Town",'PostalCode':"7441",'Surname':"Person Last Name",'TelephoneNumber':Blank(),'UserPrincipalName':" Person Email"}));

leodatavinci commented 1 year ago

I have done that and confirm that it still doesnt work.

NavneetThekkumpat commented 1 year ago

@leodatavinci Okay it could be that you are missing the Value field in the combobox setProperty teststep. Documentation on the test studio setproperty (https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-setproperty ).

image

Can you try adding Value field in the Table for the setProperty test step?

NavneetThekkumpat commented 11 months ago

@leodatavinci from our email conversation, it looks like Setproperty on combobox works with dataverse table value.

And regarding Setproperty on combobox with Azure AD connector value for the below scenario SetProperty('cmb_BusinessSponsor'.SelectedItems,

Table({'Id':"9bd6ffd3-2b5d-433f-b385-06676e0a063a",**
'AccountEnabled':"Faatimah Leonard",'BusinessPhones':Table(),
'City':"Waterford Precinct, Century City",'CompanyName':"XXXX",'Country':"South Africa",
'Department':"XXXXX",'DisplayName':"Person Name",
'GivenName':"Person First Name",'JobTitle':"Civil Engineer",
'Mail':"XXXX",'MailNickname':"Faatimah.Leonard",
'mobilePhone':Blank(),'OfficeLocation':"Cape Town",
'PostalCode':"7441",'Surname':"Person Last Name",
'TelephoneNumber':Blank(),'UserPrincipalName':" Person Email"})

);

Please make sure that the Table passed here matches field in the value set in Items property of cmb_BusinessSponsor ComboBox. As long as we use a record that is present in the table set in Items property of ComboBox, SetProperty will work fine irrespective of the connectors used.

Let me know if the issue still persists. Aware of this https://github.com/microsoft/PowerApps-TestEngine/issues/250 enhancement for future. With that closing this issue, but feel free to reopen if more assistance needed.