mirror of
https://gitlab.com/Oreolek/black_phone.git
synced 2024-05-17 00:18:34 +03:00
Did tests with lotte. Not working.
This commit is contained in:
parent
7619168147
commit
f54450c439
10
Gulpfile.js
10
Gulpfile.js
|
@ -49,16 +49,6 @@ gulp.task('html', html('./build'));
|
|||
gulp.task('img', img('./build/img'));
|
||||
gulp.task('audio', audio('./build/audio'));
|
||||
|
||||
gulp.task("build-test", function(){
|
||||
return gulp.src('./test/test.coffee')
|
||||
.pipe(coffee({bare: true}).on('error', gutil.log))
|
||||
.pipe(gulp.dest('./build/test/'));
|
||||
})
|
||||
gulp.task('test', ['build-test'], function () {
|
||||
return gulp.src('./build/test/test.js', {read: false})
|
||||
.pipe(mocha({reporter: 'nyan'}));
|
||||
});
|
||||
|
||||
/* Less */
|
||||
|
||||
gulp.task('sass', function () {
|
||||
|
|
|
@ -30,3 +30,10 @@ I've sped up every click by 250ms or so like this:
|
|||
A "click" in Javascript is an event of clicking the mouse button and releasing it.
|
||||
The "mousedown" event is just clicking the button, not waiting for the release.
|
||||
I didn't bother with intricacies, so the right mouse click is treated the same as the left one.
|
||||
|
||||
#### Functional testing
|
||||
I did functional testing using [lotte](https://github.com/StanAngeloff/lotte) and PhantomJS.
|
||||
|
||||
1. Start `gulp serve`
|
||||
2. Install (`npm install -g lotte`) Lotte and PhantomJS.
|
||||
3. `lotte test/test.coffee`
|
||||
|
|
20
test/lotte_test.coffee
Normal file
20
test/lotte_test.coffee
Normal file
|
@ -0,0 +1,20 @@
|
|||
@title 'Black phone'
|
||||
@base 'http://localhost:3000'
|
||||
|
||||
# @success() to end the case with success
|
||||
|
||||
@open '/', 'the game', ->
|
||||
@describe 'initial check', ->
|
||||
setTimeout ( ->
|
||||
@page.render 'home.png'
|
||||
@assert.ok(@$('.click_message').offsetWidth > 0, "The game is not loaded.")
|
||||
), 3000
|
||||
###
|
||||
@group 'Walkthrough', ->
|
||||
@describe 'The game begins with a click', ->
|
||||
@$('h1').click ->
|
||||
@assert.equal(@$('h1').innerHTML, "The Black Phone", "The game is loaded.")
|
||||
throw 'exit'
|
||||
@describe 'Full walkthrough', ->
|
||||
# ...assertion logic...
|
||||
###
|
|
@ -1,32 +0,0 @@
|
|||
process.env.NODE_ENV = 'test';
|
||||
Browser = require('zombie');
|
||||
assert = require('assert');
|
||||
|
||||
describe('Title', () ->
|
||||
before(() ->
|
||||
#this.server = http.createServer("../").listen(3000);
|
||||
# initialize the browser using the same port as the test application
|
||||
this.browser = new Browser({ site: 'http://localhost:3000' });
|
||||
)
|
||||
|
||||
beforeEach((done) ->
|
||||
this.browser.visit('/', done);
|
||||
)
|
||||
|
||||
it('should show a title card', () ->
|
||||
assert.ok(this.browser.success)
|
||||
assert.equal(this.browser.text('h1'), 'The Black Phone')
|
||||
)
|
||||
|
||||
it('should show the text on a click', () ->
|
||||
browser = this.browser;
|
||||
browser.pressButton('Click').then(() ->
|
||||
assert.ok(browser.success)
|
||||
assert.equal(browser.text('h1'), 'The Black Phone')
|
||||
).then(done, done);
|
||||
)
|
||||
|
||||
after((done) ->
|
||||
this.server.close(done);
|
||||
);
|
||||
)
|
Loading…
Reference in a new issue