From c88f2a2b3d3f443e6101faaeb370519408979f2b Mon Sep 17 00:00:00 2001 From: AhmedD43 <110165557+AhmedD43@users.noreply.github.com> Date: Fri, 16 Sep 2022 10:24:56 +0100 Subject: [PATCH] fix: asserting sub-grid count when there are 0 actual rows (#139) * Bug: Fixed issue in EntitySubGridSteps.cs by bypassing GetSubGridItemsCount as it fails for zero items (line 116) * Bug: Fixed, Added missing test that was only present in the corresponding Gherkin test file to the LookupSteps.cs file (line 127 onwards) * Updated Selenium to latest version * Reverted the code in LookupSteps.cs as it was before * Added an EasyRepro link related to code that was not working. Commented out some code from EasyRepro and included the relevant link on GitHub relating to the issue. Co-authored-by: Tom Ashworth --- .../Steps/EntitySubGridSteps.cs | 7 ++++++- .../Capgemini.PowerApps.SpecFlowBindings.UiTests.csproj | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySubGridSteps.cs b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySubGridSteps.cs index c6e6d01..dff4dd6 100644 --- a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySubGridSteps.cs +++ b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySubGridSteps.cs @@ -111,7 +111,12 @@ public static void ThenICanNotSeeInTheSubgrid(string alias, string subGridName) [Then(@"I can see (exactly|more than|less than) (\d+) records in the '(.*)' subgrid")] public static void ThenICanSeeRecordsInTheSubgrid(string compare, int count, string subGridName) { - var actualCount = XrmApp.Entity.SubGrid.GetSubGridItemsCount(subGridName); + //var actualCount = XrmApp.Entity.SubGrid.GetSubGridItemsCount(subGridName); + // Temporary until XrmApp.Entity.SubGrid.GetSubGridItemsCount(subGridName) works for a count of 0 + // https://github.com/microsoft/EasyRepro/issues/1318 + var actualCount = (long)Driver.ExecuteScript( + $"return Xrm.Page.getControl(\"{subGridName}\").getGrid().getTotalRecordCount();"); + switch (compare) { diff --git a/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/Capgemini.PowerApps.SpecFlowBindings.UiTests.csproj b/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/Capgemini.PowerApps.SpecFlowBindings.UiTests.csproj index 5db63b9..1d1d186 100644 --- a/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/Capgemini.PowerApps.SpecFlowBindings.UiTests.csproj +++ b/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/Capgemini.PowerApps.SpecFlowBindings.UiTests.csproj @@ -38,7 +38,7 @@ - +