kameleon 0.0.9 → 0.2.0.alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. data/LICENCE +1 -1
  2. data/README.textile +157 -0
  3. data/lib/kameleon.rb +3 -18
  4. data/lib/kameleon/dsl.rb +98 -0
  5. data/lib/kameleon/dsl/act/form.rb +106 -0
  6. data/lib/kameleon/dsl/act/mouse.rb +59 -0
  7. data/lib/kameleon/dsl/context/scope.rb +95 -0
  8. data/lib/kameleon/dsl/utils/debug.rb +10 -0
  9. data/lib/kameleon/dsl/verify/absence.rb +151 -0
  10. data/lib/kameleon/dsl/verify/presence.rb +327 -0
  11. data/lib/kameleon/ext/active_record/shared_single_connection.rb +42 -0
  12. data/lib/kameleon/ext/capybara/server.rb +21 -0
  13. data/lib/kameleon/ext/capybara/session_pool.rb +63 -0
  14. data/lib/kameleon/ext/rspec/all.rb +4 -0
  15. data/lib/kameleon/ext/rspec/dsl.rb +39 -0
  16. data/lib/kameleon/ext/rspec/garbage_collector.rb +11 -0
  17. data/lib/kameleon/ext/rspec/headless.rb +12 -0
  18. data/lib/kameleon/ext/rspec/pool.rb +7 -0
  19. data/lib/kameleon/ext/rspec/transactional_examples.rb +10 -0
  20. data/{spec/support/deferred_garbage_collection.rb → lib/kameleon/ext/ruby/deferred_garbage_collector.rb} +0 -0
  21. data/lib/kameleon/ext/session/devise.rb +28 -0
  22. data/lib/kameleon/session.rb +23 -0
  23. data/lib/kameleon/utils/configuration.rb +5 -5
  24. data/lib/kameleon/utils/debug_console.rb +31 -0
  25. metadata +73 -77
  26. data/lib/kameleon/dsl/act.rb +0 -107
  27. data/lib/kameleon/dsl/see.rb +0 -155
  28. data/lib/kameleon/session/capybara.rb +0 -33
  29. data/lib/kameleon/session/server.rb +0 -21
  30. data/lib/kameleon/session/session_pool.rb +0 -45
  31. data/lib/kameleon/user/abstract.rb +0 -142
  32. data/lib/kameleon/user/base.rb +0 -36
  33. data/lib/kameleon/user/guest.rb +0 -10
  34. data/lib/kameleon/utils/helpers.rb +0 -11
  35. data/lib/patch/capybara_selenium_driver.rb +0 -7
  36. data/spec/sample_rack_app/hey.rb +0 -24
  37. data/spec/spec_helper.rb +0 -41
  38. data/spec/unit/act/click_spec.rb +0 -52
  39. data/spec/unit/act/fill_in/attach_file_spec.rb +0 -36
  40. data/spec/unit/act/fill_in/checkbox_spec.rb +0 -87
  41. data/spec/unit/act/fill_in/date_ranges_spec.rb +0 -24
  42. data/spec/unit/act/fill_in/multiple_select_spec.rb +0 -42
  43. data/spec/unit/act/fill_in/radio_button_spec.rb +0 -35
  44. data/spec/unit/act/fill_in/select_spec.rb +0 -35
  45. data/spec/unit/act/fill_in/text_area_spec.rb +0 -52
  46. data/spec/unit/act/fill_in/text_input_spec.rb +0 -52
  47. data/spec/unit/act/on_hover_spec.rb +0 -34
  48. data/spec/unit/dsl/not_see/form_elements/fields/empty_spec.rb +0 -38
  49. data/spec/unit/dsl/not_see/form_elements/fields/readonly_spec.rb +0 -38
  50. data/spec/unit/dsl/not_see/form_elements/fields_spec.rb +0 -24
  51. data/spec/unit/dsl/not_see/form_elements/textareas_spec.rb +0 -25
  52. data/spec/unit/dsl/not_see/form_elements/texts_spec.rb +0 -26
  53. data/spec/unit/dsl/not_see/in_scopes_spec.rb +0 -63
  54. data/spec/unit/dsl/not_see/special_elements/buttons_spec.rb +0 -24
  55. data/spec/unit/dsl/not_see/special_elements/error_message_for_spec.rb +0 -24
  56. data/spec/unit/dsl/not_see/special_elements/images_spec.rb +0 -24
  57. data/spec/unit/dsl/not_see/special_elements/links_spec.rb +0 -46
  58. data/spec/unit/dsl/not_see/special_elements/ordered_texts_spec.rb +0 -21
  59. data/spec/unit/dsl/not_see/special_selectors_spec.rb +0 -39
  60. data/spec/unit/dsl/not_see/texts_spec.rb +0 -24
  61. data/spec/unit/dsl/see/counted_elements_spec.rb +0 -26
  62. data/spec/unit/dsl/see/form_elements/checkboxes_spec.rb +0 -45
  63. data/spec/unit/dsl/see/form_elements/fields/disabled_spec.rb +0 -30
  64. data/spec/unit/dsl/see/form_elements/fields/empty_spec.rb +0 -28
  65. data/spec/unit/dsl/see/form_elements/fields/readonly_spec.rb +0 -38
  66. data/spec/unit/dsl/see/form_elements/fields_spec.rb +0 -28
  67. data/spec/unit/dsl/see/form_elements/multiple_selects_spec.rb +0 -47
  68. data/spec/unit/dsl/see/form_elements/radio_buttons_spec.rb +0 -35
  69. data/spec/unit/dsl/see/form_elements/selects_spec.rb +0 -40
  70. data/spec/unit/dsl/see/form_elements/textareas_spec.rb +0 -29
  71. data/spec/unit/dsl/see/form_elements/texts_spec.rb +0 -29
  72. data/spec/unit/dsl/see/in_scopes_spec.rb +0 -85
  73. data/spec/unit/dsl/see/special_elements/buttons_spec.rb +0 -28
  74. data/spec/unit/dsl/see/special_elements/error_message_for_spec.rb +0 -24
  75. data/spec/unit/dsl/see/special_elements/images_spec.rb +0 -28
  76. data/spec/unit/dsl/see/special_elements/links_spec.rb +0 -55
  77. data/spec/unit/dsl/see/special_elements/ordered_texts_spec.rb +0 -21
  78. data/spec/unit/dsl/see/special_selectors_spec.rb +0 -57
  79. data/spec/unit/dsl/see/texts_spec.rb +0 -24
  80. data/spec/unit/guest_spec.rb +0 -46
  81. data/spec/unit/user_base_spec.rb +0 -13
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#see form elements - text inputs' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/form_elements.html')
7
- end
8
-
9
- it 'should see by id' do
10
- @user.see 'this is great value' => 'xlInput'
11
- end
12
-
13
- it 'should see by label' do
14
- @user.see 'this is great value' => 'X-Large input'
15
- end
16
-
17
- it 'should see many at once' do
18
- @user.see 'this is great value' => 'xlInput',
19
- 'sample default value' => 'secondInput'
20
- end
21
-
22
- context 'when it does not exist' do
23
- it 'should raise error' do
24
- expect do
25
- @user.see 'this is gread value' => 'fieldDoesNotExist'
26
- end.should raise_error(RSpec::Expectations::ExpectationNotMetError)
27
- end
28
- end
29
- end
@@ -1,85 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#see in scopes' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/scopes.html')
7
- end
8
-
9
- # TODO
10
- # would be nice to be possible in future
11
- # it's hard because of block closing
12
- # it "should see within specific selector" do
13
- # @user.within("#some_div").see "This is It"
14
- # @user.within("#some_div").not_see "Hello"
15
- # end
16
- #
17
- # it "should see within default selector" do
18
- # @user.stub!(:page_areas).and_return({:main => '#some_div'})
19
- # @user.will.see "This is It"
20
- # @user.will.not_see "Hello"
21
- # end
22
-
23
- context '#will' do
24
- context 'when main selector was defined' do
25
- before { @user.stub!(:page_areas).and_return({:main => '#main'}) }
26
-
27
- it 'should see in main selector scope' do
28
- @user.will do
29
- see 'Sample text in main part of page', 'Left side', 'Right side'
30
- end
31
- end
32
- end
33
-
34
- context 'main selector was not defined' do
35
- it 'should see in whole page scope' do
36
- @user.will do
37
- see 'Sample title for page', 'Sample text in top of page', 'Left side'
38
- end
39
- end
40
- end
41
- end
42
-
43
- context '#within' do
44
- it 'should see in css scope' do
45
- @user.within('#top h1') do
46
- see 'Sample title for page'
47
- end
48
- end
49
-
50
- context 'when scope by xpath' do
51
- it 'should see in one selector scope' do
52
- @user.within(:xpath, '//div[@id="footer"]/span') do
53
- see 'Simple text'
54
- end
55
- end
56
-
57
- it 'should see in many selctors scope' do
58
- user = Kameleon::User::Guest.new(self, :driver => :rack_test)
59
- user.debug.visit('/scopes.html')
60
- user.within(:xpath, '//div[@id="footer"]/span | //div[@id="main"]/div[@id="left"]', :select_multiple) do
61
- see 'Simple text', 'Left side'
62
- end
63
- end
64
- end
65
-
66
- context 'when scope by default selector type' do
67
- before do
68
- @user.stub!(:page_areas).and_return({:top => '#top',
69
- :footer => [:xpath, '//div[@id="footer"]']})
70
- end
71
-
72
- it 'should see in top selector scope' do
73
- @user.within(:top) do
74
- see 'Sample title for page', 'Sample text in top of page'
75
- end
76
- end
77
-
78
- it 'should see in footer selector scope' do
79
- @user.within(:footer) do
80
- see 'Sample text in footer', 'Simple text'
81
- end
82
- end
83
- end
84
- end
85
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#see special elements - buttons' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/special_elements.html')
7
- end
8
-
9
- it 'should see by id' do
10
- @user.see :button => 'superButton'
11
- end
12
-
13
- it 'should see by label' do
14
- @user.see :button => 'Super button'
15
- end
16
-
17
- it 'should see many buttons' do
18
- @user.see :button => ['Super button', 'Second super button']
19
- end
20
-
21
- context 'when does not exist' do
22
- it 'should raise error' do
23
- expect do
24
- @user.see :button => 'button does not exist'
25
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
26
- end
27
- end
28
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#see special elements - error message for' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/error_message_for.html')
7
- end
8
-
9
- it 'should see one messages' do
10
- @user.see :error_message_for => 'name'
11
- end
12
-
13
- it 'should see many messages at once' do
14
- @user.see :error_messages_for => ['name', 'title', 'content']
15
- end
16
-
17
- context 'when at least one does not exist' do
18
- it 'should raise error' do
19
- expect do
20
- @user.see :error_messages_for => ['name', 'doesNotExist']
21
- end.should raise_error(RSpec::Expectations::ExpectationNotMetError)
22
- end
23
- end
24
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#see special elements - images' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/special_elements.html')
7
- end
8
-
9
- it 'should see by alt' do
10
- @user.see :image => "Logo_diamondmine"
11
- end
12
-
13
- it 'should see by src' do
14
- @user.see :image => "/images/logo_diamondmine.png?1324293836"
15
- end
16
-
17
- it 'should see many images' do
18
- @user.see :images => ['Logo_diamondmine', 'Logo_redmine']
19
- end
20
-
21
- context 'when does not exist' do
22
- it 'should raise error' do
23
- expect do
24
- @user.see :image => 'LinkDoesNotExist'
25
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
26
- end
27
- end
28
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#see special elements - links' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/special_elements.html')
7
- end
8
-
9
- context 'when src is provided' do
10
- it 'should see one link' do
11
- @user.see :link => { 'What you want' => '/i-want/to' }
12
- end
13
-
14
- it 'should see many links' do
15
- @user.see :links => { 'What you want' => '/i-want/to',
16
- 'What I need' => '/what-i/need' }
17
- end
18
-
19
- context 'when link text does not exist' do
20
- it 'should raise error' do
21
- expect do
22
- @user.see :link => { 'What you want' => '/i-want/to',
23
- 'link does not exist' => '/what-i/need' }
24
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
25
- end
26
- end
27
-
28
- context 'when src path does not exist' do
29
- it 'should raise error' do
30
- expect do
31
- @user.see :link => { 'What you want' => '/i-want/to',
32
- 'What I need' => 'src does not exist' }
33
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
34
- end
35
- end
36
- end
37
-
38
- context 'when src path is not provided' do
39
- it 'should see one link' do
40
- @user.see :link => 'What you want'
41
- end
42
-
43
- it 'should see many links' do
44
- @user.see :links => ['What you want', 'What I need']
45
- end
46
-
47
- context 'when at least one does not exist' do
48
- it 'should raise error' do
49
- expect do
50
- @user.see :link => ['What you want', 'does not exist']
51
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
52
- end
53
- end
54
- end
55
- end
@@ -1,21 +0,0 @@
1
- #encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe '#see special elements - ordered texts' do
5
- before do
6
- @user = Kameleon::User::Guest.new(self)
7
- @user.debug.visit('/special_elements.html')
8
- end
9
-
10
- it 'should see text in proper order' do
11
- @user.see :ordered => ['Michal Czyz', 'Tomasz Bak', 'Rafal Bromirski']
12
- end
13
-
14
- context 'when different order' do
15
- it 'should raise error' do
16
- expect do
17
- @user.see :ordered => ['Tomasz Bak', 'Michal Czyz', 'Rafal Bromirski']
18
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
19
- end
20
- end
21
- end
@@ -1,57 +0,0 @@
1
- #encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe '#see special selectors in tables' do
5
-
6
- context 'when in row' do
7
- before do
8
- @user = Kameleon::User::Guest.new(self)
9
- @user.debug.visit('/special_elements.html')
10
- end
11
- it 'should see full text' do
12
- @user.within(:row => 'Michal Czyz') do
13
- see "13.00"
14
- end
15
- end
16
-
17
- it 'should see partial text' do
18
- @user.within(:row => 'Michal Czyz') do
19
- see "13"
20
- end
21
- end
22
- end
23
-
24
- context 'when in column' do
25
- before do
26
- @user = Kameleon::User::Guest.new(self, :driver => :rack_test)
27
- @user.debug.visit('/special_elements.html')
28
- end
29
- context 'when scoped by full text' do
30
- it 'should see full text' do
31
- @user.within(:column => 'Selleo') do
32
- see "13.00", "2.00", "0.00"
33
- end
34
- end
35
-
36
- it 'should see partial text' do
37
- @user.within(:column => 'Selleo') do
38
- see "13", "2", "0"
39
- end
40
- end
41
- end
42
-
43
- context 'when scoped by partial text' do
44
- it 'should see full text' do
45
- @user.within(:column => 'lleo') do
46
- see "13.00", "2.00", "0.00"
47
- end
48
- end
49
-
50
- it 'should see partial text' do
51
- @user.within(:column => 'lleo') do
52
- see "13", "2", "0"
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#see texts' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/texts.html')
7
- end
8
-
9
- it 'should see single text' do
10
- @user.see 'This is simple app'
11
- end
12
-
13
- it 'should see many text at once' do
14
- @user.see 'This is simple app', 'and there is many lines', 'i that app'
15
- end
16
-
17
- context 'when at least one text is not visible' do
18
- it 'should raise error' do
19
- expect do
20
- @user.see 'sinatra app', 'and there is many lines'
21
- end.should raise_error(RSpec::Expectations::ExpectationNotMetError)
22
- end
23
- end
24
- end
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Kameleon::User::Guest" do
4
- include ::Capybara::DSL
5
-
6
- before(:all) do
7
- Capybara.current_driver = :rack_test
8
- @guest = Kameleon::User::Guest.new(self, {:session_name => :see_world})
9
- @another_guest = Kameleon::User::Guest.new(self)
10
- end
11
-
12
- after(:all) { Capybara.use_default_driver }
13
-
14
- context "sessions" do
15
- it "by default user should get some session" do
16
- @another_guest.send(:session).should be_kind_of(Capybara::Session)
17
- @another_guest.debug.should be_kind_of(Capybara::Session)
18
- end
19
-
20
- it "guests should have separate session if param :session_name defined" do
21
- @guest.debug.should_not == Capybara.current_session
22
- end
23
- end
24
-
25
- context "driver" do
26
- it "will not change if not defined in params" do
27
- @guest.debug.driver.should be_a Capybara.current_session.driver.class
28
- end
29
-
30
- context "selecting custom driver" do
31
- before(:all) do
32
- @selenium = Kameleon::User::Guest.new(self, {:session_name => :new_world, :driver => :selenium, :skip_page_autoload => true})
33
- end
34
-
35
- it "should set Selenium if params :driver => :selenium" do
36
- @selenium.debug.driver.should be_a Capybara::Selenium::Driver
37
- end
38
-
39
- it "shouldn't change drivers for other users'" do
40
- [@guest, @another_guest].each do |user|
41
- user.debug.driver.should be_a Capybara::RackTest::Driver
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Kameleon::User::Base" do
4
- pending do
5
- include ::Capybara::DSL
6
-
7
- # initilization
8
-
9
- #! overwriting using block for initialization
10
-
11
- # login in
12
- end
13
- end