microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
514 stars 286 forks source link

Get grid items not working in case more than one grid is on the page #156

Closed MDendura closed 5 years ago

MDendura commented 6 years ago

Related to #113, but that's marked as closed so I'm recreating here with more details.

It would be useful to be able to select a subgrid from the form by name, as I'm facing the same problem on the default System User form.

Here's the form I'm testing with: systemuser form

You can see there's a couple of subgrids on this form.

And here's the code from one of my tests:

[TestMethod]
public void Verify_UserQueues()
{
    using (var xrmBrowser = new Browser(BrowserOptions))
    {
        xrmBrowser.Navigation.OpenSubArea("Settings", "Security", 1000);

        xrmBrowser.Administration.OpenFeature("Users");

        xrmBrowser.Grid.Search("Matt Dendura");

        xrmBrowser.Grid.OpenRecord(0, 1000);

        xrmBrowser.Entity.SelectSubgridLookup("PrivateQueuesSubGrid");

        // BUG: This next line gets me back items from the teams grid, rather than the queues one.
        IEnumerable<string> queueNames = xrmBrowser.Grid.GetGridItems().Value.Select(q => q.GetAttribute<string>("name")).ToList();

        CollectionAssert.AreEquivalent(queueNames, this.ExpectedQueues);
    }
}

Perhaps there is a way to select the queues subgrid by name that I have missed.

EDIT: Also worth nothing that I'm testing against Dynamics 365 Online Version 1612 (9.0.2.449) (DB 9.0.2.438)

TYLEROL commented 5 years ago

@MDendura - From reviewing the scenario and our underlying code, this is a feature gap in the current design. The GetGridItems() method being used functions under the scope of an entity grid and not for use with subgrids on a form.

I'll add an item to our backlog to add an overload method that could be utilized in subgrid scenarios. In the meantime, you could try using the RelatedGrid navigation options and pull data using GetGridItems from there (since that should adjust the information pane to only display the desired related grid items).

Best Regards, Tyler