-
Notifications
You must be signed in to change notification settings - Fork 208
Use Maze Runner dedicated idempotent commands #2322
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
285487c
Use maze runner idempotent commands
899ca57
Prevent activity being recreated on rotation
72419e1
logging
62b35df
Log savedInstanceState
ce03c6f
Don't start command runner on activity recreate
44aaa5b
Factor out functions into separate class
1c7ec2d
Increase timeout for reading the fixture config file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
53 changes: 53 additions & 0 deletions
53
...es/fixtures/mazerunner/app/src/main/java/com/bugsnag/android/mazerunner/PersistentData.kt
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package com.bugsnag.android.mazerunner | ||
|
|
||
| import android.content.Context | ||
| import java.io.File | ||
|
|
||
| class PersistentData(private val applicationContext: Context) { | ||
lemnik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Clear persistent data (used to stop scenarios bleeding into each other) | ||
| fun clear() { | ||
| CiLog.info("Clearing persistent data") | ||
| clearCacheFolder("bugsnag") | ||
| clearCacheFolder("StrictModeDiscScenarioFile") | ||
| clearFilesFolder("background-service-dir") | ||
|
|
||
| removeFile("device-id") | ||
| removeFile("internal-device-id") | ||
|
|
||
| listFolders() | ||
| } | ||
|
|
||
| // Recursively deletes the contents of a folder beneath /cache | ||
| private fun clearCacheFolder(name: String) { | ||
| val folder = File(applicationContext.cacheDir, name) | ||
| log("Clearing folder: ${folder.path}") | ||
| folder.deleteRecursively() | ||
| } | ||
|
|
||
| private fun clearFilesFolder(name: String) { | ||
| val folder = File(applicationContext.filesDir, name) | ||
| log("Clearing folder: ${folder.path}") | ||
| folder.deleteRecursively() | ||
| } | ||
|
|
||
| // Deletes a file beneath /files | ||
| private fun removeFile(name: String) { | ||
| val file = File(applicationContext.filesDir, name) | ||
| log("Removing file: ${file.path}") | ||
| file.delete() | ||
| } | ||
|
|
||
| // Logs out the contents of the /cache and /files folders | ||
| private fun listFolders() { | ||
| log("Contents of: ${applicationContext.cacheDir}") | ||
| applicationContext.cacheDir.walkTopDown().forEach { | ||
| log(it.absolutePath) | ||
| } | ||
|
|
||
| log("Contents of: ${applicationContext.filesDir}") | ||
| applicationContext.filesDir.walkTopDown().forEach { | ||
| log(it.absolutePath) | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.