Skip to content

Commit 98bcbf2

Browse files
committed
fix ui tests; tweak api
1 parent 968a066 commit 98bcbf2

File tree

10 files changed

+170
-163
lines changed

10 files changed

+170
-163
lines changed

Samples/iOS-Swift/PerformanceBenchmarks/SentrySDKPerformanceBenchmarkTests.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ - (void)testProfilerCPUUsage
3737

3838
[app.buttons[@"startTransactionMainThread"] tap];
3939

40-
[app.tabBars[@"Tab Bar"].buttons[@"Benchmarking"] tap];
40+
[app.tabBars[@"Tab Bar"].buttons[@"More"] tap];
41+
[app.staticTexts[@"Benchmarking"] tap];
4142

4243
[app.buttons[@"Benchmark start"] tap];
4344

Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class UserFeedbackUITests: BaseUITest {
1414
super.setUp()
1515

1616
app.launchArguments.append(contentsOf: [
17-
"--io.sentry.feedback.auto-inject-widget",
1817
"--io.sentry.feedback.no-animations",
1918
"--io.sentry.wipe-data",
2019

@@ -59,7 +58,7 @@ extension UserFeedbackUITests {
5958
}
6059

6160
func testUIElementsWithCustomizations() {
62-
launchApp(args: ["--io.sentry.feedback.auto-inject-widget"])
61+
launchApp()
6362

6463
// widget button text
6564
XCTAssert(app.otherElements["Report Jank"].exists)
@@ -292,12 +291,6 @@ extension UserFeedbackUITests {
292291
widgetButton.tap()
293292
XCTAssert(sendButton.waitForExistence(timeout: 1))
294293
try assertOnlyHookMarkersExist(names: [.onFormOpen])
295-
296-
messageTextView.tap()
297-
messageTextView.typeText("UITest user feedback")
298-
299-
// dismiss the onscreen keyboard
300-
app.swipeDown(velocity: .fast)
301294

302295
// the modal cancel gesture
303296
app.swipeDown(velocity: .fast)

Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
215215
<subviews>
216216
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="ntC-Ea-bhK">
217-
<rect key="frame" x="0.0" y="64" width="320" height="419.5"/>
217+
<rect key="frame" x="0.0" y="64" width="320" height="384.5"/>
218218
<subviews>
219219
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="b1f-aG-VcS">
220220
<rect key="frame" x="0.0" y="0.0" width="320" height="70"/>
@@ -224,7 +224,7 @@
224224
</constraints>
225225
</view>
226226
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="jya-5z-xKN">
227-
<rect key="frame" x="0.0" y="70" width="320" height="349.5"/>
227+
<rect key="frame" x="0.0" y="70" width="320" height="314.5"/>
228228
<subviews>
229229
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" alignment="center" id="DsI-9S-jdi">
230230
<rect key="frame" x="0.0" y="0.0" width="320" height="28"/>
@@ -419,27 +419,8 @@
419419
<viewLayoutGuide key="safeArea" id="Xjs-qf-kxh"/>
420420
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor"/>
421421
</stackView>
422-
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="8" id="cTH-vp-x1q">
423-
<rect key="frame" x="0.0" y="264.5" width="320" height="31"/>
424-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
425-
<subviews>
426-
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jWc-r9-WqX">
427-
<rect key="frame" x="0.0" y="0.0" width="51" height="31"/>
428-
<connections>
429-
<action selector="immediatelyStopContinuousProfiler:" destination="NZr-bH-g9o" eventType="valueChanged" id="Vxa-jj-EAa"/>
430-
</connections>
431-
</switch>
432-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="Immediately stop continuous profiler" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.29999999999999999" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Acv-eU-TLH">
433-
<rect key="frame" x="57" y="5.5" width="263" height="20.5"/>
434-
<fontDescription key="fontDescription" type="system" pointSize="17"/>
435-
<nil key="textColor"/>
436-
<nil key="highlightedColor"/>
437-
</label>
438-
</subviews>
439-
<viewLayoutGuide key="safeArea" id="m7S-DL-OF1"/>
440-
</stackView>
441422
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="LIr-jM-FSX">
442-
<rect key="frame" x="0.0" y="299.5" width="320" height="50"/>
423+
<rect key="frame" x="0.0" y="264.5" width="320" height="50"/>
443424
<subviews>
444425
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="UI test data marshalling:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uhg-B3-Rao" userLabel="UI test data marshaling:">
445426
<rect key="frame" x="0.0" y="15" width="184" height="20.5"/>
@@ -1141,7 +1122,6 @@
11411122
<state key="normal" title="Get app support path"/>
11421123
<connections>
11431124
<action selector="getApplicationSupportPath:" destination="VqS-l1-kwe" eventType="touchUpInside" id="nck-yy-OlS"/>
1144-
<action selector="getLatestEnvelope:" destination="VqS-l1-kwe" eventType="touchUpInside" id="l3H-vg-yn9"/>
11451125
</connections>
11461126
</button>
11471127
</subviews>

Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import UIKit
22

33
class EnvironmentVariableTableViewCell: UITableViewCell, UITextFieldDelegate {
44
let titleLabel = UILabel(frame: .zero)
5+
56
lazy var valueField = {
67
let field = UITextField(frame: .zero)
78
field.delegate = self
89
return field
910
}()
11+
12+
var float: Bool = false
1013
var override: (any SentrySDKOverride)?
1114

1215
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
@@ -23,20 +26,28 @@ class EnvironmentVariableTableViewCell: UITableViewCell, UITextFieldDelegate {
2326
fatalError("init(coder:) has not been implemented")
2427
}
2528

26-
func configure(with launchArgument: any SentrySDKOverride) {
27-
titleLabel.text = launchArgument.rawValue as? String
29+
func configure(with override: any SentrySDKOverride, float: Bool) {
30+
titleLabel.text = override.rawValue as? String
2831

2932
var text: String
30-
if let value = launchArgument.value {
33+
if let value = override.floatValue {
3134
text = String(format: "%.2f", value)
35+
} else if let value = override.stringValue {
36+
text = value
3237
} else {
3338
text = "nil"
3439
}
3540
valueField.text = text
36-
self.override = launchArgument
41+
42+
self.float = float
43+
self.override = override
3744
}
3845

3946
func textFieldDidEndEditing(_ textField: UITextField) {
40-
override?.value = textField.text.flatMap { Float($0) }
47+
if self.float {
48+
override?.floatValue = textField.text.flatMap { Float($0) }
49+
} else {
50+
override?.stringValue = textField.text
51+
}
4152
}
4253
}

Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,33 @@ class FeaturesViewController: UITableViewController {
7474

7575
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
7676
if indexPath.section == 2 {
77-
if SentrySDKOverrides.Tracing.args.contains(SentrySDKOverrides.Tracing.allCases[indexPath.row]) {
77+
if SentrySDKOverrides.Tracing.boolValues.contains(SentrySDKOverrides.Tracing.allCases[indexPath.row]) {
7878
let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell
7979
cell.configure(with: SentrySDKOverrides.Tracing.allCases[indexPath.row])
8080
return cell
8181
} else {
8282
let cell = tableView.dequeueReusableCell(withIdentifier: "environmentVariableCell", for: indexPath) as! EnvironmentVariableTableViewCell
83-
cell.configure(with: SentrySDKOverrides.Tracing.allCases[indexPath.row])
83+
cell.configure(with: SentrySDKOverrides.Tracing.allCases[indexPath.row], float: true)
8484
return cell
8585
}
8686
} else if indexPath.section == 3 {
87-
if SentrySDKOverrides.Profiling.args.contains(SentrySDKOverrides.Profiling.allCases[indexPath.row]) {
87+
if SentrySDKOverrides.Profiling.boolValues.contains(SentrySDKOverrides.Profiling.allCases[indexPath.row]) {
8888
let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell
8989
cell.configure(with: SentrySDKOverrides.Profiling.allCases[indexPath.row])
9090
return cell
9191
} else {
9292
let cell = tableView.dequeueReusableCell(withIdentifier: "environmentVariableCell", for: indexPath) as! EnvironmentVariableTableViewCell
93-
cell.configure(with: SentrySDKOverrides.Profiling.allCases[indexPath.row])
93+
cell.configure(with: SentrySDKOverrides.Profiling.allCases[indexPath.row], float: true)
94+
return cell
95+
}
96+
} else if indexPath.section == 5 {
97+
if SentrySDKOverrides.Other.boolValues.contains(SentrySDKOverrides.Other.allCases[indexPath.row]) {
98+
let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell
99+
cell.configure(with: SentrySDKOverrides.Other.allCases[indexPath.row])
100+
return cell
101+
} else {
102+
let cell = tableView.dequeueReusableCell(withIdentifier: "environmentVariableCell", for: indexPath) as! EnvironmentVariableTableViewCell
103+
cell.configure(with: SentrySDKOverrides.Other.allCases[indexPath.row], float: false)
94104
return cell
95105
}
96106
}
@@ -102,8 +112,6 @@ class FeaturesViewController: UITableViewController {
102112
cell.configure(with: SentrySDKOverrides.Performance.allCases[indexPath.row])
103113
} else if indexPath.section == 4 {
104114
cell.configure(with: SentrySDKOverrides.Feedback.allCases[indexPath.row])
105-
} else if indexPath.section == 5 {
106-
cell.configure(with: SentrySDKOverrides.Other.allCases[indexPath.row])
107115
}
108116
return cell
109117
}

Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class LaunchArgumentTableViewCell: UITableViewCell {
1010
var override: (any SentrySDKOverride)?
1111

1212
@objc func toggleFlag() {
13-
override?.set = flagSwitch.isOn
13+
override?.boolValue = flagSwitch.isOn
1414
}
1515

1616
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
@@ -25,9 +25,9 @@ class LaunchArgumentTableViewCell: UITableViewCell {
2525
fatalError("init(coder:) has not been implemented")
2626
}
2727

28-
func configure(with launchArgument: any SentrySDKOverride) {
29-
titleLabel.text = launchArgument.rawValue as? String
30-
flagSwitch.isOn = launchArgument.set
31-
self.override = launchArgument
28+
func configure(with override: any SentrySDKOverride) {
29+
titleLabel.text = override.rawValue as? String
30+
flagSwitch.isOn = override.boolValue
31+
self.override = override
3232
}
3333
}

Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,41 +62,41 @@ class ProfilingViewController: UIViewController, UITextFieldDelegate {
6262

6363
@IBAction func sampleRateEdited(_ sender: UITextField) {
6464
var sampleRate = SentrySDKOverrides.Profiling.sampleRate
65-
sampleRate.value = getSampleRateOverride(field: sender)
65+
sampleRate.floatValue = getSampleRateOverride(field: sender)
6666
}
6767

6868
@IBAction func tracesSampleRateEdited(_ sender: UITextField) {
6969
var sampleRate = SentrySDKOverrides.Tracing.sampleRate
70-
sampleRate.value = getSampleRateOverride(field: sender)
70+
sampleRate.floatValue = getSampleRateOverride(field: sender)
7171
}
7272

7373
@IBAction func profileAppStartsToggled(_ sender: UISwitch) {
7474
var disableAppStartProfiling = SentrySDKOverrides.Profiling.disableAppStartProfiling
75-
disableAppStartProfiling.set = sender.isOn
75+
disableAppStartProfiling.boolValue = sender.isOn
7676
}
7777

7878
@IBAction func defineProfilesSampleRateToggled(_ sender: UISwitch) {
7979
sampleRateField.isEnabled = sender.isOn
8080

8181
var sampleRate = SentrySDKOverrides.Profiling.sampleRate
82-
sampleRate.value = getSampleRateOverride(field: sampleRateField)
82+
sampleRate.floatValue = getSampleRateOverride(field: sampleRateField)
8383
}
8484

8585
@IBAction func defineTracesSampleRateToggled(_ sender: UISwitch) {
8686
tracesSampleRateField.isEnabled = sender.isOn
8787

8888
var sampleRate = SentrySDKOverrides.Tracing.sampleRate
89-
sampleRate.value = getSampleRateOverride(field: tracesSampleRateField)
89+
sampleRate.floatValue = getSampleRateOverride(field: tracesSampleRateField)
9090
}
9191

9292
@IBAction func traceLifecycleToggled(_ sender: UISwitch) {
9393
var manualLifecycle = SentrySDKOverrides.Profiling.manualLifecycle
94-
manualLifecycle.set = !sender.isOn
94+
manualLifecycle.boolValue = !sender.isOn
9595
}
9696

9797
@IBAction func sessionSampleRateChanged(_ sender: UITextField) {
9898
var sessionSampleRate = SentrySDKOverrides.Profiling.sessionSampleRate
99-
sessionSampleRate.value = getSampleRateOverride(field: sender)
99+
sessionSampleRate.floatValue = getSampleRateOverride(field: sender)
100100
}
101101

102102
// MARK: UITextFieldDelegate

0 commit comments

Comments
 (0)