Skip to content

Commit

Permalink
RUMM-2872 Allow users to manually end a RUM session
Browse files Browse the repository at this point in the history
  • Loading branch information
maxep committed Apr 3, 2023
1 parent d6bc473 commit df307bf
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 35 deletions.
21 changes: 0 additions & 21 deletions Datadog/Datadog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
490D5EC929C9E17E004F969C /* RUMStopSessionScenarioTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 490D5EC829C9E17E004F969C /* RUMStopSessionScenarioTests.swift */; };
490D5ECF29CA0745004F969C /* RUMStopSessionScenario.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 490D5ECB29C9E2D0004F969C /* RUMStopSessionScenario.storyboard */; };
490D5ED029CA074A004F969C /* KioskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 490D5ECD29CA0738004F969C /* KioskViewController.swift */; };
490D5ED329CA08F7004F969C /* KioskSendEventsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 490D5ED129CA087D004F969C /* KioskSendEventsViewController.swift */; };
490D5ED629CA1DD6004F969C /* KioskSendInterruptedEventsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 490D5ED429CA1D9F004F969C /* KioskSendInterruptedEventsViewController.swift */; };
49274906288048B500ECD49B /* InternalTelemetryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49274903288048AA00ECD49B /* InternalTelemetryTests.swift */; };
49274907288048B800ECD49B /* InternalTelemetryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49274903288048AA00ECD49B /* InternalTelemetryTests.swift */; };
4927490B288048FF00ECD49B /* RUMInternalProxyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49274908288048F400ECD49B /* RUMInternalProxyTests.swift */; };
Expand Down Expand Up @@ -1517,11 +1512,6 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
490D5EC829C9E17E004F969C /* RUMStopSessionScenarioTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RUMStopSessionScenarioTests.swift; sourceTree = "<group>"; };
490D5ECB29C9E2D0004F969C /* RUMStopSessionScenario.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = RUMStopSessionScenario.storyboard; sourceTree = "<group>"; };
490D5ECD29CA0738004F969C /* KioskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KioskViewController.swift; sourceTree = "<group>"; };
490D5ED129CA087D004F969C /* KioskSendEventsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KioskSendEventsViewController.swift; sourceTree = "<group>"; };
490D5ED429CA1D9F004F969C /* KioskSendInterruptedEventsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KioskSendInterruptedEventsViewController.swift; sourceTree = "<group>"; };
49274903288048AA00ECD49B /* InternalTelemetryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InternalTelemetryTests.swift; sourceTree = "<group>"; };
49274908288048F400ECD49B /* RUMInternalProxyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RUMInternalProxyTests.swift; sourceTree = "<group>"; };
61020C292757AD91005EEAEA /* BackgroundLocationMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundLocationMonitor.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2436,17 +2426,6 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
490D5ECA29C9E28F004F969C /* StopSessionScenario */ = {
isa = PBXGroup;
children = (
490D5ECB29C9E2D0004F969C /* RUMStopSessionScenario.storyboard */,
490D5ECD29CA0738004F969C /* KioskViewController.swift */,
490D5ED129CA087D004F969C /* KioskSendEventsViewController.swift */,
490D5ED429CA1D9F004F969C /* KioskSendInterruptedEventsViewController.swift */,
);
path = StopSessionScenario;
sourceTree = "<group>";
};
61020C272757AD63005EEAEA /* BackgroundEvents */ = {
isa = PBXGroup;
children = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class RUMStopSessionScenarioTests: IntegrationTests, RUMCommonAsserts {

let view1 = appStartSession.viewVisits[0]
XCTAssertEqual(view1.name, "KioskViewController")
XCTAssertEqual(view1.path, "Example.KioskViewController")
XCTAssertEqual(view1.path, "Runner.KioskViewController")
XCTAssertEqual(view1.viewEvents.last?.session.isActive, false)
RUMSessionMatcher.assertViewWasEventuallyInactive(view1)
}
Expand All @@ -96,7 +96,7 @@ class RUMStopSessionScenarioTests: IntegrationTests, RUMCommonAsserts {
let view1 = normalSession.viewVisits[0]
XCTAssertTrue(try XCTUnwrap(view1.viewEvents.first?.session.isActive))
XCTAssertEqual(view1.name, "KioskSendEvents")
XCTAssertEqual(view1.path, "Example.KioskSendEventsViewController")
XCTAssertEqual(view1.path, "Runner.KioskSendEventsViewController")
XCTAssertEqual(view1.resourceEvents[0].resource.url, "https://foo.com/resource/1")
XCTAssertEqual(view1.resourceEvents[0].resource.statusCode, 200)
XCTAssertEqual(view1.resourceEvents[0].resource.type, .image)
Expand All @@ -106,7 +106,7 @@ class RUMStopSessionScenarioTests: IntegrationTests, RUMCommonAsserts {

let view2 = normalSession.viewVisits[1]
XCTAssertEqual(view2.name, "KioskViewController")
XCTAssertEqual(view2.path, "Example.KioskViewController")
XCTAssertEqual(view2.path, "Runner.KioskViewController")
XCTAssertEqual(view2.viewEvents.last?.session.isActive, false)
RUMSessionMatcher.assertViewWasEventuallyInactive(view2)
}
Expand All @@ -119,7 +119,7 @@ class RUMStopSessionScenarioTests: IntegrationTests, RUMCommonAsserts {
let view1 = interruptedSession.viewVisits[0]
XCTAssertTrue(try XCTUnwrap(view1.viewEvents.first?.session.isActive))
XCTAssertEqual(view1.name, "KioskSendInterruptedEvents")
XCTAssertEqual(view1.path, "Example.KioskSendInterruptedEventsViewController")
XCTAssertEqual(view1.path, "Runner.KioskSendInterruptedEventsViewController")
XCTAssertEqual(view1.resourceEvents[0].resource.url, "https://foo.com/resource/1")
XCTAssertEqual(view1.resourceEvents[0].resource.statusCode, 200)
XCTAssertEqual(view1.resourceEvents[0].resource.type, .image)
Expand All @@ -129,7 +129,7 @@ class RUMStopSessionScenarioTests: IntegrationTests, RUMCommonAsserts {

let view2 = interruptedSession.viewVisits[1]
XCTAssertEqual(view2.name, "KioskViewController")
XCTAssertEqual(view2.path, "Example.KioskViewController")
XCTAssertEqual(view2.path, "Runner.KioskViewController")
XCTAssertEqual(view2.viewEvents.last?.session.isActive, false)
RUMSessionMatcher.assertViewWasEventuallyInactive(view2)
}
Expand Down
28 changes: 28 additions & 0 deletions IntegrationTests/IntegrationTests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@
9EC2835E26CFF57A00FACF1C /* RUMMobileVitalsScenario.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9EC2835D26CFF57A00FACF1C /* RUMMobileVitalsScenario.storyboard */; };
9EC2836026CFF59400FACF1C /* RUMMobileVitalsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC2835F26CFF59400FACF1C /* RUMMobileVitalsViewController.swift */; };
D218665029967CBC006F5B23 /* RUMDataModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = D218664E29967CBC006F5B23 /* RUMDataModels.swift */; };
D22F06CF29DAE5360026CC3C /* KioskSendInterruptedEventsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22F06CB29DAE5360026CC3C /* KioskSendInterruptedEventsViewController.swift */; };
D22F06D029DAE5360026CC3C /* KioskSendEventsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22F06CC29DAE5360026CC3C /* KioskSendEventsViewController.swift */; };
D22F06D129DAE5360026CC3C /* KioskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22F06CD29DAE5360026CC3C /* KioskViewController.swift */; };
D22F06D229DAE5360026CC3C /* RUMStopSessionScenario.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D22F06CE29DAE5360026CC3C /* RUMStopSessionScenario.storyboard */; };
D240688627CFA64A00C04F44 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D240688427CFA64A00C04F44 /* LaunchScreen.storyboard */; };
D263BCB829DB057E00FA0E21 /* RUMStopSessionScenarioTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22F06D329DAE59A0026CC3C /* RUMStopSessionScenarioTests.swift */; };
D2774EE4299E2E90004EC36A /* RUMSessionMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2774EDF299E2E90004EC36A /* RUMSessionMatcher.swift */; };
D2774EE5299E2E90004EC36A /* RUMEventMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2774EE0299E2E90004EC36A /* RUMEventMatcher.swift */; };
D2774EE6299E2E90004EC36A /* SpanMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2774EE1299E2E90004EC36A /* SpanMatcher.swift */; };
Expand Down Expand Up @@ -217,6 +222,11 @@
D223CA4F29966B18000CEDBF /* Runner.release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Runner.release.xcconfig; sourceTree = "<group>"; };
D223CA5029966B19000CEDBF /* Runner.debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Runner.debug.xcconfig; sourceTree = "<group>"; };
D223CA5129966B19000CEDBF /* Runner.integration.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Runner.integration.xcconfig; sourceTree = "<group>"; };
D22F06CB29DAE5360026CC3C /* KioskSendInterruptedEventsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KioskSendInterruptedEventsViewController.swift; sourceTree = "<group>"; };
D22F06CC29DAE5360026CC3C /* KioskSendEventsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KioskSendEventsViewController.swift; sourceTree = "<group>"; };
D22F06CD29DAE5360026CC3C /* KioskViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KioskViewController.swift; sourceTree = "<group>"; };
D22F06CE29DAE5360026CC3C /* RUMStopSessionScenario.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = RUMStopSessionScenario.storyboard; sourceTree = "<group>"; };
D22F06D329DAE59A0026CC3C /* RUMStopSessionScenarioTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RUMStopSessionScenarioTests.swift; sourceTree = "<group>"; };
D240688527CFA64A00C04F44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
D2774EDF299E2E90004EC36A /* RUMSessionMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RUMSessionMatcher.swift; sourceTree = "<group>"; };
D2774EE0299E2E90004EC36A /* RUMEventMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RUMEventMatcher.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -404,6 +414,7 @@
6193DCA2251B5669009B8011 /* TapActionAutoInstrumentation */,
D2791EF32716F16E0046E07A /* SwiftUIInstrumentation */,
612D8F6725AEE65F000E2E09 /* Scrubbing */,
D22F06CA29DAE5360026CC3C /* StopSessionScenario */,
);
path = RUM;
sourceTree = "<group>";
Expand Down Expand Up @@ -593,6 +604,7 @@
612D8F8025AF1C74000E2E09 /* RUMScrubbingScenarioTests.swift */,
9EC2835926CFEE0B00FACF1C /* RUMMobileVitalsScenarioTests.swift */,
D2791EF827170A760046E07A /* RUMSwiftUIScenarioTests.swift */,
D22F06D329DAE59A0026CC3C /* RUMStopSessionScenarioTests.swift */,
);
path = RUM;
sourceTree = "<group>";
Expand Down Expand Up @@ -643,6 +655,17 @@
path = ../../Sources/Datadog/RUM/DataModels;
sourceTree = "<group>";
};
D22F06CA29DAE5360026CC3C /* StopSessionScenario */ = {
isa = PBXGroup;
children = (
D22F06CB29DAE5360026CC3C /* KioskSendInterruptedEventsViewController.swift */,
D22F06CC29DAE5360026CC3C /* KioskSendEventsViewController.swift */,
D22F06CD29DAE5360026CC3C /* KioskViewController.swift */,
D22F06CE29DAE5360026CC3C /* RUMStopSessionScenario.storyboard */,
);
path = StopSessionScenario;
sourceTree = "<group>";
};
D2774EDE299E2E90004EC36A /* Matchers */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -794,6 +817,7 @@
61337039250F852E00236D58 /* RUMManualInstrumentationScenario.storyboard in Resources */,
6193DCA4251B5691009B8011 /* RUMTapActionScenario.storyboard in Resources */,
6167ACC7251A0BCE0012B4D0 /* NSURLSessionScenario.storyboard in Resources */,
D22F06D229DAE5360026CC3C /* RUMStopSessionScenario.storyboard in Resources */,
6111543625C993C2007C84C9 /* CrashReportingScenario.storyboard in Resources */,
D240688627CFA64A00C04F44 /* LaunchScreen.storyboard in Resources */,
61441C0E24616DEC003D8BB8 /* Assets.xcassets in Resources */,
Expand Down Expand Up @@ -869,6 +893,7 @@
files = (
D2F5BB382718331800BDE2A4 /* SwiftUIRootViewController.swift in Sources */,
618DCFE124C766F500589570 /* SendRUMFixture2ViewController.swift in Sources */,
D22F06CF29DAE5360026CC3C /* KioskSendInterruptedEventsViewController.swift in Sources */,
9EA95C1E2791C9BE00F6C1F3 /* WebViewScenarios.swift in Sources */,
61F9CA8025125C01000A5E61 /* RUMNCSScreen3ViewController.swift in Sources */,
6164AE89252B4ECA000D78C4 /* SendThirdPartyRequestsViewController.swift in Sources */,
Expand All @@ -877,10 +902,12 @@
61163C37252DDD60007DD5BF /* RUMMVSViewController.swift in Sources */,
61D50C5A2580EFF3006038A3 /* URLSessionScenarios.swift in Sources */,
614CADCE250FCA0200B93D2D /* TestScenarios.swift in Sources */,
D22F06D029DAE5360026CC3C /* KioskSendEventsViewController.swift in Sources */,
6111542525C992F8007C84C9 /* CrashReportingScenarios.swift in Sources */,
61441C972461A649003D8BB8 /* UIViewController+KeyboardControlling.swift in Sources */,
61098D2B27FEE3F00021237A /* MessagePortChannel.swift in Sources */,
61B9ED1C2461E12000C0DCFF /* SendLogsFixtureViewController.swift in Sources */,
D22F06D129DAE5360026CC3C /* KioskViewController.swift in Sources */,
6111543F25C996A5007C84C9 /* CrashReportingViewController.swift in Sources */,
61B9ED1D2461E12000C0DCFF /* SendTracesFixtureViewController.swift in Sources */,
61D50C542580EF41006038A3 /* RUMScenarios.swift in Sources */,
Expand Down Expand Up @@ -944,6 +971,7 @@
6164AF2E252C9C51000D78C4 /* RUMResourcesScenarioTests.swift in Sources */,
D2774EE8299E2E90004EC36A /* JSONDataMatcher.swift in Sources */,
615AAC07251E217B00C89EE9 /* RUMTapActionScenarioTests.swift in Sources */,
D263BCB829DB057E00FA0E21 /* RUMStopSessionScenarioTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<!--Kiosk View Controller-->
<scene sceneID="2ej-Cn-qUm">
<objects>
<viewController id="HWL-sJ-Uva" customClass="KioskViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="HWL-sJ-Uva" customClass="KioskViewController" customModule="Runner" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="OnK-cG-SPL">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand All @@ -46,19 +46,19 @@
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="J0F-rs-xxG">
<rect key="frame" x="134" y="409" width="125" height="35"/>
<rect key="frame" x="151" y="409" width="91" height="30"/>
<color key="tintColor" red="0.4720349908" green="0.26942917700000002" blue="0.70946907999999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="Start Session"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Start Session"/>
<connections>
<segue destination="E9R-Yv-ijK" kind="show" id="CYq-bh-AIO"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZEd-cH-nWO">
<rect key="frame" x="89" y="452" width="215" height="35"/>
<rect key="frame" x="110.66666666666669" y="447" width="172" height="30"/>
<color key="tintColor" red="0.4720349908" green="0.26942917700000002" blue="0.70946907999999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="Start Interrupted Session"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Start Interrupted Session"/>
<connections>
<segue destination="bOA-4i-jjr" kind="show" id="86x-Fq-oKe"/>
</connections>
Expand Down Expand Up @@ -87,7 +87,7 @@
<!--Kiosk Send Events View Controller-->
<scene sceneID="cmb-A4-Fwu">
<objects>
<viewController id="E9R-Yv-ijK" customClass="KioskSendEventsViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="E9R-Yv-ijK" customClass="KioskSendEventsViewController" customModule="Runner" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Q2Q-l7-ltJ">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down Expand Up @@ -138,7 +138,7 @@
<!--Kiosk Send Interrupted Events View Controller-->
<scene sceneID="Pcy-80-2t2">
<objects>
<viewController id="bOA-4i-jjr" customClass="KioskSendInterruptedEventsViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="bOA-4i-jjr" customClass="KioskSendInterruptedEventsViewController" customModule="Runner" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="kmP-j2-UfY">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down

0 comments on commit df307bf

Please sign in to comment.