commits.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. casper.on('remote.message', function (e) {
  2. console.log(e)
  3. })
  4. casper.test.begin('commits', 26, function (test) {
  5. casper
  6. .start('../../examples/commits/index.html')
  7. .then(function () {
  8. // radio inputs & labels
  9. test.assertElementCount('input', 3)
  10. test.assertElementCount('label', 3)
  11. test.assertSelectorHasText('label[for="master"]', 'master')
  12. test.assertSelectorHasText('label[for="dev"]', 'dev')
  13. test.assertSelectorHasText('label[for="next"]', 'next')
  14. // initial fetched commits
  15. test.assertField('branch', 'master')
  16. test.assertSelectorHasText('p', 'yyx990803/vue@master')
  17. test.assertElementCount('li', 3)
  18. test.assertSelectorHasText('li:first-child a.commit', '1111111')
  19. test.assertSelectorHasText('li:first-child span.message', 'one')
  20. test.assertSelectorHasText('li:first-child span.author', 'Evan')
  21. test.assertSelectorHasText('li:first-child span.date', '2014-10-15 13:52:58')
  22. })
  23. .thenClick('input[value="dev"]', function () {
  24. test.assertField('branch', 'dev')
  25. test.assertSelectorHasText('p', 'yyx990803/vue@dev')
  26. test.assertElementCount('li', 3)
  27. test.assertSelectorHasText('li:first-child a.commit', '2222222')
  28. test.assertSelectorHasText('li:first-child span.message', 'two')
  29. test.assertSelectorHasText('li:first-child span.author', 'Evan')
  30. test.assertSelectorHasText('li:first-child span.date', '2014-10-15 13:52:58')
  31. })
  32. .thenClick('input[value="next"]', function () {
  33. test.assertField('branch', 'next')
  34. test.assertSelectorHasText('p', 'yyx990803/vue@next')
  35. test.assertElementCount('li', 3)
  36. test.assertSelectorHasText('li:first-child a.commit', '3333333')
  37. test.assertSelectorHasText('li:first-child span.message', 'three')
  38. test.assertSelectorHasText('li:first-child span.author', 'Evan')
  39. test.assertSelectorHasText('li:first-child span.date', '2014-10-15 13:52:58')
  40. })
  41. // run
  42. .run(function () {
  43. test.done()
  44. })
  45. })