Automated testing support for FlexGrid .Net5 datagrid -- missing row presenters

Posted by: arajendran on 17 November 2021, 4:56 pm EST

    • Post Options:
    • Link

    Posted 17 November 2021, 4:56 pm EST - Updated 4 October 2022, 8:32 am EST

    We are moving from the Component1 grid to the FlexGrid .Net5 datagrid and we’ve run into issues updating our UI automated tests. There are no row presenters anymore. Right now, the UI map shows a flat collection of cells.

    Some of our initialization code:

    public TableView(Application application = null, int index = 0) : base(application, PaneOrViewType.TableView, index)
        {
          Table = PaneOrView.FindElementByAccessibilityId("_tableControl");
          TableToolbar = PaneOrView.FindElementByAccessibilityId("_tableToolbar");
          StatusControl = PaneOrView.FindElementByAccessibilityId("_statusControl");
          TableGrid = Table.FindElementByClassName("DataGridRowsPanel");
    	  // This returns the datagrid
          DataGrid = PaneOrView.FindElementByAccessibilityId("_tableDataGrid");
          }
    

    We use the datagrid to get a row by index:

    public AppiumWebElement GetRowByIndex(int rowIndex)
        {
          var selectedRow = DataGrid.VerticalScrollPercent() <= 0.0 ?
            DataGrid.FindElementsByClassName("DataGridRowPresenter").ElementAtOrDefault(CorrectedRowIndex(rowIndex))
            : null;
    		
          Assert.IsNotNull(selectedRow, $"Unable to find row in TableView at index {rowIndex}.");
          return selectedRow;
        }
    

    This is what the UI map for the C1 grid. You see the rows are returned first:

    This is the FlexGrid:

    Any help is appreciated. Thanks!

  • Posted 18 November 2021, 1:10 am EST

    Hello,

    Thanks for the code snippet and snapshots.

    JFYI, Flexgrid .Net 5 and C1DataGrid have different design architectures. i.e., DataGrid works with RowPresenters and Flexgrid .Net 5 uses CellFactory to display the CellView.

    So, sorry to inform you that, this is the design behavior of Flexgrid .Net 5. Hence it is not possible for .Net 5 Flexgrid to get RowPresenter.

    Best Regards.

    Nitin

  • Posted 18 November 2021, 12:59 pm EST

    Thanks for the quick response. What is the new pattern for interacting with the FlexGrid with coded UI? Are there examples I can take a look at?

    public TableView(Application application = null, int index = 0) : base(application, PaneOrViewType.TableView, index)
    {
    Table = PaneOrView.FindElementByAccessibilityId("_tableControl");
    TableToolbar = PaneOrView.FindElementByAccessibilityId("_tableToolbar");
    StatusControl = PaneOrView.FindElementByAccessibilityId("_statusControl");
    TableGrid = Table.FindElementByClassName("DataGridRowsPanel");
    // This returns the datagrid
    DataGrid = PaneOrView.FindElementByAccessibilityId("_tableDataGrid");
    // This returns the cells panel  
    DataGridCells = PaneOrView.FindElementsByClassName("GridCellsPanel");
    }
    
    public AppiumWebElement GetRowByIndex(int rowIndex)
    {
    // What code would I use to do this?
    }
    
    public AppiumWebElement GetCell<T>(int rowIndex, T columnNameOrIndex) where T : IConvertible
    {
      // How can I find a cell without using a row index?
    }
    }
    

    Most of our functions are dependent on GetRowByIndex() and then GetCell(). Subsequent actions are managed by our codedui framework.

  • Posted 22 November 2021, 7:15 am EST

    Hi,

    Sorry for the delay, but we’re discussing this to the development team. We’ll get back to you once we have any update. [Internal Tracking Id - C1XAML-28446]

    Regards,

    Nitin

  • Posted 23 November 2021, 11:56 pm EST

    Hello,

    As per development team, full support of automation patterns with selecting rows, columns or cells is still in our to-do list.

    So, sorry to inform you that currently it is not supported in .NET 5 controls. We will try to address it in 2022v1.

    We’ll let you know when the support is available.

    Best Regards,

    Nitin

  • Posted 1 April 2022, 7:19 am EST

    Hi,

    We are happy to inform you that this issue has been fixed with the latest build 2022v1.

    So, we would request you to upgrade to the latest build using ComponentOne control panel. Just in case if you don’t have ComponentOne Control Panel, you can download it from https://www.grapecity.com/componentone/download.

    Best Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels