-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
device: add resetContentAndSettings
#217
device: add resetContentAndSettings
#217
Conversation
@@ -173,6 +173,14 @@ class Fbsimctl { | |||
await this._execFbsimctlCommand(options); | |||
} | |||
|
|||
async resetContentAndSettings(udid) { |
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 this is better suited as an input param to device.launchApp(), inline with other API we have.
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.
CC @rotemmiz
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.
how would you name that param? clean
?
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.
Not sure it fits launchApp
since it has no relation to the app, it's more of a device function (like setLocation
or setOrientation
)
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.
clean
can be confusing, since a user might think this option cleans the app, not resets the entire simulator.
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.
👍
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.
so is it alright then or do you want me to change something?
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.
@LeoNatan just wanted to know if there are still concerns about the PR?
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 don't think so. Need @rotemmiz to approve it, as he is the JS master around here. 😄
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.
Never wished for this title :( ...
Let's talk a bit about the API:
- I don't this is not a good API for reseting a permission, I much prefer if we can add an unset state to permissions with
appleSimUtils
Unsetting an already set permission AppleSimulatorUtils#8 - Can there still can be a valid test case for resetting a device?
- Since we aim Detox to be multi-platform framework I prefer not to give this method a name which is strongly recognized with Apple's terms, let's try thinking of something more generic maybe, like
reset
orclearData
(not sure if these are better names). WDYT ?
detox/test/e2e/f-device.js
Outdated
@@ -1,4 +1,4 @@ | |||
describe('Device', () => { | |||
describe.only('Device', () => { |
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.
don't forget to remove the only
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.
oops, good point
@@ -173,6 +173,14 @@ class Fbsimctl { | |||
await this._execFbsimctlCommand(options); | |||
} | |||
|
|||
async resetContentAndSettings(udid) { |
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.
Never wished for this title :( ...
Let's talk a bit about the API:
- I don't this is not a good API for reseting a permission, I much prefer if we can add an unset state to permissions with
appleSimUtils
Unsetting an already set permission AppleSimulatorUtils#8 - Can there still can be a valid test case for resetting a device?
- Since we aim Detox to be multi-platform framework I prefer not to give this method a name which is strongly recognized with Apple's terms, let's try thinking of something more generic maybe, like
reset
orclearData
(not sure if these are better names). WDYT ?
|
I added a new method to device to cleanup the device (like "Simulator > Reset Content and Settings" menu-item does), because I want to test specific screens which are only shown when the permissions are not set yet (e.g. a screen for explaining why the specific permission is needed)