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
bug: noReset and enforceFreshSimulatorCreation on xcuidriver do not act as expected with simulators #18814
Comments
What is your initial intention there? Do you want a new simulator to be created every time a new test is started? I assume it takes a lot of time and it would make sense to simply provide |
Also the fact that setting |
My intention is to NOT create a new simulator every time. But unfortunately setting appium:noReset = false and appium:enforceFreshSimulatorCreation = false unfortunately does sometimes create a new simulator every time right now due to a potential bug. I currently can reproduce the behaviour with the step:
|
The problem is not that it creates a new one in the beginning but delete the simulator in the end of the test which results in creating a new one again next time. |
the driver has a concept of life cycle and thus always assumes that if the simulator was created by it then it must also be deleted at the end to complete the life cycle. So if you want to reuse the simulator it would make sense to precreate a new one using simctl and then just provide its uuid to capabilities. |
Thanks for the clarification. Maybe the documentation at https://appium.github.io/appium-xcuitest-driver/4.32.7/capabilities/ should be updated for this. I think the information for noReset and enforceFreshSimulatorCreation are quite confusing there. Thanks also for the workaround to create a simulator manually. I will continue with this although I think there is a bug that sometimes the automatically generated simulator (called appiumTest...) is not always deleted which gave me the impression there is a right way to reuse a automatically created simulator. But now (as far as i understood your explanation) there currently is no way to use the function to automatically generated simulator together with a capability that deletes the app but not the WDA or the simulator. Did I understood this correctly? |
I assume this part of the code has not been touched for very long time. I'll create a PR to properly align the logic there |
The idea is that if you want a Simulator to be reused then you should not assign its creation to the driver. This is how the ownership works: if I create a Simulator then this is also my responsibility to delete it later (or to keep it), - if the driver does that then it is also up to the driver to delete/cleanup it whenever needed. |
Based on the above explanation - yes, it is not possible to preserve a simulator that is created automatically by the driver. |
Thank you for the effort, Nick. Would it be possible to reflect this somewhere in the documentation of xcuidriver to help future users? |
I have aligned the actual behaviour in the driver code. Not sure what to change in the docs though. Feel free to propose a PR yourself. Driver docs could be found at https://github.com/appium/appium-xcuitest-driver/tree/master/docs |
This information has since been added to the XCUITest documentation: https://appium.github.io/appium-xcuitest-driver/latest/guides/troubleshooting/#simulator-resetting |
Do I have the most recent component updates?
Is the component officially supported by the Appium team?
Is there an existing issue for this?
Current Behavior
The documentation of xcuidriver explains the capabiltiy
enforceFreshSimulatorCreation
like this: "Creates a new simulator in session creation and deletes it in session deletion. Defaults to false."Steps:
appium:noReset = false
andappium:enforceFreshSimulatorCreation = false
. You can find the output in the gist.Current Behaviour:
The simulator is deleted after the session ended (see log) even though enforceFreshSimulatorCreation is set to false
It seems this is caused by a wrong implementation of noReset in xcuitest driver here: https://github.com/appium/appium-xcuitest-driver/blob/master/lib/driver.js#L1008 (because i see no check against enforceFreshSimulatorCreation in this code).
Or by the "TEST EXECUTE INTERRUPTED" after the test finished successfully (see gist).
Expected Behavior
Minimal Reproducible Example
See gist
Environment
appium --version
): v2.0.0-rc.3node --version
): v18.14.0npm
version (output ofnpm --version
): 9.3.1Link to Appium Logs
https://gist.github.com/mythsunwind/bb8e27cee5d96786dd18606401f673a8
Futher Information
I experience another strange behaviour regarding noReset: If noReset is set once to true and then to false again the simulator is not deleted until i delete it manually. After that the simulator is deleted every time after the test. i cannot explain this behaviour.
The text was updated successfully, but these errors were encountered: