habitica/test/rest.casper.coffee

37 lines
881 B
CoffeeScript
Raw Normal View History

2012-10-12 13:58:42 +00:00
url = 'http://localhost:3000'
utils = require('utils')
casper = require("casper").create()
uid = undefined
# ---------- Main Stuff ------------
casper.start url, ->
uid = @evaluate -> window.DERBY.model.get("_user.id")
2012-10-12 15:44:03 +00:00
# ---------- REST API ------------
2012-10-12 13:58:42 +00:00
2012-10-12 15:44:03 +00:00
# casper.thenOpen "#{url}/users/#{uid}"
# casper.thenOpen "#{url}/users/#{uid}/tasks"
# casper.thenOpen "#{url}/users/#{uid}/tasks/{taskId}"
2012-10-12 13:58:42 +00:00
2012-10-12 15:44:03 +00:00
taskId = 'productivity'
pomodoro = {
'title': 'Stay Focused',
'service': 'pomodoro',
'icon': 'http://www.veryicon.com/icon/16/Food%20%26%20Drinks/Paradise%20Fruits/Tomato.png'
}
@thenOpen "#{url}/users/#{uid}/tasks/#{taskId}/up", {
method: 'post',
data: pomodoro
}
@thenOpen "#{url}/users/#{uid}/tasks/#{taskId}/down", {
method: 'post',
data: pomodoro
}
2012-10-12 13:58:42 +00:00
# ---------- Run ------------
casper.run ->
@test.renderResults true