diff --git a/features/csharp/csharp_breadcrumbs.feature b/features/csharp/csharp_breadcrumbs.feature index d73be1996..c3253b52b 100644 --- a/features/csharp/csharp_breadcrumbs.feature +++ b/features/csharp/csharp_breadcrumbs.feature @@ -84,24 +84,24 @@ Feature: Csharp Breadcrumbs Then the error is valid for the error reporting API sent by the Unity notifier And the exception "message" equals "NetworkBreadcrumbsSuccess" + And the event "breadcrumbs.0.name" equals "UnityWebRequest succeeded" + And the event "breadcrumbs.0.type" equals "request" + And the event "breadcrumbs.0.metaData.method" equals "GET" + And the error payload field "events.0.breadcrumbs.0.metaData.url" matches the regex "^http:\/\/\S*:\d{4}(\/.*)?" + And the event "breadcrumbs.0.metaData.status" equals 200 + And the event "breadcrumbs.0.metaData.urlParams.success" equals "true" + And the event "breadcrumbs.0.metaData.urlParams.redactthis" equals "[REDACTED]" + And the event "breadcrumbs.0.metaData.duration" is greater than 0 + And the event "breadcrumbs.0.metaData.responseContentLength" is greater than 0 + And the event "breadcrumbs.1.name" equals "UnityWebRequest succeeded" And the event "breadcrumbs.1.type" equals "request" - And the event "breadcrumbs.1.metaData.method" equals "GET" + And the event "breadcrumbs.1.metaData.method" equals "POST" And the error payload field "events.0.breadcrumbs.1.metaData.url" matches the regex "^http:\/\/\S*:\d{4}(\/.*)?" And the event "breadcrumbs.1.metaData.status" equals 200 - And the event "breadcrumbs.1.metaData.urlParams.success" equals "true" - And the event "breadcrumbs.1.metaData.urlParams.redactthis" equals "[REDACTED]" And the event "breadcrumbs.1.metaData.duration" is greater than 0 And the event "breadcrumbs.1.metaData.responseContentLength" is greater than 0 - - And the event "breadcrumbs.2.name" equals "UnityWebRequest succeeded" - And the event "breadcrumbs.2.type" equals "request" - And the event "breadcrumbs.2.metaData.method" equals "POST" - And the error payload field "events.0.breadcrumbs.2.metaData.url" matches the regex "^http:\/\/\S*:\d{4}(\/.*)?" - And the event "breadcrumbs.2.metaData.status" equals 200 - And the event "breadcrumbs.2.metaData.duration" is greater than 0 - And the event "breadcrumbs.2.metaData.responseContentLength" is greater than 0 - And the event "breadcrumbs.2.metaData.requestContentLength" is greater than 0 + And the event "breadcrumbs.1.metaData.requestContentLength" is greater than 0 Scenario: Network breadcrumb fails @@ -113,7 +113,7 @@ Feature: Csharp Breadcrumbs And the event "breadcrumbs.1.type" equals "request" And the event "breadcrumbs.1.metaData.method" equals "GET" And the error payload field "events.0.breadcrumbs.1.metaData.url" equals "https://localhost:994/?success=false" - And the event "breadcrumbs.1.metaData.status" equals 0 + And the event "breadcrumbs.1.metaData.status" has failed And the event "breadcrumbs.1.metaData.urlParams.success" equals "false" And the event "breadcrumbs.1.metaData.duration" is greater than 0 diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Breadcrumbs/NetworkBreadcrumbsSuccess.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Breadcrumbs/NetworkBreadcrumbsSuccess.cs index d8dbeafbb..500035180 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Breadcrumbs/NetworkBreadcrumbsSuccess.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Breadcrumbs/NetworkBreadcrumbsSuccess.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using BugsnagNetworking; +using BugsnagUnity; using UnityEngine; public class NetworkBreadcrumbsSuccess : Scenario @@ -11,6 +12,7 @@ public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); Configuration.RedactedKeys = new List { new Regex("redactthis") }; + Configuration.EnabledBreadcrumbTypes = new BugsnagUnity.Payload.BreadcrumbType[] { BugsnagUnity.Payload.BreadcrumbType.Request }; } public override void Run() { diff --git a/features/steps/unity_steps.rb b/features/steps/unity_steps.rb index e132bc4e8..aaf3c9ce2 100644 --- a/features/steps/unity_steps.rb +++ b/features/steps/unity_steps.rb @@ -141,6 +141,12 @@ def check_error_reporting_api(notifier_name) check_error_reporting_api notifier_name end +Then('the event "breadcrumbs.1.metaData.status" has failed') do + status = Maze::Helper.read_key_path(Maze::Server.errors.current[:body], 'events.0.breadcrumbs.1.metaData.status') + # 500 may be returned due to browser CORs + Maze.check.true(status == 0 || status == 500, "Expected an error status of 0 or 500 but got #{status}") +end + Then('the stack frame methods should match:') do |expected_values| stacktrace = Maze::Helper.read_key_path(Maze::Server.errors.current[:body], 'events.0.exceptions.0.stacktrace') expected_frame_values = expected_values.raw