Moodle Mobile 2 (Ionic 1) End To End Testing: Difference between revisions
Juan Leyva (talk | contribs) |
Juan Leyva (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
This currently only covers testing on Android 4.4 onwards and Chrome. iOS testing is a work in progress. | This currently only covers testing on Android 4.4 onwards and Chrome. iOS testing is a work in progress. | ||
Head to the root directory of your MM instance. | |||
* Install the packages required for testing | |||
npm install (do not use the -g option) | |||
* | |||
* Install the Chrome webdriver | * Install the Chrome webdriver | ||
./node_modules/protractor/bin/webdriver-manager update | |||
* Make sure your checkout is up to date, all the cordova plugins are installed and the android platform is set-up. The following should be enough. | * Make sure your checkout is up to date, all the cordova plugins are installed and the android platform is set-up. The following should be enough. | ||
gulp | |||
ionic state restore | |||
ionic build android | |||
Once this is done, you will need to generate a protactor configuration file for the platform you intend to test the app on. | Once this is done, you will need to generate a protactor configuration file for the platform you intend to test the app on. | ||
Line 44: | Line 23: | ||
* For Android | * For Android | ||
** gulp e2e-build --target android --device abcdefg --version 4.4 | ** gulp e2e-build --target android --device abcdefg --version 4.4 | ||
* For Chrome | * For Chrome (browser) | ||
** gulp e2e-build --target browser | ** gulp e2e-build --target browser | ||
By default the configuration file is saved at e2e/build/protractor.conf.js, should you wish to save the configuration file to re-use it later, you can use the argument --output <filename>. | |||
Other arguments are available, you can find more about them using: | |||
gulp e2e-build -h | |||
gulp e2e-build --target android -h | |||
gulp e2e-build --target browser -h | |||
== Running the suite == | == Running the suite == | ||
Line 56: | Line 43: | ||
* Wait for the driver to be fully started | * Wait for the driver to be fully started | ||
* Run Protractor | * Run Protractor | ||
** | ** ./node_modules/protractor/bin/protractor e2e/build/protractor.conf.js |
Revision as of 08:39, 28 June 2016
Protractor is an end-to-end test framework for AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would.
Setting-up testing environment
This currently only covers testing on Android 4.4 onwards and Chrome. iOS testing is a work in progress.
Head to the root directory of your MM instance.
- Install the packages required for testing
npm install (do not use the -g option)
- Install the Chrome webdriver
./node_modules/protractor/bin/webdriver-manager update
- Make sure your checkout is up to date, all the cordova plugins are installed and the android platform is set-up. The following should be enough.
gulp ionic state restore ionic build android
Once this is done, you will need to generate a protactor configuration file for the platform you intend to test the app on.
Generating Protractor config file
Protractor config file contains all the information for running the tests, as well as to provide the tests with information about the site being tested.
- For Android
- gulp e2e-build --target android --device abcdefg --version 4.4
- For Chrome (browser)
- gulp e2e-build --target browser
By default the configuration file is saved at e2e/build/protractor.conf.js, should you wish to save the configuration file to re-use it later, you can use the argument --output <filename>.
Other arguments are available, you can find more about them using:
gulp e2e-build -h gulp e2e-build --target android -h gulp e2e-build --target browser -h
Running the suite
- Run the ionic first
- ionic serve -b -a
- Start the web driver
- For Android: ./node_modules/appium/bin/appium.js
- For Chrome : ./node_modules/protractor/bin/webdriver-manager start
- Wait for the driver to be fully started
- Run Protractor
- ./node_modules/protractor/bin/protractor e2e/build/protractor.conf.js