signup_test.rb 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class SignupTest < TestCase
  4. def test_signup
  5. signup_user_email = 'signup-test-' + rand(999999).to_s + '@example.com'
  6. tests = [
  7. {
  8. :name => 'start',
  9. :instance => browser_instance,
  10. :url => browser_url,
  11. :action => [
  12. {
  13. :execute => 'click',
  14. :css => 'a[href="#signup"]',
  15. },
  16. {
  17. :execute => 'check',
  18. :css => '.signup',
  19. :result => true,
  20. },
  21. ],
  22. },
  23. {
  24. :name => 'signup',
  25. :action => [
  26. {
  27. :execute => 'set',
  28. :css => 'input[name="firstname"]',
  29. :value => 'Signup Firstname',
  30. },
  31. {
  32. :execute => 'set',
  33. :css => 'input[name="lastname"]',
  34. :value => 'Signup Lastname',
  35. },
  36. {
  37. :execute => 'set',
  38. :css => 'input[name="email"]',
  39. :value => signup_user_email,
  40. },
  41. {
  42. :execute => 'set',
  43. :css => 'input[name="password"]',
  44. :value => 'some-pass',
  45. },
  46. {
  47. :execute => 'set',
  48. :css => 'input[name="password_confirm"]',
  49. :value => 'some-pass',
  50. },
  51. {
  52. :execute => 'click',
  53. :css => 'button.submit',
  54. },
  55. {
  56. :execute => 'wait',
  57. :value => 5,
  58. },
  59. # check action
  60. {
  61. :execute => 'check',
  62. :css => '.signup',
  63. :result => false,
  64. },
  65. {
  66. :execute => 'match',
  67. :css => '.user-menu .user a',
  68. :attribute => 'title',
  69. :value => signup_user_email,
  70. :match_result => true,
  71. },
  72. ],
  73. },
  74. ]
  75. browser_single_test(tests)
  76. end
  77. end