microsoft / EasyRepro

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

[BUG] GetGridItems() returns 0 items in editable grid #766

Open aalad opened 4 years ago

aalad commented 4 years ago

Bug Report

Issues should only be created for items related to covered functionality.

Not covered functionality, feature requests, and questions should use the Feature Request or Question templates.

EasyRepro Version

UCI or Classic Web

Online or On Premise

Browser

Describe the bug
We recently switched to editable grids in unified interface for the Contact entity. Now, the function GetGridItems() always returns 0 items. In the classic grids, the function returns all items - setting aside BUG 758

Special formatting / display

Code to reproduce

public void MyGridTest()
{
    var client = new WebClient(TestSettings.Options);
    using (var xrmApp = new XrmApp(client))
    {
        xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _loginAction);
        xrmApp.Navigation.OpenApp(UCIAppName.MyApp);

        // Contacts uses editable grids
        xrmApp.Navigation.OpenSubArea("My CRM", "Contacts");
        var contacts = xrmApp.Grid.GetGridItems();    // contacts.Count == 0; 51 is expected

        // Account uses the "normal" grids
        xrmApp.Navigation.OpenSubArea("My CRM", "Accounts");
        var accounts = xrmApp.Grid.GetGridItems();   // accounts.Count == 16 
    }
}

Expected behavior
Calling GetGridItems() returns the correct amount of items, independently of which grid-type is used.

Screenshots

Additional context

aalad commented 2 years ago

The function GetGridItems() now throws a NoSuchElement Exception if used on an editable grid (Wave 2 2021). Same code as above, but with EasyRepro switched to tree "develop-2021ReleaseWave2"

OpenQA.Selenium.NoSuchElementException: 'no such element: Unable to locate element: {"method":"xpath","selector":"//div[contains(@data-lp-id, 'MscrmControls.Grid.PCFGridControl')]"}
  (Session info: chrome=95.0.4638.69)'

OpenQA.Selenium.NoSuchElementException
  HResult=0x80131500
  Message=no such element: Unable to locate element: {"method":"xpath","selector":"//div[contains(@data-lp-id, 'MscrmControls.Grid.PCFGridControl')]"}
  (Session info: chrome=95.0.4638.69)
  Source=Microsoft.Dynamics365.UIAutomation.Browser
  StackTrace:
   at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand`1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9) in U:\...\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 141