microsoft / EasyRepro

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

How to open a record on a subgrid using easyrepro? #178

Open darthtang opened 6 years ago

darthtang commented 6 years ago

i am using dynamics365 version 9.x

Using easyrepro i can navigate into an account via the global search and then also use the "xrmBrowser.Entity.ClickSubgridAddButton("foobar");" function to create a new record of that 'foobar' type. By doing this i know i am accessing the correct subgrid on the account record.

My question is....which function would i use to simply open up the record i have created. I have tried SelectSubgridLookup but i dont think that is the function i am looking for.

image From the image you can see i have created the 'bonno bonno' contact but i cannot open the record using easyrepro. any help would be greatly appreciated! :)

TYLEROL commented 5 years ago

Hello @darthtang - sorry for the delayed reply to your post here. From reviewing, it appears this is a feature gap and needs to be enhanced.

While not ideal, if you wanted to open the record, you could try the following instead:

xrmBrowser.Entity.ClickSubgridGridViewButton(subgridName)

This should take you to the 'Associated View' via Related Navigation. From here, you could call:

optional: xrmbrowser.Related.Search(contactrecordname);
xrmBrowser.Related.OpenGridRow(#)

At this point, you could then switch back to perform actions on the opened Contact entity record:

xrmBrowser.Entity.SomeMethod();

Please let me know if this set of steps help you with your scenario. I've added a feature enhancement to the backlog to allow opening of a record from a subgrid on a form.

Best Regards, Tyler

kamranRehman commented 5 years ago

Hi Tyler,

This even not working xrmBrowser.Entity.ClickSubgridGridViewButton(subgridName) exception gets generated, right now I don't have that exception details with me.

Instead I've done the following to move forward.

xrmBrowser.Navigation.OpenRelated("ABC"); xrmBrowser.Related.SwitchView("XYZ",4000); xrmBrowser.Driver.WaitForPageToLoad(); List allergies = xrmBrowser.Related.GetGridItems();

and match the content of each field with the desired output.

looks like system needs to allow to open a RECORD from a subgrid and also should allow to read the column values from a subgrid.

Thanks.

hasinthanagodavithana commented 5 years ago

I am having the same issue and in my scenario I cannot use the OpenRelated() as the related entities menu option removed form the sitemap. The only possible way is to use xpath and navigate thorough the list.

var dataTable = xrmBrowser.Driver.FindElement(By.Id("Appointments_divDataArea")); var recordList = dataTable.FindElements(By.ClassName("ms-crm-List-Data"));

please let me know if you guys found a better way.

darthtang commented 5 years ago

This could be a related issue->fix via@markcunninghamuk https://github.com/Microsoft/EasyRepro/pull/403

sergiodegrazia commented 5 years ago

Hi all,

I am experiencing this issue when trying to interact with a Lookup View. I can enter the Lookup overlay and select/deselect the items but I am not actually able to click on them to navigate to the related record.

xrmBrowser.Entity.ClickSubgridAddButton("Repairs"); //Selecting the 'Add' button in Subgrid xrmBrowser.Entity.SelectSubgridLookup("Repairs", true); //Selecting the 'View More Records' button in the dropdown xrmBrowser.Lookup.SelectItem(0); //Selecting the first item in the Lookup view xrmBrowser.Lookup.Cancel(); //Closing the Lookup view

It would be awesome to have something like: xrmBrowser.Lookup.OpenGridRow(1);

I think that would solve both our issues.

Thanks!