RUM-1005 Add the SR functional tests for sensitive input fields#1601
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1601 +/- ##
===========================================
- Coverage 83.67% 83.66% -0.00%
===========================================
Files 451 451
Lines 15563 15567 +4
Branches 2318 2318
===========================================
+ Hits 13021 13024 +3
- Misses 1928 1931 +3
+ Partials 614 612 -2
... and 17 files with indirect coverage changes 📢 Have feedback on the report? Share it here. |
| STORAGE_CONFIGURATION | ||
|
|
||
| override fun onStop() { | ||
| Log.v("SessionReplayFeature", "====================onStop") |
7e10cc3 to
3c567e1
Compare
| .getInstrumentation() | ||
| .targetContext | ||
| .cacheDir.deleteRecursively { | ||
| Log.i("MockServerActivityTestRule", "After activity finished, deleting file $it") |
There was a problem hiding this comment.
well not so much....it was before to make sure it is deleting the files but right now we are not checking it anymore
| GlobalRumMonitor.get().stopSession() | ||
| Datadog.stopInstance() | ||
| GlobalRumMonitor::class.java.getDeclaredMethod("reset").apply { | ||
| isAccessible = true | ||
| invoke(null) | ||
| } |
There was a problem hiding this comment.
we already doing this in the MockServerActivityTestRule, so aren't we doing this twice then?
| val sessionReplaySampleRate = intent.getSrSampleRate() | ||
| Datadog.setVerbosity(Log.VERBOSE) | ||
| // make sure the previous instance is stopped | ||
| Datadog.stopInstance() |
There was a problem hiding this comment.
is there any bug without this line?
There was a problem hiding this comment.
not quite but there was some flakiness on my end and wanted to actually make sure that everything is stopped before my test starts to avoid any issues
| <string name="default_password_label">Default password</string> | ||
| <string name="a_password">apassword</string> | ||
| <string name="a_number_password">1213213</string> | ||
| <string name="an_email">[email protected]</string> |
There was a problem hiding this comment.
it can be a real user email, so to avoid any issues maybe we should use some email which for sure doesn't exist?
There was a problem hiding this comment.
how would you know it doesn't exist ? In any case the value doesn't really matter here as I am using the inputType of the field in my code.
There was a problem hiding this comment.
We should use either email from Datadog domain (some no-reply address for example), or something from https://example.com/ domain.
| fun tearDown() { | ||
| GlobalRumMonitor.get().stopSession() | ||
| Datadog.stopInstance() | ||
| GlobalRumMonitor::class.java.getDeclaredMethod("reset").apply { |
There was a problem hiding this comment.
why it is needed? If instance is stopped, then nothing will be written anyway.
I can see the functional gap here however, because probably if we register instance with the same name as before, monitor will be still the old one, since we don't clean global RUM monitor when we stop SDK instance, I will create a ticket for it.
There was a problem hiding this comment.
yeah...for now I want to keep this here to make sure everything is cleaned but yes I will open a ticket for later.
3c567e1 to
d628bf1
Compare
4e3b8e6 to
82dd7a4
Compare
82dd7a4 to
38139e8
Compare
38139e8 to
6d14b04
Compare
|
|
||
| @NoOpImplementation | ||
| internal interface Recorder { | ||
| @MainThread |
There was a problem hiding this comment.
because the way I implemented them in the recorder allow them to be called on any thread. In the recorder they are being passed through an uiThread handler
| @Synchronized | ||
| internal fun clearAndStopProcessingQueue() { | ||
| recordedDataQueue.clear() | ||
| executorService.shutdown() |
There was a problem hiding this comment.
should it be shutdownNow? Not sure if will make the difference though in this particular case, but shutdown will wait until already started tasks are completed.
There was a problem hiding this comment.
yes....that's what I want, I want to avoid stopping anything in progress as it can create more issues.
What does this PR do?
Adding the functional tests for SR sensitive input fields use cases.
Apart from the functional tests we also applied several fixes:
Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)