Open bartekpacia opened 1 year ago
@bartekpacia I've tried to delete app data by following this command xcrun simctl get_app_container <device> <bundleid> data
and delete the file (https://stackoverflow.com/a/56746729) and it looks like the app screen state is restored to the beginning flow (login page), as previously I have always been returned to the homepage every time I run ios test.
But the deletion I did does not restore app permission (like location and notif permission) like what android test does.
@piotruela / @jBorkowska
@bartekpacia I've tried to delete app data by following this command
xcrun simctl get_app_container <device> <bundleid> data
and delete the file (https://stackoverflow.com/a/56746729) and it looks like the app screen state is restored to the beginning flow (login page), as previously I have always been returned to the homepage every time I run ios test.But the deletion I did does not restore app permission (like location and notif permission) like what android test does.
@farizkah Can you share the way how did use this command while running the tests xcrun simctl get_app_container <device> <bundleid> data
? I am looking a workaround for this bug, and it seems that i could run this command before every test so to be sure that my database file is deleted before every run. But i do not know the way to implement it in the run time, getting error ProcessException: Starting new processes is not supported on iOS
when trying to run a shell command to fetch the path of the file and to delete it. Any insight would be much appreciated, since this is kinda blocking us to write the tests for iOS platform. Thank you in advance
When running tests on iOS, if some data is saved into, for example,
NSUserDefaults
during the first test, it'll be there in subsequent tests.This behavior differs from Android. On Android, there's the great Android Test Orchestrator. It makes it easy to clear app data between test runs by setting the
clearPackageData = true
flag.I searched for a solution to this problem on iOS and didn't find anything similar to Android Test Orchestrator's
clearPackageData
flag.Pages I looked at:
XCUITest Reset Application State
How to delete/reset an app from iOS 13 with XCTest?
This might be worth checking out. I wonder how it even works, more specifically: how can the instrumentation app start the app under test after the app under test was deleted?
How do I reset the application data after each test with Xcode 7 UI Testing?