Skip to content

Instantly share code, notes, and snippets.

@kdabrowski
Created February 11, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdabrowski/437d276f1c3589215144 to your computer and use it in GitHub Desktop.
Save kdabrowski/437d276f1c3589215144 to your computer and use it in GitHub Desktop.
`import Ember from 'ember'`
`import startApp from '../../helpers/start-app'`
`import stub from '../../helpers/api-stub'`
App = null
server = null
module "Acceptance: InboxShow",
setup: ->
App = startApp()
server = stub.create()
authenticateSession()
visit '/'
teardown = ->
Ember.run App, "destroy"
server.shutdown()
goToMail = ->
click ".mail-list-item:first"
addRequest = ->
click ".js-add-selected-request-popover"
searchRequest = (text) ->
fillIn ".popover-content .search", text
findPopover = ->
find (".popover-request")
findDetail = ->
find ("#msg-details")
matchFirstResult = (text) ->
equal find(".recent-requests-wrap tr:first").first().text(), text
matchFirstResultSelected = (text) ->
equal find(".selected tr:first").first().text(), text
popoverClose = ->
click ".close"
test "Shows message details popup", ->
goToMail()
equal findDetail().length, 1
test "Shows add request popover", ->
goToMail()
addRequest()
andThen ->
equal findPopover().length, 1
test "Colses message details popup", ->
goToMail()
popoverClose()
andThen ->
equal findPopover().length, 0
test "Search test", ->
goToMail()
addRequest()
andThen ->
equal findPopover().length, 1
andThen ->
#searchRequest("C Contact #5")
fillIn ".popover-content .search", "C Contact #5"
andThen ->
matchFirstResult("#129/01/2015")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment