Skip to content

Commit b1afc04

Browse files
authored
Merge pull request #80 from quantori/fixing-minor-issues
Various changes and fixes
2 parents ade1637 + 3215e92 commit b1afc04

File tree

6 files changed

+43
-26
lines changed

6 files changed

+43
-26
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Feature: ExampleBinding
2+
3+
@Automated
4+
Scenario: Open Google page
5+
When user opens URL "https://www.google.com/"
6+
Then page title should become "Google"
7+

src/App/package-lock.json

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Behavioral.Automation/Bindings/AttributeBinding.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ public void CheckElementIsDisabled(
2626
[NotNull] AssertionBehavior behavior,
2727
bool enabled)
2828
{
29+
var status = enabled ? " not" : string.Empty;
2930
Assert.ShouldBecome(() => element.Enabled, enabled, behavior,
30-
$"{element.Caption} is{behavior.BehaviorAppendix()} enabled");
31+
$"{element.Caption} is{status} enabled");
3132
}
3233

3334
[StepArgumentTransformation("(enabled|disabled)")]

src/Behavioral.Automation/Bindings/DropdownBinding.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ private void CheckDropdownValueCollectionEnabled([NotNull] string behavior,
116116
{
117117
foreach (var row in table.Rows)
118118
{
119-
runnerAction($"the \"{row.Values.First()} \" value {behavior} {enabled} in {wrapper.Caption}:");
119+
Assert.ShouldBecome(() => row.Values.Any(), true, new AssertionBehavior(AssertionType.Immediate, false),
120+
"One of the rows in the provided table doesn't have values");
121+
runnerAction($"the \"{row.Values.First()}\" value {behavior} {enabled} in {wrapper.Caption}");
120122
}
121123
}
122124

src/Behavioral.Automation/Bindings/TableBinding.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public void CheckTableHaveRows(ITableWrapper gridRows, string behavior, Table ta
3333
Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().DoesntContainValues(table.Rows.ToStringRows()),
3434
true,
3535
new AssertionBehavior(AssertionType.Immediate, true),
36-
$"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}");
36+
$"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}");
3737
}
3838
else
3939
{
4040

4141
Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().HaveValues(table.Rows.ToStringRows(), false),
4242
true,
4343
new AssertionBehavior(AssertionType.Immediate, false),
44-
$"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}");
44+
$"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}");
4545
}
4646
}
4747

@@ -53,7 +53,7 @@ public void CheckTableHaveRowsInExactOrder(ITableWrapper gridRows, Table table)
5353
Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().HaveValues(table.Rows.ToStringRows(), true),
5454
true,
5555
new AssertionBehavior(AssertionType.Immediate, false),
56-
$"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}");
56+
$"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}");
5757
}
5858

5959
[Given("(.+?) (contains|does not contain) the following rows:")]
@@ -68,14 +68,14 @@ public void CheckTableContainsRows(ITableWrapper gridRows, string behavior, Tab
6868
Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().DoesntContainValues(table.Rows.ToStringRows()),
6969
true,
7070
new AssertionBehavior(AssertionType.Immediate, false),
71-
$"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}");
71+
$"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}");
7272
}
7373
else
7474
{
7575
Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().ContainsValues(table.Rows.ToStringRows()),
7676
true,
7777
new AssertionBehavior(AssertionType.Immediate, false),
78-
$"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}");
78+
$"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}");
7979
}
8080
}
8181

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
using System.Collections.Generic;
22
using System.Linq;
33
using Behavioral.Automation.Elements;
4+
using JetBrains.Annotations;
45

56
namespace Behavioral.Automation.Services
67
{
78
public static class PrintValuesHelper
89
{
9-
public static string GetPrintableValues(this IEnumerable<ITableRowWrapper> rows)
10+
public static string GetPrintableValues([NotNull] this IEnumerable<ITableRowWrapper> rows)
1011
{
11-
return rows.SelectMany(x => x.CellsText).Aggregate((x, y) => $"{x}, {y}");
12+
if (rows.Any())
13+
{
14+
var values = rows.Aggregate("\r\n|", (current, row) => current + (row.CellsText.Aggregate((x, y) => $" {x} | {y}") + " |\r\n |"));
15+
return values.Remove(values.Length - 3);
16+
}
17+
18+
return "\r\n Rows collection was empty";
1219
}
1320
}
1421
}

0 commit comments

Comments
 (0)