Skip to content

Instantly share code, notes, and snippets.

@naoya
Created October 10, 2013 07:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naoya/6914622 to your computer and use it in GitHub Desktop.
Save naoya/6914622 to your computer and use it in GitHub Desktop.
casper.test.begin 'トップページから検索して貼り付けHTMLを取得', 7, (test) ->
casper.start 'http://app.amazlet.com/', ->
test.assertHttpStatus 200
test.assertTitleMatch /^amazlet/, "タイトル文字列が期待通り"
test.assertExists 'form', "メインフォームがある"
@fill 'form', keyword: "chef solo"
@click 'form input[type="submit"]'
casper.then ->
test.assertHttpStatus 200
test.assertExists 'p.title', '検索結果が一つ以上ある'
@click 'a.minibutton'
casper.then ->
test.assertHttpStatus 200
result = @evaluate -> document.getElementById('standard').value
test.assertMatch result, /^<div/, 'HTMLタグが取得できた'
casper.run ->
do test.done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment