On the first of November I started a new assignment at Tele2 to set up the testautomation for their new React Native app. This was a complete new and exciting challenge after working for more than 4 years with Angular(JS) and Protractor.
During the first weeks I already created the basics and started to automate on Android emulators and iOS simulators to get the right feeling. I then saw that I switched a lot between the simulators (different iPhones and different OS versions) and I got tired using the Simulator menu to select a device and killing the previous one (something with too many mouse clicks over and over again).
The thing with me is that when I get tired of doing something I like to build a script for it. So last week I started diving into the command line options to start / kill iOS simulators and I created a script for it. I also connected it to my test setup, which consists out of
- Webdriver.io, which is by the way an awesome tool,
and I came up with the following code. With this script you can:
- choose from all the installed iOS simulators on your machine
- kill the simulator if it is not equal to the selected one
- start your tests on the selected emulator
This is still a brain fart and needs to be refactored, but it works like a charm.
You can check the code on GitHubGist, or below.
I hope you like it and if you have questions / remarks please let me know.
By the way, as you may have seen in the GIF I’m also creating my own React Native app. I want to use it for test automation purposes (mocking / testing a webview / chat and so on) and writing more blogs like this ;-). I hope to post more about it in the beginning of 2018.
- Image created and Designed by makyzz / Freepik