1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Add npm scripts for running visual tests

This commit is contained in:
Brett Sun 2016-01-29 11:26:10 +01:00
parent 331fdb528d
commit 83b5b09b87
2 changed files with 42 additions and 8 deletions

View File

@ -42,21 +42,32 @@ Running Tests
Run PhantomJS:
```bash
phantomjs --webdriver=4444
npm run vi-phantom
```
And then run Gemini tests:
```bash
# In root onion/
gemini test gemini/* --report html
npm run vi-test
# Run only main tests
npm run vi-test:main
# Run only whitelabel tests
npm run vi-test:whitelabel
# Run only specific whitelabel tests
npm run vi-test:cyland
```
If you've made changes and want them to be the new baseline (ie. it's a correct change--**make sure** to test there are no regressions first!), use
If you've made changes and want them to be the new baseline (ie. it's a correct change--**make sure** to test there are
no regressions first!), use
```bash
# In root onion/
gemini update gemini/*
npm run vi-update
# Update just the main app for desktop and mobile
npm run vi-update -- --browser MainDesktop --browser MainMobile
```
@ -112,6 +123,8 @@ are available.
Our tests are located in `onion/gemini/`.
**It would be nice if we kept the whitelabels up to date.**
Some useful tips:
* The `find()` method in the callbacks is equivalent to `document.querySelector`; it will only return the first
element found that matches the selector. Use pseudo classes like `nth-of-type()`, `nth-child()`, and etc. to select
@ -181,3 +194,11 @@ change the environment to run against.
# In root /onion folder
phantomjs phantomjs/launch_app_and_login.js
```
TODO
====
* Write scripts to automate creation of test users (and modify tests to accomodate)
* Set scripts with rootUrls pointing to staging / live using environment variables
* Set up with Sauce Labs

View File

@ -10,7 +10,20 @@
"lint": "eslint ./js",
"postinstall": "npm run build",
"build": "gulp build --production",
"start": "node server.js"
"start": "node server.js",
"vi-clean": "rm -rf gemini-report",
"vi-phantom": "phantomjs --webdriver=4444",
"vi-update": "gemini update",
"vi-test": "npm run vi-clean && gemini test --reporter html --reporter vflat || true",
"vi-test:all": "npm run vi-test",
"vi-test:main": "npm run vi-test -- --browser MainDesktop --browser MainMobile",
"vi-test:whitelabel": "GEMINI_BROWSERS='CcDesktop, CcMobile, CylandDesktop, CylandMobile, IkonotvDesktop, IkonotvMobile, LumenusDesktop, LumenusMobile, 23viviDesktop, 23viviMobile' npm run vi-test",
"vi-test:cc": "npm run vi-test -- --browser CcDesktop --browser CcMobile",
"vi-test:cyland": "npm run vi-test -- --browser CylandDesktop --browser CylandMobile",
"vi-test:ikonotv": "npm run vi-test -- --browser IkonotvDesktop --browser IkonotvMobile",
"vi-test:lumenus": "npm run vi-test -- --browser LumenusDesktop --browser LumenusMobile",
"vi-test:23vivi": "npm run vi-test -- --browser 23viviDesktop --browser 23viviMobile"
},
"browser": {
"fineUploader": "./js/components/ascribe_uploader/vendor/s3.fine-uploader.js"
@ -35,7 +48,7 @@
"devDependencies": {
"babel-eslint": "^3.1.11",
"babel-jest": "^5.2.0",
"gemini": "^2.0.3",
"gemini": "^2.1.0",
"gulp-sass": "^2.1.1",
"jest-cli": "^0.4.0",
"phantomjs2": "^2.0.2"