diff --git a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySteps.cs b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySteps.cs index cdbec76..758ea2a 100644 --- a/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySteps.cs +++ b/bindings/src/Capgemini.PowerApps.SpecFlowBindings/Steps/EntitySteps.cs @@ -288,6 +288,27 @@ public static void ThenTheFieldIsMandatory(string fieldName, string requirementL fieldContainer.GetAttribute("data-fieldrequirement").Should().Be(requirementLevel == "mandatory" ? 2 : 0, because: $"the field should be {requirementLevel}"); } + /// + /// Asserts that a set of fields are mandatory or optional. + /// + /// Whether the field should be mandatory or optional. + /// The names of the fields. + [Then("the following fields are (mandatory|optional)")] + public static void ThenTheFieldsAreMandatory(string requirementLevel, Table table) + { + if (table is null) + { + throw new ArgumentNullException(nameof(table)); + } + + var fields = table.Rows.Select(x => x.Values.First()); + + foreach (var field in fields) + { + ThenTheFieldIsMandatory(field, requirementLevel); + } + } + /// /// Asserts that a value is shown in a boolean field. /// diff --git a/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/EntitySteps.feature b/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/EntitySteps.feature index 222305d..63013d0 100644 --- a/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/EntitySteps.feature +++ b/bindings/tests/Capgemini.PowerApps.SpecFlowBindings.UiTests/EntitySteps.feature @@ -125,6 +125,18 @@ Scenario: Assert a field is optional Scenario: Assert a field is required Then the 'sb_name' field is mandatory +Scenario: Assert a set of fields are optional + Then the following fields are optional + | fields | + | sb_text | + | sb_number | + | sb_yesno | + +Scenario: Assert a set of fields are mandatory + Then the following fields are mandatory + | fields | + | sb_name | + Scenario Outline: Assert fom notification message Then I can see form notification stating ''