-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(feedback): validate envelope contents for a feedback envelope in…
… ui test
- Loading branch information
1 parent
4b88e4b
commit 3170b09
Showing
9 changed files
with
430 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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("[email protected]") | ||
let testContactEmail = "[email protected]" | ||
emailField.typeText(testContactEmail) | ||
|
||
messageTextView.tap() | ||
messageTextView.typeText("UITest user feedback") | ||
let testMessage = "UITest user feedback" | ||
messageTextView.typeText(testMessage) | ||
|
||
sendButton.tap() | ||
|
||
|
@@ -135,10 +138,20 @@ class UserFeedbackUITests: BaseUITest { | |
|
||
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.") | ||
|
||
// TODO: go to Extras view | ||
app.buttons["io.sentry.ui-test.button.get-feedback-envelope"].tap() | ||
// TODO: pull contents out of text field | ||
// TODO: validate contents | ||
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() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.