Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(feedback): capture envelopes #4535

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
97ab954
prefill user info
armcknight Dec 12, 2024
8a9fe49
fix build and add ui test
armcknight Dec 12, 2024
fc35119
dont assert nil value bc it uses the placeholder string when empty
armcknight Dec 13, 2024
a2764d8
default user.name in addition to user.username
armcknight Dec 13, 2024
237f9b4
these should not have been in the public SentrySDK header
armcknight Dec 13, 2024
71f473a
capture envelopes
armcknight Nov 15, 2024
9220f58
just send from the form, no need for delegation
armcknight Nov 15, 2024
f66ad3b
put back integration objc
armcknight Nov 15, 2024
bc430c5
add new SentryFeedback interface and thread callpath to capture in en…
armcknight Nov 16, 2024
b78655c
fix headerdoc in SentrySDK.h; use new SDK capture method in form subm…
armcknight Nov 16, 2024
ec031c4
Format code
getsentry-bot Nov 16, 2024
0ac677a
pr feedback and updates
armcknight Nov 19, 2024
de56160
remove hints; ordering in init
armcknight Nov 20, 2024
c128d60
fix bad conflict resolution
armcknight Dec 5, 2024
9dc92aa
refactor method to reuse for grabbing attachments for an event
armcknight Dec 12, 2024
1299f1a
wip implementing new feedback envelope capture
armcknight Dec 12, 2024
00ef3dd
necessary tweaks to events/envelopes to get feedback events ingested …
armcknight Dec 13, 2024
5cb9ada
remove some comments to pr/issue
armcknight Dec 13, 2024
4dcee7a
ios-only build requirements needed some places, but actually not for …
armcknight Dec 13, 2024
64ab660
add serialization test
armcknight Dec 13, 2024
df7f177
pr feedback
armcknight Dec 18, 2024
5d1ff6e
wip: intercepting cached envelopes to validate in UI tests
armcknight Dec 18, 2024
f593556
Merge remote-tracking branch 'origin/main' into armcknight/feat(user-…
armcknight Dec 18, 2024
623673c
moving to other branch
armcknight Dec 19, 2024
4b88e4b
remove TestStoreOnlyTransport
armcknight Dec 19, 2024
0c35b26
Merge remote-tracking branch 'origin/main' into armcknight/feat(user-…
armcknight Dec 20, 2024
d5923cf
Update Sentry.xcodeproj/project.pbxproj
armcknight Dec 20, 2024
1e4f7a3
fix pbxproj issue
armcknight Dec 20, 2024
ded938e
test(feedback): validate envelopes (#4652)
armcknight Dec 24, 2024
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
26 changes: 22 additions & 4 deletions Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,21 @@ class UserFeedbackUITests: BaseUITest {
// MARK: Tests validating happy path / successful submission

func testSubmitFullyFilledForm() throws {
launchApp(args: ["--io.sentry.feedback.all-defaults"])
launchApp(args: ["--io.sentry.feedback.all-defaults", "--io.sentry.disable-everything", "--io.sentry.wipe-data", "--io.sentry.base64-attachment-data"])

widgetButton.tap()

nameField.tap()
nameField.typeText("Andrew")
let testName = "Andrew"
nameField.typeText(testName)

emailField.tap()
emailField.typeText("andrew.mcknight@sentry.io")
let testContactEmail = "andrew.mcknight@sentry.io"
emailField.typeText(testContactEmail)

messageTextView.tap()
messageTextView.typeText("UITest user feedback")
let testMessage = "UITest user feedback"
messageTextView.typeText(testMessage)

sendButton.tap()

Expand All @@ -134,6 +137,21 @@ class UserFeedbackUITests: BaseUITest {
XCTAssertEqual(try XCTUnwrap(emailField.value as? String), "your.email@example.org")

XCTAssertEqual(try XCTUnwrap(messageTextView.value as? String), "", "The UITextView shouldn't have any initial text functioning as a placeholder; as UITextView has no placeholder property, the \"placeholder\" is a label on top of it.")

cancelButton.tap()

app.buttons["Extra"].tap()
app.buttons["io.sentry.ui-test.button.get-latest-envelope"].tap()
let marshaledDataBase64 = try XCTUnwrap(app.textFields["io.sentry.ui-test.text-field.data-marshaling.latest-envelope"].value as? String)
let data = try XCTUnwrap(Data(base64Encoded: marshaledDataBase64))
let dict = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any])
XCTAssertEqual(try XCTUnwrap(dict["event_type"] as? String), "feedback")
XCTAssertEqual(try XCTUnwrap(dict["message"] as? String), testMessage)
XCTAssertEqual(try XCTUnwrap(dict["contact_email"] as? String), testContactEmail)
XCTAssertEqual(try XCTUnwrap(dict["source"] as? String), "widget")
XCTAssertEqual(try XCTUnwrap(dict["name"] as? String), testName)
XCTAssertNotNil(dict["event_id"])
XCTAssertEqual(try XCTUnwrap(dict["item_header_type"] as? String), "feedback")
}

func testSubmitWithOnlyRequiredFieldsFilled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,30 @@
argument = "--io.sentry.disable-everything"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--disable-time-to-full-display-tracing"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--disable-performance-v2"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--disable-attach-view-hierarchy"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--disable-attach-screenshot"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--io.sentry.base64-attachment-data"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--io.sentry.disable-http-transport"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--disable-file-io-tracing"
isEnabled = "NO">
Expand Down Expand Up @@ -240,11 +264,6 @@
value = ""
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "--io.sentry.user.name"
value = ""
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
Expand Down
16 changes: 10 additions & 6 deletions Samples/iOS-Swift/iOS-Swift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@
options.enableNetworkBreadcrumbs = enableNetworkBreadcrumbs
options.enableSwizzling = enableSwizzling
options.enableCrashHandler = enableCrashHandling
options.enableTracing = enableTracing

Check warning on line 114 in Samples/iOS-Swift/iOS-Swift/AppDelegate.swift

View workflow job for this annotation

GitHub Actions / UI Tests for iOS-Swift iPhone 14 (16.4) Simulator

'enableTracing' is deprecated: Use tracesSampleRate or tracesSampler instead
options.enablePersistingTracesWhenCrashing = true
options.attachScreenshot = true
options.attachViewHierarchy = true
options.enableTimeToFullDisplayTracing = true
options.enablePerformanceV2 = true
options.attachScreenshot = enableAttachScreenshot
options.attachViewHierarchy = enableAttachViewHierarchy
options.enableTimeToFullDisplayTracing = enableTimeToFullDisplayTracing
options.enablePerformanceV2 = enablePerformanceV2
options.failedRequestStatusCodes = [ HttpStatusCodeRange(min: 400, max: 599) ]

options.beforeBreadcrumb = { breadcrumb in
Expand Down Expand Up @@ -298,7 +298,7 @@
var isUITest: Bool { env["--io.sentry.sdk-environment"] == "ui-tests" }

func checkDisabled(with arg: String) -> Bool {
args.contains("--disable-everything") || args.contains(arg)
args.contains("--io.sentry.disable-everything") || args.contains(arg)
}

// MARK: features that care about simulator vs device, ui tests and profiling benchmarks
Expand All @@ -312,7 +312,7 @@

/// - note: the benchmark test starts and stops a custom transaction using a UIButton, and automatic user interaction tracing stops the transaction that begins with that button press after the idle timeout elapses, stopping the profiler (only one profiler runs regardless of the number of concurrent transactions)
var enableUITracing: Bool { !isBenchmarking && !checkDisabled(with: "--disable-ui-tracing") }
var enablePrewarmedAppStartTracing: Bool { !isBenchmarking }
var enablePrewarmedAppStartTracing: Bool { !isBenchmarking && !checkDisabled(with: "--disable-prewarmed-app-start-tracing") }
var enablePerformanceTracing: Bool { !isBenchmarking && !checkDisabled(with: "--disable-auto-performance-tracing") }
var enableTracing: Bool { !isBenchmarking && !checkDisabled(with: "--disable-tracing") }
/// - note: UI tests generate false OOMs
Expand All @@ -322,6 +322,10 @@

// MARK: Other features

var enableTimeToFullDisplayTracing: Bool { !checkDisabled(with: "--disable-time-to-full-display-tracing")}
var enableAttachScreenshot: Bool { !checkDisabled(with: "--disable-attach-screenshot")}
var enableAttachViewHierarchy: Bool { !checkDisabled(with: "--disable-attach-view-hierarchy")}
var enablePerformanceV2: Bool { !checkDisabled(with: "--disable-performance-v2")}
var enableSessionReplay: Bool { !checkDisabled(with: "--disable-session-replay") }
var enableMetricKit: Bool { !checkDisabled(with: "--disable-metrickit-integration") }
var enableSessionTracking: Bool { !checkDisabled(with: "--disable-automatic-session-tracking") }
Expand Down
Loading
Loading