Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/Behavioral.Automation/Bindings/DropdownBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void CheckDropdownHeaders([NotNull] IGroupedDropdownWrapper wrapper, [Not
CheckDropdownElements(wrapper.GroupTexts, items, $"{wrapper.Caption} groups");
}

[When("(.*?) (contain|not contain) \"(.*)\"")]
Copy link
Contributor

@Brrovko Brrovko Oct 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we don't have scenarios with the "when" step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this check in "when" step violates Gherkin syntax a bit, I think we don't have such scenarios. But I'll check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot find any usages of this step with "when". Seems ok to remove it

[Given("(.*?) (contain|not contain) \"(.*)\"")]
[Then("(.*?) should (contain|not contain) \"(.*)\"")]
public void CheckDropdownContainsItems(
[NotNull] IDropdownWrapper wrapper,
Expand All @@ -54,6 +54,23 @@ public void CheckDropdownContainsItems(
$"{wrapper.Caption} items are {wrapper.Items.Aggregate((x, y) => $"{x}, {y}")}");
}

[Given("the (.*?) (contains|not contains) the following values:")]
[Then("the (.*?) should (contain|not contain) the following values:")]
[Then("the \"(.*?)\" menu should (contain|not contain) the following values:")]
public void CheckDropdownContainsMultipleItems([NotNull] IDropdownWrapper wrapper, [NotNull] string behavior, [NotNull] Table table)
{
Assert.ShouldBecome(()=> table.Rows.Any(),true,
new AssertionBehavior(AssertionType.Immediate, false), "Please provide data in the table");

var dropdownItems = wrapper.Items;
foreach (var row in table.Rows)
{
var value = row.Values.FirstOrDefault();
Assert.ShouldBecome(()=>dropdownItems.Contains(value), !behavior.Contains("not"),
$"{wrapper.Caption} items are {dropdownItems.Aggregate((x, y) => $"{x}, {y}")}");
}
}

[Then("all items in the (.+?) should (have|not have) \"(.+?)\"")]
public void CheckAllItemsContainString(
[NotNull] IDropdownWrapper wrapper,
Expand Down