diff --git a/Behavioral.Automation.DemoScenarios/Features/ExampleBinding.feature b/Behavioral.Automation.DemoScenarios/Features/ExampleBinding.feature new file mode 100644 index 00000000..e1202f4c --- /dev/null +++ b/Behavioral.Automation.DemoScenarios/Features/ExampleBinding.feature @@ -0,0 +1,7 @@ +Feature: ExampleBinding + +@Automated +Scenario: Open Google page + When user opens URL "https://www.google.com/" + Then page title should become "Google" + diff --git a/src/App/package-lock.json b/src/App/package-lock.json index cfa109de..0d14d7fc 100644 --- a/src/App/package-lock.json +++ b/src/App/package-lock.json @@ -2778,7 +2778,7 @@ "promise-inflight": "^1.0.1", "rimraf": "^3.0.2", "ssri": "^8.0.0", - "tar": "^6.0.2", + "tar": "^6.1.9", "unique-filename": "^1.1.1" }, "dependencies": { @@ -3962,7 +3962,7 @@ "dev": true }, "dns-packet": { - "version": "1.3.1", + "version": "1.3.2", "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz", "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", "dev": true, @@ -6956,7 +6956,7 @@ "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", "dev": true, "requires": { - "dns-packet": "^1.3.1", + "dns-packet": "^1.3.2", "thunky": "^1.0.2" } }, @@ -7662,7 +7662,7 @@ "safe-buffer": "^5.1.2", "semver": "^5.6.0", "ssri": "^6.0.1", - "tar": "^4.4.10", + "tar": "^6.1.9", "unique-filename": "^1.1.1", "which": "^1.3.1" }, @@ -7787,7 +7787,7 @@ } }, "tar": { - "version": "4.4.13", + "version": "6.1.9", "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", "dev": true, @@ -7921,7 +7921,7 @@ "dev": true }, "path-parse": { - "version": "1.0.6", + "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true @@ -8031,7 +8031,7 @@ "dev": true }, "postcss": { - "version": "7.0.32", + "version": "7.0.36", "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", "dev": true, @@ -8078,7 +8078,7 @@ "browserslist": "^4.0.0", "color": "^3.0.0", "has": "^1.0.0", - "postcss": "^7.0.0", + "postcss": "^7.0.36", "postcss-value-parser": "^3.0.0" }, "dependencies": { @@ -8096,7 +8096,7 @@ "integrity": "sha512-Kisdo1y77KUC0Jmn0OXU/COOJbzM8cImvw1ZFsBgBgMgb1iL23Zs/LXRe3r+EZqM3vGYKdQ2YJVQ5VkJI+zEJQ==", "dev": true, "requires": { - "postcss": "^7.0.0", + "postcss": "^7.0.36", "postcss-value-parser": "^3.0.0" }, "dependencies": { @@ -8114,7 +8114,7 @@ "integrity": "sha512-RJutN259iuRf3IW7GZyLM5Sw4GLTOH8FmsXBnv8Ab/Tc2k4SR4qbV4DNbyyY4+Sjo362SyDmW2DQ7lBSChrpkg==", "dev": true, "requires": { - "postcss": "^7.0.0" + "postcss": "^7.0.36" } }, "postcss-discard-duplicates": { @@ -9611,7 +9611,7 @@ "dev": true }, "set-value": { - "version": "2.0.1", + "version": "4.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "dev": true, @@ -9855,7 +9855,7 @@ "faye-websocket": "~0.11.1", "inherits": "^2.0.3", "json3": "^3.3.2", - "url-parse": "^1.4.3" + "url-parse": "^1.5.2" }, "dependencies": { "debug": { @@ -10421,7 +10421,7 @@ "dev": true }, "tar": { - "version": "6.1.0", + "version": "6.1.9", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz", "integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==", "dev": true, @@ -10740,7 +10740,7 @@ "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^2.0.1" + "set-value": "^4.0.1" } }, "uniq": { @@ -10882,7 +10882,7 @@ } }, "url-parse": { - "version": "1.5.1", + "version": "^1.5.2", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz", "integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==", "dev": true, @@ -11625,7 +11625,7 @@ "url": "^0.11.0", "webpack-dev-middleware": "^3.7.2", "webpack-log": "^2.0.0", - "ws": "^6.2.1", + "ws": "^6.2.2", "yargs": "^13.3.2" }, "dependencies": { @@ -12052,7 +12052,7 @@ "dev": true }, "ws": { - "version": "6.2.1", + "version": "6.2.2", "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", "dev": true, diff --git a/src/Behavioral.Automation/Bindings/AttributeBinding.cs b/src/Behavioral.Automation/Bindings/AttributeBinding.cs index f959e5f1..f08c1e49 100644 --- a/src/Behavioral.Automation/Bindings/AttributeBinding.cs +++ b/src/Behavioral.Automation/Bindings/AttributeBinding.cs @@ -26,8 +26,9 @@ public void CheckElementIsDisabled( [NotNull] AssertionBehavior behavior, bool enabled) { + var status = enabled ? " not" : string.Empty; Assert.ShouldBecome(() => element.Enabled, enabled, behavior, - $"{element.Caption} is{behavior.BehaviorAppendix()} enabled"); + $"{element.Caption} is{status} enabled"); } [StepArgumentTransformation("(enabled|disabled)")] diff --git a/src/Behavioral.Automation/Bindings/DropdownBinding.cs b/src/Behavioral.Automation/Bindings/DropdownBinding.cs index 1ef234a0..d99a923c 100644 --- a/src/Behavioral.Automation/Bindings/DropdownBinding.cs +++ b/src/Behavioral.Automation/Bindings/DropdownBinding.cs @@ -116,7 +116,9 @@ private void CheckDropdownValueCollectionEnabled([NotNull] string behavior, { foreach (var row in table.Rows) { - runnerAction($"the \"{row.Values.First()} \" value {behavior} {enabled} in {wrapper.Caption}:"); + Assert.ShouldBecome(() => row.Values.Any(), true, new AssertionBehavior(AssertionType.Immediate, false), + "One of the rows in the provided table doesn't have values"); + runnerAction($"the \"{row.Values.First()}\" value {behavior} {enabled} in {wrapper.Caption}"); } } diff --git a/src/Behavioral.Automation/Bindings/TableBinding.cs b/src/Behavioral.Automation/Bindings/TableBinding.cs index 15fc689b..dca326ed 100644 --- a/src/Behavioral.Automation/Bindings/TableBinding.cs +++ b/src/Behavioral.Automation/Bindings/TableBinding.cs @@ -33,7 +33,7 @@ public void CheckTableHaveRows(ITableWrapper gridRows, string behavior, Table ta Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().DoesntContainValues(table.Rows.ToStringRows()), true, new AssertionBehavior(AssertionType.Immediate, true), - $"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}"); + $"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}"); } else { @@ -41,7 +41,7 @@ public void CheckTableHaveRows(ITableWrapper gridRows, string behavior, Table ta Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().HaveValues(table.Rows.ToStringRows(), false), true, new AssertionBehavior(AssertionType.Immediate, false), - $"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}"); + $"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}"); } } @@ -53,7 +53,7 @@ public void CheckTableHaveRowsInExactOrder(ITableWrapper gridRows, Table table) Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().HaveValues(table.Rows.ToStringRows(), true), true, new AssertionBehavior(AssertionType.Immediate, false), - $"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}"); + $"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}"); } [Given("(.+?) (contains|does not contain) the following rows:")] @@ -68,14 +68,14 @@ public void CheckTableContainsRows(ITableWrapper gridRows, string behavior, Tab Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().DoesntContainValues(table.Rows.ToStringRows()), true, new AssertionBehavior(AssertionType.Immediate, false), - $"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}"); + $"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}"); } else { Assert.ShouldBecome(() => gridRows.Rows.ToStringRows().ContainsValues(table.Rows.ToStringRows()), true, new AssertionBehavior(AssertionType.Immediate, false), - $"{gridRows.Caption} is {gridRows.Rows.GetPrintableValues()}"); + $"{gridRows.Caption} is: {gridRows.Rows.GetPrintableValues()}"); } } diff --git a/src/Behavioral.Automation/Services/PrintValuesHelper.cs b/src/Behavioral.Automation/Services/PrintValuesHelper.cs index 063a8c91..cb76133e 100644 --- a/src/Behavioral.Automation/Services/PrintValuesHelper.cs +++ b/src/Behavioral.Automation/Services/PrintValuesHelper.cs @@ -1,14 +1,21 @@ using System.Collections.Generic; using System.Linq; using Behavioral.Automation.Elements; +using JetBrains.Annotations; namespace Behavioral.Automation.Services { public static class PrintValuesHelper { - public static string GetPrintableValues(this IEnumerable rows) + public static string GetPrintableValues([NotNull] this IEnumerable rows) { - return rows.SelectMany(x => x.CellsText).Aggregate((x, y) => $"{x}, {y}"); + if (rows.Any()) + { + var values = rows.Aggregate("\r\n|", (current, row) => current + (row.CellsText.Aggregate((x, y) => $" {x} | {y}") + " |\r\n |")); + return values.Remove(values.Length - 3); + } + + return "\r\n Rows collection was empty"; } } }