-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fixed missing „form resume” in audit log events when moving backward in not allowed in Collect settings #5708
Conversation
CollectHelpers.killAndReopenApp() | ||
} | ||
|
||
MainMenuPage().startBlankForm("One Question Audit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd make sense for the test to save and exit the form as well to check the audit log is in the state we think it should be after the session has ended (as that's what would get uploaded).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) | ||
|
||
// kill | ||
device.pressRecentApps() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow I'd not realised you could do this! I think I tried something similar, but kept ending up with the test exiting as soon the app was killed.
A couple of things here:
- I think that
killAndReopenApp
could just be a method onPage
. To be really purist about it, it could take both a package name to restart and a destination page to assert on (here you'd pass"org.odk.collect.android"
and aMainMenuPage
instance). - It looks like this doesn't actual restart the process (
Application#onCreate
is not called again). We do already have a helper for simulating that (CollectHelpers.simulateProcessRestart
could be called after theswipeUp
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that killAndReopenApp could just be a method on Page. To be really purist about it, it could take both a package name to restart and a destination page to assert on (here you'd pass "org.odk.collect.android" and a MainMenuPage instance).
Done but do the package name I used BuildConfig.APPLICATION_ID
so that we don't have to hardcode it.
It looks like this doesn't actual restart the process (Application#onCreate is not called again). We do already have a helper for simulating that (CollectHelpers.simulateProcessRestart could be called after the swipeUp though.
Maybe the process is not restarted to keep the test running... never mind I've added CollectHelpers.simulateProcessRestart()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Would just like to see a couple of tweaks to tests.
67aa129
to
b484904
Compare
It works fine to me if on master that question is also logged only once. I think this will be fixed in #5721 |
Tested with Success! Verified on the device with Android 10 Verified cases:
The mentioned issue will be tested again along with #5721 |
Tested with Success! Verified on the device with Android 13 |
Closes #5253
What has been done to verify that this works as intended?
I've added automated tests and verified the fix manually.
Why is this the best possible solution? Were any other approaches considered?
There is nothing to discuss here.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
It should just fix the issue. I don't think it can affect anything else.
Do we need any specific form for testing your changes? If so, please attach one.
No.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.