Skip to content
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

App data is not cleared between test runs on iOS #1317

Open
bartekpacia opened this issue May 25, 2023 · 3 comments
Open

App data is not cleared between test runs on iOS #1317

bartekpacia opened this issue May 25, 2023 · 3 comments
Labels
blocked Blocked by external factors bug Something isn't working platform: ios iOS is affected

Comments

@bartekpacia
Copy link
Contributor

bartekpacia commented May 25, 2023

See also epic issue about test bundling.

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:

@bartekpacia bartekpacia added the bug Something isn't working label May 25, 2023
@bartekpacia bartekpacia added the platform: ios iOS is affected label Sep 15, 2023
@bartekpacia bartekpacia added the blocked Blocked by external factors label Nov 16, 2023
@farizkah
Copy link

farizkah commented Feb 1, 2024

@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
Copy link

farizkah commented Feb 2, 2024

@piotruela / @jBorkowska

@mzivkovic-symphony
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by external factors bug Something isn't working platform: ios iOS is affected
Projects
None yet
Development

No branches or pull requests

3 participants