Skip to content

Reset cache between tests (particularly on iOS) #156

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

Open
jamesmcn1 opened this issue Jun 12, 2023 · 5 comments
Open

Reset cache between tests (particularly on iOS) #156

jamesmcn1 opened this issue Jun 12, 2023 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@jamesmcn1
Copy link

jamesmcn1 commented Jun 12, 2023

Hey guys, we are looking for a neat way to clean app data cache between tests.

I have read around various solutions none of which for for me:

  1. use fullReset: true and noReset:false capabillity - This restarts the device without the app installed.
  2. browser.reset() or browser.resetApp() - only works for Android

Anyone got any suggestions for this?

@jamesmcn1
Copy link
Author

Answering my own question: brower.reset() works on iOS simulators as long as you provide the filepath to the .app file as a capabillity. Eg:

        "appium:app": '/Users/BLAH/Library/Developer/Xcode/DerivedData/...........',

this combined with fullReset: false and noReset: false provides the desired behaviour

@christian-bromann
Copy link
Member

@jamesmcn1 we received this questions a lot, would you mind helping to get something written in our docs? Maybe we can start with a Mobile Testing section and add a FAQ page in there. Wdyt?

@christian-bromann christian-bromann added the help wanted Extra attention is needed label Dec 15, 2023
@wdio-bot
Copy link

Thanks for reporting!

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

@govza
Copy link

govza commented Sep 6, 2024

For cucumber this hook surprisingly does job for me, with default fullReset and noReset

async beforeScenario() {
   await driver.reloadSession();
 },

@wswebcreation
Copy link
Member

For cucumber this hook surprisingly does job for me, with default fullReset and noReset

async beforeScenario() {
   await driver.reloadSession();
 },

@govza

Great suggestion, but....., please keep in mind that you "completely" release the session (see it as a delete session) and in the case of (physical) devices you give the device back to be cleaned. Depending on the vendor, this cleaning process might take a while, which would negatively impact the test execution.
If this is not an issue for you then no problem at all, this is just extra context for people who want to try your suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants