microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
521 stars 288 forks source link

[BUG] < xrmApp.Entity.SubGrid.OpenSubGridRecord("subgridname",1) is not working> #1290

Open bhaskarsamudrala opened 2 years ago

bhaskarsamudrala commented 2 years ago

Bug Report

EasyRepro Version

UCI or Classic Web

Online or On Premise

Browser

Code to reproduce


xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

xrmApp.Navigation.OpenApp(XXXXX);

xrmApp.Navigation.OpenSubArea("YYYY", "ZZZZZ");
 xrmApp.Grid.OpenRecord(0);
   xrmApp.Entity.SubGrid.OpenSubGridRecord("Applicants",1 );```
 -->

**Expected behavior**  
 It should open the record 1 in subgrid.

**Screenshots**  
<!-- You are encouraged to add screenshots to help diagnose your problem. -->

**Additional context**  
<!-- Add any other context about the issue or things you've already tried here. -->
jdpottle commented 2 years ago

I had this same bug, but I came up with a workaround that might work for you while we wait to get it fixed. I added these lines to my code to override the values in Microsoft.Dynamics365.UIAutomation.Api.UCI\DTO\AppElementReference.cs

AppElements.Xpath["Grid_Rows"]= "//div[@ref='centerContainer']//div[@role='rowgroup']//div[contains(@role,'row')]";
AppElements.Xpath["Entity_SubGrid_Row"] = "//div[@ref='centerContainer']//div[@role='rowgroup']//div[@row-index=\'[INDEX]\']";
AppElements.Xpath["Entity_SubGridList"] = "//div[@data-id='[NAME]-pcf_grid_control_container']//div[@ref='centerContainer']//div[@role='rowgroup']//div[@role='row']";
bhaskarsamudrala commented 2 years ago

Thank you very much. Looking forward to have fix from the team. How did you overRide the code, any code snippets help me.

jdpottle commented 2 years ago

You add the lines above to any test method where you use the xrmApp.Entity.SubGrid method.

There may be a better place to put those lines so they work for any test method, but I'm not sure where

Shakevg commented 2 years ago

Thank you very much. Looking forward to have fix from the team. How did you overRide the code, any code snippets help me.

You should add this code to any Init method depend on you test Framework. For MSTEST: AssemblyInitialize (it is the best), ClassInitialize, TestInitialize

Sumit4039 commented 1 year ago

@jdpottle , Given solution is not working for me. Can you explain me a bit in detail where to apply above code ? I have used in Test function but was not working.

Sumit4039 commented 1 year ago

I had this same bug, but I came up with a workaround that might work for you while we wait to get it fixed. I added these lines to my code to override the values in Microsoft.Dynamics365.UIAutomation.Api.UCI\DTO\AppElementReference.cs

AppElements.Xpath["Grid_Rows"]= "//div[@ref='centerContainer']//div[@role='rowgroup']//div[contains(@role,'row')]";
AppElements.Xpath["Entity_SubGrid_Row"] = "//div[@ref='centerContainer']//div[@role='rowgroup']//div[@row-index=\'[INDEX]\']";
AppElements.Xpath["Entity_SubGridList"] = "//div[@data-id='[NAME]-pcf_grid_control_container']//div[@ref='centerContainer']//div[@role='rowgroup']//div[@role='row']";

Not working for me, can you check again ?