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

Add detox preStart script in config json #60

Closed
yedidyak opened this issue Dec 18, 2016 · 5 comments
Closed

Add detox preStart script in config json #60

yedidyak opened this issue Dec 18, 2016 · 5 comments

Comments

@yedidyak
Copy link
Contributor

yedidyak commented Dec 18, 2016

For example:

"detox": {
   **"beforeStart": "npm run fake-server",**
    "session": {
      "server": "ws://localhost:8099",
      "sessionId": "abc"
    },
    "ios-simulator": {
      "app": "ios/DerivedData/WixOneApp/Build/Products/Debug-iphonesimulator/ABC.app",
      "device": "iPhone 6s, iOS 10.1"
    }
  }
@LeoNatan
Copy link
Contributor

LeoNatan commented Jun 6, 2017

You can achieve this with a script already. @rotemmiz Do you think we should implement?

@rotemmiz
Copy link
Member

This may be a good idea for running short lived tasks, but running servers is a pretty complex thing to deal with. We would need to save the forked process id and make sure it is killed when Detox dies. Starting to listen on signals and creating a complex mechanism for cleanup is not something I think Detox should be focused around.

Instead, I suggest that running mock servers (Node servers) will be a part of your test case, as such: https://github.com/wix/detox/blob/master/detox/test/e2e/m-network.js

@guyca
Copy link

guyca commented Mar 4, 2018

@rotemmiz Can we use a similar approach to deal with disabling animations on android emulator?
Would be handy to be able to execute some script before tests run and after the emulator is running so I can setup my environment.

@AFGhazy
Copy link

AFGhazy commented Mar 16, 2018

Is this resolved yet ?

@rotemmiz
Copy link
Member

rotemmiz commented Mar 16, 2018

The thing @guyca mentioned was resolved here: https://github.com/wix/react-native-navigation/blob/v2/e2e/init.js

Regarding the preStart script, I find it to be a confusing and a bad pattern. If you need something to be initiated or controlled, solve it from inside the test script.

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants