From 5ec7357e93040a5b147d1f09bac56140690db9fe Mon Sep 17 00:00:00 2001 From: Jams-H Date: Sat, 28 Aug 2021 19:32:30 +0100 Subject: [PATCH] Added table step --- .../Steps/EntitySteps.cs | 24 ++++++++++++++++++- .../EntitySteps.feature | 13 ++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySteps.cs b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySteps.cs index cdbec769..4a1e43d8 100644 --- a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySteps.cs +++ b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySteps.cs @@ -463,7 +463,7 @@ public static void ThenICanNotEditTheFollowingFields(Table table) } /// - /// Asserts that a field is not visible. + /// Asserts that a field is visible. /// /// The name of the field. [Then(@"I can see the '(.*)' field")] @@ -472,6 +472,28 @@ public static void ThenICanSeeTheField(string fieldName) XrmApp.Entity.IsFieldVisible(Driver, fieldName).Should().BeTrue(because: "the field should be visible"); } + /// + /// Assert that fields are visible or not visible. + /// + /// Whether or not the field is visible. + /// The fields. + [Then(@"I (can|can not) see the following fields")] + public static void ThenICanSeeTheFields(string canSee, Table fields) + { + var fieldList = fields.Rows.Select(x => x[0]); + for (int i = 0; i < fieldList.Count(); i++) + { + if (canSee == "can") + { + ThenICanSeeTheField(fieldList.ElementAt(i)); + } + else + { + ThenICanNotSeeTheField(fieldList.ElementAt(i)); + } + } + } + /// /// Asserts that a field is not visible. /// diff --git a/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/EntitySteps.feature b/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/EntitySteps.feature index 222305d0..c6c3176d 100644 --- a/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/EntitySteps.feature +++ b/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/EntitySteps.feature @@ -173,9 +173,22 @@ Scenario: Assert option set options Scenario: Assert field visible Then I can see the 'sb_name' field +Scenario: Assert fields visible + Then I can see the following fields + | fieldList | + | sb_name | + | sb_yesno | + | sb_choice | + | sb_dateandtime | + Scenario: Assert field not visible Then I can not see the 'ownerid' field + Scenario: Assert fields not visible + Then I can not see the following fields + | fieldList | + | ownerid | + Scenario: Assert record status Then the status of the record is active