分度器を使い始めて、最初にやろうとしたことは、ジャスミンの代わりにモカとチャイを使うことです. それが良いアイデアだったかどうかは今となってはわかりませんが。
まず、すべてのスペック ファイルから Chai にアクセスできるようにする必要がありました。毎回インポートする必要はありません。protractor.conf ファイルで実行できることがわかりました。
onPrepare: ->
global.chai = require 'chai'
chai.use require 'chai-string'
chai.use require 'chai-as-promised'
global.expect = chai.expect
現在、次のような仕様になっています。
it "when clicked should sort ",->
headerColumns.get(0).click()
firstCellText = $$(".first-cell").getText()
secondCellText = $$(".second-cell").getText()
# this won't work
expect(firstCellText).eventually.be.above(secondCellText)
それを機能させるために私ができること:
# now this works
$$(".second-cell").getText().then (secondCellText)->
expect(firstCellText).eventually.be.above(secondCellText)
しかし、それは醜いです。私はいつも何かを包み込みたくありません.then
。もっといい方法があればいいのに(?)