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,52 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'fill textarea' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/form_elements.html')
7
- end
8
-
9
- it 'should fill by id' do
10
- @user.will do
11
- see :empty => 'textarea2'
12
- fill_in 'Value for textarea2' => 'textarea2'
13
- see 'Value for textarea2' => 'textarea2'
14
- end
15
- end
16
-
17
- it 'should fill by label' do
18
- @user.will do
19
- see :empty => 'Textarea'
20
- fill_in 'Value for Textarea' => 'Textarea'
21
- see 'Value for Textarea' => 'Textarea'
22
- end
23
- end
24
-
25
- context 'when is disabled' do
26
- it 'should not fill' do
27
- @user.will do
28
- see :empty => 'Disabled textarea'
29
- fill_in 'Text should not be in this field' => 'Disabled textarea'
30
- see :empty => 'Disabled textarea'
31
- end
32
- end
33
- end
34
-
35
- context 'when is readonly' do
36
- it 'should not fill' do
37
- @user.will do
38
- see :empty => 'Readonly textarea'
39
- fill_in 'Text should not be in this field' => 'Readonly textarea'
40
- see :empty => 'Readonly textarea'
41
- end
42
- end
43
- end
44
-
45
- context 'when does not exist' do
46
- it 'should raise error' do
47
- expect do
48
- @user.fill_in 'Value for does not exist text area' => 'Bad text area'
49
- end.to raise_error(Capybara::ElementNotFound)
50
- end
51
- end
52
- end
@@ -1,52 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'fill text input' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/form_elements.html')
7
- end
8
-
9
- it 'should fill by id' do
10
- @user.will do
11
- see :empty => 'sampleEmptyInput'
12
- fill_in 'Value for sampleEmtyInput' => 'sampleEmptyInput'
13
- see 'Value for sampleEmtyInput' => 'sampleEmptyInput'
14
- end
15
- end
16
-
17
- it 'should fill by label' do
18
- @user.will do
19
- see :empty => 'Sample empty input'
20
- fill_in 'Value for Sample empty input' => 'Sample empty input'
21
- see 'Value for Sample empty input' => 'Sample empty input'
22
- end
23
- end
24
-
25
- context 'when is disabled' do
26
- it 'should not fill' do
27
- @user.will do
28
- see :empty => 'Disabled input'
29
- fill_in 'Sample text' => 'Disabled input'
30
- see :empty => 'Disabled input'
31
- end
32
- end
33
- end
34
-
35
- context 'when is readonly' do
36
- it 'should not fill' do
37
- @user.will do
38
- see :empty => 'Readonly input'
39
- fill_in 'Sample text' => 'Readonly input'
40
- see :empty => 'Readonly input'
41
- end
42
- end
43
- end
44
-
45
- context 'when does not exist' do
46
- it 'should raise error' do
47
- expect do
48
- @user.fill_in 'Value for does not exist field' => 'Bad field'
49
- end.to raise_error(Capybara::ElementNotFound)
50
- end
51
- end
52
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#on_hover' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/on_hover.html')
7
- end
8
-
9
- pending do
10
- context 'trigger hover event on element' do
11
- it 'should trigger by css selector' do
12
- @user.on_hover('#second') do
13
- see 'Further information:'
14
- not_see 'Second option', 'First option'
15
- end
16
- end
17
-
18
- it 'should trigger by xpath selector' do
19
- @user.on_hover(:xpath, '//p[@id="second"]') do
20
- see 'Further information:'
21
- not_see 'Second option', 'First option'
22
- end
23
- end
24
- end
25
-
26
- context 'when element does not exist' do
27
- it 'should raise error' do
28
- expect do
29
- @user.on_hover('#doesNotExist') {}
30
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
31
- end
32
- end
33
- end
34
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_see empty fields' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/form_elements.html')
7
- end
8
-
9
- it 'should verify status for id' do
10
- @user.not_see :empty => 'xlInput'
11
- end
12
-
13
- it 'should verify status for label' do
14
- @user.not_see :empty => 'X-Large input'
15
- end
16
-
17
- context 'when many empty fields at once' do
18
- it 'should verify status' do
19
- @user.not_see :empty => ['xlInput', 'X-Large input']
20
- end
21
-
22
- context 'when at least one is not empty' do
23
- it 'should raise error' do
24
- expect do
25
- @user.not_see :empty => ['Prepended text', 'Sample Input']
26
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
27
- end
28
- end
29
-
30
- context 'when at least one does not exist' do
31
- it 'should raise error' do
32
- expect do
33
- @user.not_see :empty => ['Prepended text', 'Sample Input']
34
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
35
- end
36
- end
37
- end
38
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_see readonly fields' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/form_elements.html')
7
- end
8
-
9
- context 'when text inside fields is not provied' do
10
- it 'should verify status for id' do
11
- @user.not_see :readonly => 'xlInput'
12
- end
13
-
14
- it 'should verify status for label' do
15
- @user.not_see :readonly => 'X-Large input'
16
- end
17
-
18
- it 'should verify many fields at once' do
19
- @user.not_see :readonly => ['xlInput', 'X-Large input']
20
- end
21
-
22
- context 'when field does not exist' do
23
- it 'should raise error' do
24
- expect do
25
- @user.not_see :readonly => 'DoesNotExist'
26
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
27
- end
28
- end
29
-
30
- context 'when at least one is readonly' do
31
- it 'should raise error' do
32
- expect do
33
- @user.not_see :readonly => ['Readonly input', 'X-Large input']
34
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
35
- end
36
- end
37
- end
38
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_see form elements - fields' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/form_elements.html')
7
- end
8
-
9
- it 'should not see by label' do
10
- @user.not_see :field => 'maybeDiv'
11
- end
12
-
13
- it 'should not see many at once' do
14
- @user.not_see :fields => ['maybeDiv', 'maybeSecondDiv']
15
- end
16
-
17
- context 'when at least one exists' do
18
- it 'should raise error' do
19
- expect do
20
- @user.not_see :field => ['maybeDiv', 'multiSelect']
21
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
22
- end
23
- end
24
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_see form elements - textareas' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/form_elements.html')
7
- end
8
-
9
- it 'should not see one' do
10
- @user.not_see 'another this is great value' => 'textarea3'
11
- end
12
-
13
- it 'should not see many at once' do
14
- @user.not_see 'other this is great value' => 'secondTextarea2',
15
- 'other sample default value' => 'textarea3'
16
- end
17
-
18
- context 'when exists' do
19
- it 'should raise error' do
20
- expect do
21
- @user.not_see 'sample text in second textarea 2' => 'secondTextarea2'
22
- end.should raise_error(RSpec::Expectations::ExpectationNotMetError)
23
- end
24
- end
25
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_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 not see one' do
10
- @user.not_see 'sample other value' => 'maybeSimpleDiv'
11
- end
12
-
13
- it 'should not see many at once' do
14
- @user.not_see 'other this is great value' => 'maybeSimpleDiv',
15
- 'other sample default value' => 'maybeSimpleDiv'
16
- end
17
-
18
- context 'when exists' do
19
- it 'should raise error' do
20
- expect do
21
- @user.not_see 'sample default value' => 'secondInput',
22
- 'sample value' => 'maybeSimpleDiv'
23
- end.should raise_error(RSpec::Expectations::ExpectationNotMetError)
24
- end
25
- end
26
- end
@@ -1,63 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_see in scopes' do
4
- before do
5
- @user = Kameleon::User::Guest.new(self)
6
- @user.debug.visit('/scopes.html')
7
- end
8
-
9
- context '#will' do
10
- context 'when main selector was defined' do
11
- before { @user.stub!(:page_areas).and_return({:main => '#main'}) }
12
-
13
- it 'should not see in main selector scope' do
14
- @user.will do
15
- not_see 'Sample title for page', 'Sample text in footer'
16
- end
17
- end
18
- end
19
- end
20
-
21
- context '#within' do
22
- it 'should not see in css scope' do
23
- @user.within('#top h1') do
24
- not_see 'Sample text in top of page', 'Left side'
25
- end
26
- end
27
-
28
- context 'when scope by xpath' do
29
- it 'should not see in one selector scope' do
30
- @user.within(:xpath, '//div[@id="footer"]/span') do
31
- not_see 'Sample text in footer', 'Sample text in main part of page'
32
- end
33
- end
34
-
35
- it 'should not see in many selctors scope' do
36
- @user = Kameleon::User::Guest.new(self, :driver => :rack_test)
37
- @user.debug.visit('/scopes.html')
38
- @user.within(:xpath, '//div[@id="footer"]/span | //div[@id="main"]/div[@id="left"]', :select_multiple) do
39
- not_see 'Right side', 'Sample text in top of page', 'Sample text in footer'
40
- end
41
- end
42
- end
43
-
44
- context 'when scope by default selector type' do
45
- before do
46
- @user.stub!(:page_areas).and_return({:top => '#top',
47
- :footer => [:xpath, '//div[@id="footer"]']})
48
- end
49
-
50
- it 'should not see in top selector scope' do
51
- @user.within(:top) do
52
- not_see 'Sample text in main part of page', 'Sample text in footer'
53
- end
54
- end
55
-
56
- it 'should not see in footer selector scope' do
57
- @user.within(:footer) do
58
- not_see 'Sample title for page', 'Sample text in main part of page'
59
- end
60
- end
61
- end
62
- end
63
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_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 not see one button' do
10
- @user.not_see :button => 'first'
11
- end
12
-
13
- it 'should not see many buttons' do
14
- @user.not_see :button => ['first button', 'second button']
15
- end
16
-
17
- context 'when exists' do
18
- it 'should raise error' do
19
- expect do
20
- @user.not_see :button => 'Super button'
21
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
22
- end
23
- end
24
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_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 not see one messages' do
10
- @user.not_see :error_message_for => 'first field'
11
- end
12
-
13
- it 'should not see many messages at once' do
14
- @user.not_see :error_messages_for => ['first field', 'second field']
15
- end
16
-
17
- context 'when at least one exist' do
18
- it 'should raise error' do
19
- expect do
20
- @user.not_see :error_messages_for => ['name', 'doesNotExist']
21
- end.should raise_error(RSpec::Expectations::ExpectationNotMetError)
22
- end
23
- end
24
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_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 not see one image' do
10
- @user.not_see :image => 'sample_first'
11
- end
12
-
13
- it 'should not see many images' do
14
- @user.not_see :images => ['sample_first', 'sample_second']
15
- end
16
-
17
- context 'when at least one exists' do
18
- it 'should raise error' do
19
- expect do
20
- @user.not_see :image => ['sample_first', 'Logo_diamondmine']
21
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
22
- end
23
- end
24
- end
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe '#not_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 not see one link' do
11
- @user.not_see :link => { 'Maybe div' => '/i/do/not/know' }
12
- end
13
-
14
- it 'should not see many links' do
15
- @user.not_see :links => { 'Maybe div' => '/i/do/not/know',
16
- 'Maybe other div' => '/i/do/not/know/too' }
17
- end
18
-
19
- context 'when at least one exists' do
20
- it 'should raise error' do
21
- expect do
22
- @user.not_see :link => { 'What you want' => '/i-want/to',
23
- 'Maybe div' => '/i/do/not/know' }
24
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
25
- end
26
- end
27
- end
28
-
29
- context 'when src path is not provided' do
30
- it 'should not see one link' do
31
- @user.not_see :link => 'Maybe div'
32
- end
33
-
34
- it 'should not see many links' do
35
- @user.not_see :links => ['Maybe div', 'Maybe other div']
36
- end
37
-
38
- context 'when at least one exists' do
39
- it 'should raise error' do
40
- expect do
41
- @user.not_see :link => ['What you want', 'Maybe div']
42
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
43
- end
44
- end
45
- end
46
- end