???Zombie.js????Web?????????
???????????? ???????[ 2016/2/19 16:40:00 ] ????????????????? WEB????
????Zombie.js ?????node.js?????£????С???Ч???Web UI Automation Test??.???????????????Zombie.js??Web UI?????????????.
?????????????????:
????node.js + coffeescript
????mocha
????gulp.js
????express.js
???????????Zombie.js????
????const Browser = require('zombie'); ????Browser.localhost('example.com'?? 3000); ????describe('User visits signup page'?? function() { ????const browser = new Browser(); ????before(function(done) { ????browser.visit('/signup'?? done); ????}); ????describe('submits form'?? function() { ????before(function(done) { ????browser ????.fill('email'?? 'zombie@underworld.dead') ????.fill('password'?? 'eat-the-living') ????.pressButton('Sign Me Up!'?? done); ????}); ????it('should be successful'?? function() { ????browser.assert.success(); ????}); ????it('should see welcome page'?? function() { ????browser.assert.text('title'?? 'Welcome To Brains Depot'); ????}); ????}); ????});
????Zombie.js???ó???
??????????
????Zombie.js?????Selenium??PhandomJS?????????????????????????????ò???????Ч?????????????? Zombile.js??????mocha????д????????????WebDriver????????????????????mocha?? Zombie.js??????伴????.
????Features
???????????????
????Assertions?? ???????jQuery??Selector??dom????assert
????Cookies
????Ajax & WebSocket
????????
????????Zombie.js???????????????WebDriver?? ????????????????????????. ???磬??ζ??μ????????????????????????.
???????Zombie.js
????npm install -g mocha ????npm install zombie --save-dev
??????????????coffeescript????javascript?? ????????coffeescript????
????npm install -g coffee-script
??????д?????????
????Brower = require 'zombie' ????Brower.localhost('yourdomain.com'?? 5000) ????describe 'User visits login page'?? () -> ????browser = new Brower() ????before (done) -> ????browser.visit '/login'?? done ????describe 'submits login form'?? () -> ????before (done) -> ????browser ????.fill 'username'?? 'xxxx@mail.com' ????.fill 'password'?? 'password' ????.pressButton('???'?? done) ????it 'should be successful'?? () -> ????browser.assert.success() ????it 'should visit admin page'?? () -> ????browser.assert.url /^http://yourdomain.com/users/d/admin/ ????it 'should see profile button with email'?? () -> ????browser.assert.link('#profile-button'?? 'xxxx@mail.com'?? '#')
???????в???:
???????????web server
???????в???
????mocha --harmony --compilers coffee:coffee-script/register login_spec.coffee
????????Zombie.js??????ECMA 6???????? --harmony ???????? node.js ??ECMA 6?????.
???????Gulp.js????Build Pipeline
????????????????????????build pipeline??. ????????? Express.js + Zombie.js + gulp.js?????÷???.
????Build pipeline????
????checkstyle?? ????????
????????unit test
????compile coffeescript -> javascript
???????server
????????automation test
?????????????????????server
????????gulp-develop-server?????coffeescript???server????????????compile????.
????express.js????????
?????????? acceptence-test // automation test???? ?????? ?????? admin_spec.coffee ?????? ?????? login_spec.coffee ?????????? app //???app???? coffeescript ?????????? bin ?????????? config ?????????? dist //coffeescript??????js???? ?????????? gulpfile.coffee ?????????? gulpfile.js ?????????? node_modules ?????????? package.json ?????????? public ?????????? spec // unit test???? ?????? ?????? activities_spec.coffee ?????? ?????? auth_spec.coffee ?????? ?????? projects_spec.coffee ?????????? views
???????????
????npm install -g gulp ????npm install gulp-mocha gulp-coffee gulp-coffeelint gulp-sync gulp-task-listing gulp-develop-server harmonize --save-dev
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11