symbiont 0.2.1 → 0.3.0
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.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +22 -22
- data/.travis.yml +25 -14
- data/Gemfile +4 -2
- data/{LICENSE → LICENSE.txt} +22 -22
- data/README.md +57 -65
- data/Rakefile +28 -34
- data/lib/symbiont/accessor.rb +7 -0
- data/lib/symbiont/assertions.rb +33 -0
- data/lib/symbiont/elements.rb +69 -0
- data/lib/symbiont/errors.rb +7 -0
- data/lib/symbiont/factory.rb +75 -46
- data/lib/symbiont/helpers.rb +49 -0
- data/lib/symbiont/logging.rb +5 -0
- data/lib/symbiont/pages.rb +32 -0
- data/lib/symbiont/platform.rb +12 -0
- data/lib/symbiont/version.rb +3 -3
- data/lib/symbiont.rb +34 -92
- data/spec/fixtures/element_definitions.rb +32 -0
- data/spec/fixtures/mock_drivers.rb +8 -0
- data/spec/fixtures/page_definitions.rb +36 -0
- data/spec/spec_helper.rb +31 -80
- data/spec/symbiont/assertion_spec.rb +88 -0
- data/spec/symbiont/driver_spec.rb +41 -0
- data/spec/symbiont/element_spec.rb +8 -0
- data/spec/symbiont/factory_spec.rb +70 -130
- data/spec/symbiont/page_spec.rb +50 -0
- data/symbiont.gemspec +52 -27
- data/test/symbiont-script.rb +97 -0
- metadata +89 -230
- data/Gemfile.lock +0 -44
- data/HISTORY.md +0 -99
- data/app/app.rb +0 -48
- data/app/public/css/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_50_3baae3_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_3d80b3_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/public/css/cupertino/jquery-ui-1.8.16.custom.css +0 -290
- data/app/public/css/demo_table_jui.css +0 -471
- data/app/public/css/font/ColabLig-webfont.eot +0 -0
- data/app/public/css/font/ColabLig-webfont.svg +0 -149
- data/app/public/css/font/ColabLig-webfont.ttf +0 -0
- data/app/public/css/font/ColabLig-webfont.woff +0 -0
- data/app/public/css/font/ColabMed-webfont.eot +0 -0
- data/app/public/css/font/ColabMed-webfont.svg +0 -149
- data/app/public/css/font/ColabMed-webfont.ttf +0 -0
- data/app/public/css/font/ColabMed-webfont.woff +0 -0
- data/app/public/css/font/ColabReg-webfont.eot +0 -0
- data/app/public/css/font/ColabReg-webfont.svg +0 -149
- data/app/public/css/font/ColabReg-webfont.ttf +0 -0
- data/app/public/css/font/ColabReg-webfont.woff +0 -0
- data/app/public/css/font/ColabThi-webfont.eot +0 -0
- data/app/public/css/font/ColabThi-webfont.svg +0 -149
- data/app/public/css/font/ColabThi-webfont.ttf +0 -0
- data/app/public/css/font/ColabThi-webfont.woff +0 -0
- data/app/public/css/normalize.css +0 -376
- data/app/public/css/site.css +0 -446
- data/app/public/fancybox/blank.gif +0 -0
- data/app/public/fancybox/fancy_close.png +0 -0
- data/app/public/fancybox/fancy_loading.png +0 -0
- data/app/public/fancybox/fancy_nav_left.png +0 -0
- data/app/public/fancybox/fancy_nav_right.png +0 -0
- data/app/public/fancybox/fancy_shadow_e.png +0 -0
- data/app/public/fancybox/fancy_shadow_n.png +0 -0
- data/app/public/fancybox/fancy_shadow_ne.png +0 -0
- data/app/public/fancybox/fancy_shadow_nw.png +0 -0
- data/app/public/fancybox/fancy_shadow_s.png +0 -0
- data/app/public/fancybox/fancy_shadow_se.png +0 -0
- data/app/public/fancybox/fancy_shadow_sw.png +0 -0
- data/app/public/fancybox/fancy_shadow_w.png +0 -0
- data/app/public/fancybox/fancy_title_left.png +0 -0
- data/app/public/fancybox/fancy_title_main.png +0 -0
- data/app/public/fancybox/fancy_title_over.png +0 -0
- data/app/public/fancybox/fancy_title_right.png +0 -0
- data/app/public/fancybox/fancybox-x.png +0 -0
- data/app/public/fancybox/fancybox-y.png +0 -0
- data/app/public/fancybox/fancybox.png +0 -0
- data/app/public/fancybox/jquery.fancybox-1.3.4.css +0 -359
- data/app/public/fancybox/jquery.fancybox-1.3.4.js +0 -1156
- data/app/public/fancybox/jquery.fancybox-1.3.4.min.js +0 -1
- data/app/public/img/Sorting icons.psd +0 -0
- data/app/public/img/back_disabled.png +0 -0
- data/app/public/img/back_enabled.png +0 -0
- data/app/public/img/back_enabled_hover.png +0 -0
- data/app/public/img/close.png +0 -0
- data/app/public/img/favicon.ico +0 -0
- data/app/public/img/forward_disabled.png +0 -0
- data/app/public/img/forward_enabled.png +0 -0
- data/app/public/img/forward_enabled_hover.png +0 -0
- data/app/public/img/lucid-bg.png +0 -0
- data/app/public/img/lucid-ft.png +0 -0
- data/app/public/img/open.png +0 -0
- data/app/public/img/sort_asc.png +0 -0
- data/app/public/img/sort_asc_disabled.png +0 -0
- data/app/public/img/sort_both.png +0 -0
- data/app/public/img/sort_desc.png +0 -0
- data/app/public/img/sort_desc_disabled.png +0 -0
- data/app/public/js/comics.js +0 -11
- data/app/public/js/signup.js +0 -141
- data/app/public/js/site.js +0 -42
- data/app/public/js/stardate.js +0 -35
- data/app/public/js/vendor/html5shiv.js +0 -5
- data/app/public/js/vendor/jquery-1.8.3.min.js +0 -2
- data/app/public/js/vendor/jquery.dataTables.min.js +0 -151
- data/app/public/js/vendor/jquery.validate.min.js +0 -4
- data/app/views/comics.erb +0 -344
- data/app/views/index.erb +0 -7
- data/app/views/layout.erb +0 -72
- data/app/views/layout_small.erb +0 -21
- data/app/views/stardate.erb +0 -5
- data/app/views/stardate_calc.erb +0 -30
- data/app/views/webobject.erb +0 -147
- data/lib/symbiont/data_setter.rb +0 -53
- data/lib/symbiont/enclosers.rb +0 -118
- data/lib/symbiont/evaluators.rb +0 -92
- data/lib/symbiont/generators.rb +0 -331
- data/lib/symbiont/locators.rb +0 -43
- data/lib/symbiont/logger.rb +0 -5
- data/lib/symbiont/platform_watir/platform_object.rb +0 -466
- data/lib/symbiont/platform_watir.rb +0 -9
- data/lib/symbiont/platforms.rb +0 -23
- data/lib/symbiont/web_objects/_common.rb +0 -174
- data/lib/symbiont/web_objects/button.rb +0 -22
- data/lib/symbiont/web_objects/checkbox.rb +0 -31
- data/lib/symbiont/web_objects/div.rb +0 -15
- data/lib/symbiont/web_objects/heading.rb +0 -12
- data/lib/symbiont/web_objects/hidden_field.rb +0 -19
- data/lib/symbiont/web_objects/label.rb +0 -15
- data/lib/symbiont/web_objects/link.rb +0 -23
- data/lib/symbiont/web_objects/list_item.rb +0 -13
- data/lib/symbiont/web_objects/option.rb +0 -10
- data/lib/symbiont/web_objects/ordered_list.rb +0 -49
- data/lib/symbiont/web_objects/paragraph.rb +0 -11
- data/lib/symbiont/web_objects/radio.rb +0 -31
- data/lib/symbiont/web_objects/select_list.rb +0 -82
- data/lib/symbiont/web_objects/span.rb +0 -15
- data/lib/symbiont/web_objects/table.rb +0 -71
- data/lib/symbiont/web_objects/table_cell.rb +0 -24
- data/lib/symbiont/web_objects/table_row.rb +0 -59
- data/lib/symbiont/web_objects/text_area.rb +0 -26
- data/lib/symbiont/web_objects/text_field.rb +0 -31
- data/lib/symbiont/web_objects/unordered_list.rb +0 -49
- data/lib/symbiont/web_objects.rb +0 -22
- data/lucid.yml +0 -6
- data/spec/symbiont/data_setter_spec.rb +0 -65
- data/spec/symbiont/enclosers_spec.rb +0 -76
- data/spec/symbiont/evaluators_spec.rb +0 -95
- data/spec/symbiont/generators/button_generators_spec.rb +0 -72
- data/spec/symbiont/generators/checkbox_generators_spec.rb +0 -79
- data/spec/symbiont/generators/div_generators_spec.rb +0 -56
- data/spec/symbiont/generators/hidden_field_generators_spec.rb +0 -65
- data/spec/symbiont/generators/link_generators_spec.rb +0 -62
- data/spec/symbiont/generators/paragraph_generators_spec.rb +0 -57
- data/spec/symbiont/generators/radio_generators_spec.rb +0 -76
- data/spec/symbiont/generators/select_list_generators_spec.rb +0 -93
- data/spec/symbiont/generators/span_generators_spec.rb +0 -56
- data/spec/symbiont/generators/table_cell_generators_spec.rb +0 -56
- data/spec/symbiont/generators/table_generators_spec.rb +0 -56
- data/spec/symbiont/generators/text_area_generators_spec.rb +0 -72
- data/spec/symbiont/generators/text_field_generators_spec.rb +0 -72
- data/spec/symbiont/generators_spec.rb +0 -59
- data/spec/symbiont/locators_spec.rb +0 -68
- data/spec/symbiont/platform_object_spec.rb +0 -18
- data/spec/symbiont/symbiont_spec.rb +0 -29
- data/spec/symbiont/web_object_spec.rb +0 -194
- data/spec/symbiont/web_objects/button_spec.rb +0 -38
- data/spec/symbiont/web_objects/checkbox_spec.rb +0 -27
- data/spec/symbiont/web_objects/div_spec.rb +0 -18
- data/spec/symbiont/web_objects/heading_spec.rb +0 -22
- data/spec/symbiont/web_objects/hidden_field_spec.rb +0 -18
- data/spec/symbiont/web_objects/label_spec.rb +0 -18
- data/spec/symbiont/web_objects/link_spec.rb +0 -33
- data/spec/symbiont/web_objects/list_item_spec.rb +0 -18
- data/spec/symbiont/web_objects/option_spec.rb +0 -9
- data/spec/symbiont/web_objects/ordered_list_spec.rb +0 -53
- data/spec/symbiont/web_objects/paragraph_spec.rb +0 -18
- data/spec/symbiont/web_objects/radio_spec.rb +0 -27
- data/spec/symbiont/web_objects/select_list_spec.rb +0 -69
- data/spec/symbiont/web_objects/span_spec.rb +0 -18
- data/spec/symbiont/web_objects/table_cell_spec.rb +0 -19
- data/spec/symbiont/web_objects/table_row_spec.rb +0 -58
- data/spec/symbiont/web_objects/table_spec.rb +0 -61
- data/spec/symbiont/web_objects/text_area_spec.rb +0 -18
- data/spec/symbiont/web_objects/text_field_spec.rb +0 -39
- data/spec/symbiont/web_objects/unordered_list_spec.rb +0 -51
- data/specs/common/support/browser.rb +0 -25
- data/specs/common/support/env.rb +0 -6
- data/specs/common/support/events.rb +0 -15
- data/specs/enclosers.feature +0 -9
- data/specs/evaluators.feature +0 -26
- data/specs/pages/characters.rb +0 -22
- data/specs/pages/home.rb +0 -9
- data/specs/pages/stardate.rb +0 -23
- data/specs/pages/web_objects.rb +0 -77
- data/specs/select_list.feature +0 -53
- data/specs/steps/enclosers_steps.rb +0 -17
- data/specs/steps/evaluators_steps.rb +0 -44
- data/specs/steps/navigation_steps.rb +0 -14
- data/specs/steps/select_list_steps.rb +0 -94
- data/specs/steps/table_cell_steps.rb +0 -31
- data/specs/steps/table_steps.rb +0 -87
- data/specs/table.feature +0 -49
- data/specs/table_cell.feature +0 -27
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 05110d9c5eeb8d6971262bff19bad09cc4ed6086
|
|
4
|
+
data.tar.gz: 589f9bbbf1eb5d49a919486bf7a31b89b952d4ab
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 298a058116b50448144fd72a1101951ffbe85fd6b57a246de08be66aad13b309905a0f61552632a24a2f20b476c5dc40ca933fc88fd75d217fe7420a719c82d1
|
|
7
|
+
data.tar.gz: ef93ec40a82704bd0e00b3e8d85c566ba725f2e8ce39db1d1670903c9abf8387e6f4cacadd25cea103c556f82b4a7f2a6e4d6b2bb92b12c5e9fe05c656dca9a5
|
data/.coveralls.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
service_name: 'travis-ci'
|
data/.gitignore
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
*.
|
|
2
|
-
*.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.bundle
|
|
19
|
+
*.so
|
|
20
|
+
*.o
|
|
21
|
+
*.a
|
|
22
|
+
mkmf.log
|
data/.travis.yml
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
rvm:
|
|
4
|
-
- 1.9.
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
language: ruby
|
|
2
|
+
|
|
3
|
+
rvm:
|
|
4
|
+
- 1.9.3
|
|
5
|
+
- 2.0.0
|
|
6
|
+
- 2.1.1
|
|
7
|
+
- jruby-19mode
|
|
8
|
+
|
|
9
|
+
branches:
|
|
10
|
+
except:
|
|
11
|
+
- experimental
|
|
12
|
+
|
|
13
|
+
branches:
|
|
14
|
+
only:
|
|
15
|
+
- master
|
|
16
|
+
- develop
|
|
17
|
+
|
|
18
|
+
notifications:
|
|
19
|
+
recipients:
|
|
20
|
+
- jeffnyman@gmail.com
|
|
21
|
+
|
|
22
|
+
matrix:
|
|
23
|
+
fast_finish: true
|
|
24
|
+
allow_failures:
|
|
25
|
+
- rvm: jruby-19mode
|
data/Gemfile
CHANGED
data/{LICENSE → LICENSE.txt}
RENAMED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2014 Jeff Nyman
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,65 +1,57 @@
|
|
|
1
|
-
Symbiont
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
A "symbiont" is an organism in a symbiotic (mutually beneficial) relationship. Some of these relationships are called _obligate_, which means that both organisms need each other in order to survive. Other such relationships are called _facultative_, meaning that both organisms don't strictly need each other to survive, but they stand a better chance if they do.
|
|
38
|
-
|
|
39
|
-
Symbiotic relationships include associations in which one organism lives on another organism -- _ectosymbiosis_ -- or where one organism lives inside the other -- _endosymbiosis_.
|
|
40
|
-
|
|
41
|
-
So, with that bit of context, think of this
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Copyright
|
|
61
|
-
---------
|
|
62
|
-
|
|
63
|
-
See the LICENSE file for details.
|
|
64
|
-
|
|
65
|
-
In short, Lucid is under an MIT license. Since I'm borrowing from many other people, just as they borrowed from many other people before them, I'm just establishing I wrote _this_ particular version. (If nothing else, this means you know who to blame.)
|
|
1
|
+
# Symbiont
|
|
2
|
+
|
|
3
|
+
[](http://badge.fury.io/rb/symbiont)
|
|
4
|
+
[](http://travis-ci.org/jnyman/symbiont)
|
|
5
|
+
[](https://coveralls.io/r/jnyman/symbiont?branch=master)
|
|
6
|
+
[](https://codeclimate.com/github/jnyman/symbiont)
|
|
7
|
+
[](https://gemnasium.com/jnyman/symbiont)
|
|
8
|
+
|
|
9
|
+
Symbiont provides a semantic domain-specific language that can be used to construct a fluent interface for test execution libraries. The initial focus will be on using the [watir-webdriver](https://github.com/watir/watir-webdriver) API as the underlying driver library.
|
|
10
|
+
|
|
11
|
+
[](https://gitter.im/jnyman/symbiont)
|
|
12
|
+
[](https://coderwall.com/jnyman)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
You can use Symbiont as part of another project, in which case you can add the following to your Gemfile:
|
|
18
|
+
|
|
19
|
+
gem 'symbiont'
|
|
20
|
+
|
|
21
|
+
And then execute:
|
|
22
|
+
|
|
23
|
+
$ bundle
|
|
24
|
+
|
|
25
|
+
You can also install Symbiont just as you would any other gem:
|
|
26
|
+
|
|
27
|
+
$ gem install symbiont
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
Instructions on how to use Symbiont will be available as the interface is defined. You can check out the [Symbiont test script](https://github.com/jnyman/symbiont/blob/master/test/symbiont-script.rb) for an idea of how the library can be interacted with. Do note that the test script requires a local copy of [Dialogic](https://github.com/jnyman/dialogic) to be running. To execute the test script:
|
|
32
|
+
|
|
33
|
+
$ rake test:script
|
|
34
|
+
|
|
35
|
+
## Why call it Symbiont?
|
|
36
|
+
|
|
37
|
+
A "symbiont" is an organism in a symbiotic (mutually beneficial) relationship. Some of these relationships are called _obligate_, which means that both organisms need each other in order to survive. Other such relationships are called _facultative_, meaning that both organisms don't strictly need each other to survive, but they stand a better chance if they do.
|
|
38
|
+
|
|
39
|
+
Symbiotic relationships include associations in which one organism lives on another organism -- _ectosymbiosis_ -- or where one organism lives inside the other -- _endosymbiosis_.
|
|
40
|
+
|
|
41
|
+
So, with that bit of context, think of this library as a facultative, endosymbiotic organism that lives within your test logic, giving it strength and sustenance.
|
|
42
|
+
|
|
43
|
+
## Contributing
|
|
44
|
+
|
|
45
|
+
1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
|
|
46
|
+
2. Create a feature branch. (`git checkout -b my-new-feature`)
|
|
47
|
+
3. Commit your changes. (`git commit -am 'new feature'`)
|
|
48
|
+
4. Push the branch. (`git push origin my-new-feature`)
|
|
49
|
+
5. Create a new [pull request](https://help.github.com/articles/using-pull-requests).
|
|
50
|
+
|
|
51
|
+
## Credits
|
|
52
|
+
|
|
53
|
+
Thanks to Jeff Morgan ([http://www.cheezyworld.com/](http://www.cheezyworld.com/)) for his [page-object](https://github.com/cheezy/page-object) gem, Alister Scott ([http://watirmelon.com](http://watirmelon.com)) for his [watir-page-helper](https://github.com/alisterscott/watir-page-helper) gem, Alex Rodionov ([(http://p0deje.blogspot.com/](http://p0deje.blogspot.com/)) for his [watirsome](https://github.com/p0deje/watirsome) gem, and Nat Ritmeyer ([http://www.natritmeyer.com/](http://www.natritmeyer.com/)) for his [SitePrism](https://github.com/natritmeyer/site_prism/) gem.
|
|
54
|
+
|
|
55
|
+
## Copyright
|
|
56
|
+
|
|
57
|
+
Symbiont is distributed under the MIT license. See the [LICENSE](https://github.com/jnyman/symbiont/blob/master/LICENSE.txt) file for details.
|
data/Rakefile
CHANGED
|
@@ -1,34 +1,28 @@
|
|
|
1
|
-
#!/usr/bin/env rake
|
|
2
|
-
require 'bundler/gem_tasks'
|
|
3
|
-
require 'rspec/core/rake_task'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Cucumber::Rake::Task.new(:watir, "Run Cucumber with Watir") do |config|
|
|
30
|
-
config.profile = 'default'
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
task :default => :spec
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
require 'bundler/gem_tasks'
|
|
3
|
+
require 'rspec/core/rake_task'
|
|
4
|
+
|
|
5
|
+
namespace :test do
|
|
6
|
+
desc 'Run the Symbiont script.'
|
|
7
|
+
task :script do
|
|
8
|
+
system('ruby ./test/symbiont-script.rb')
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
namespace :spec do
|
|
13
|
+
desc 'Clean all generated reports'
|
|
14
|
+
task :clean do
|
|
15
|
+
system('rm -rf spec/reports')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
RSpec::Core::RakeTask.new(:all => :clean) do |config|
|
|
19
|
+
options = %w(--color)
|
|
20
|
+
options += %w(--format documentation)
|
|
21
|
+
options += %w(--format html --out spec/reports/symbiont-test-report.html)
|
|
22
|
+
options += %w(--format nested --out spec/reports/symbiont-test-report.txt)
|
|
23
|
+
|
|
24
|
+
config.rspec_opts = options
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
task default: %w(spec:all)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Symbiont
|
|
2
|
+
module Assertion
|
|
3
|
+
include Helpers
|
|
4
|
+
|
|
5
|
+
def url_is(url=nil)
|
|
6
|
+
url_is_empty if url.nil? or url.empty?
|
|
7
|
+
@url = url
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def url_matches(pattern=nil)
|
|
11
|
+
url_match_is_empty if pattern.nil?
|
|
12
|
+
url_match_is_empty if pattern.is_a?(String) and pattern.empty?
|
|
13
|
+
@url_match = pattern
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def title_is(title=nil)
|
|
17
|
+
title_is_empty if title.nil? or title.empty?
|
|
18
|
+
@title = title
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def url
|
|
22
|
+
@url
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def url_match
|
|
26
|
+
@url_match
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def page_title
|
|
30
|
+
@title
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module Symbiont
|
|
2
|
+
# Calls the Watir module to get a list of the factory methods that
|
|
3
|
+
# Watir uses to reference and access web objects.
|
|
4
|
+
#
|
|
5
|
+
# @return [Array] factory method list
|
|
6
|
+
def self.elements
|
|
7
|
+
unless @elements
|
|
8
|
+
@elements = Watir::Container.instance_methods
|
|
9
|
+
end
|
|
10
|
+
@elements
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module Element
|
|
14
|
+
# Iterates through Watir factory methods. Each method is defined
|
|
15
|
+
# as a method that can be called on a page class. This is what
|
|
16
|
+
# allows element definitions to be created.
|
|
17
|
+
Symbiont.elements.each do |element|
|
|
18
|
+
define_method element do |*signature, &block|
|
|
19
|
+
identifier, locator = parse_signature(signature)
|
|
20
|
+
context = context_from_signature(locator, &block)
|
|
21
|
+
define_element_accessor(identifier, locator, element, &context)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
# @param identifier [String] friendly name of element definition
|
|
28
|
+
# @param locator [Array] locators for referencing the element
|
|
29
|
+
# @param element [String] name of Watir-based object
|
|
30
|
+
# @param block [Proc] a context block
|
|
31
|
+
#
|
|
32
|
+
# @example
|
|
33
|
+
# enable, {:id => 'enableForm'}, checkbox
|
|
34
|
+
def define_element_accessor(identifier, locator, element, &block)
|
|
35
|
+
define_method "#{identifier}".to_sym do |*values|
|
|
36
|
+
#puts "*** *values: #{values}"
|
|
37
|
+
|
|
38
|
+
if block_given?
|
|
39
|
+
instance_exec(*values, &block)
|
|
40
|
+
else
|
|
41
|
+
reference_element(element, locator)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Returns the identifier and locator portions of an element definition.
|
|
47
|
+
#
|
|
48
|
+
# @param signature [Array] full element definition
|
|
49
|
+
# @return [String] identifier and locator portions
|
|
50
|
+
def parse_signature(signature)
|
|
51
|
+
return signature.shift, signature.shift
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Returns the block or proc that serves as a context for an element
|
|
55
|
+
# definition.
|
|
56
|
+
#
|
|
57
|
+
# @param locator [Array] locators from element definition
|
|
58
|
+
# @param block [Proc] a context block
|
|
59
|
+
def context_from_signature(*locator, &block)
|
|
60
|
+
if block_given?
|
|
61
|
+
block
|
|
62
|
+
else
|
|
63
|
+
context = locator.shift
|
|
64
|
+
context.is_a?(Proc) && locator.empty? ? context : nil
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
end
|
data/lib/symbiont/factory.rb
CHANGED
|
@@ -1,46 +1,75 @@
|
|
|
1
|
-
module Symbiont
|
|
2
|
-
module Factory
|
|
3
|
-
|
|
4
|
-
# Creates a definition context for actions.
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# @param [
|
|
8
|
-
#
|
|
9
|
-
# @
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@active
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
module Symbiont
|
|
2
|
+
module Factory
|
|
3
|
+
|
|
4
|
+
# Creates a definition context for actions. If an existing context
|
|
5
|
+
# exists, that context will be re-used.
|
|
6
|
+
#
|
|
7
|
+
# @param definition [Class] the name of a definition class
|
|
8
|
+
# @param visit [Boolean] true if the context needs to be called into view
|
|
9
|
+
# @param block [Proc] logic to execute in the context of the definition
|
|
10
|
+
# @return [Object] instance of the definition
|
|
11
|
+
def on(definition, visit=false, &block)
|
|
12
|
+
if @active.kind_of?(definition)
|
|
13
|
+
block.call @active if block
|
|
14
|
+
return @active
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
if @context.kind_of?(definition)
|
|
18
|
+
block.call @context if block
|
|
19
|
+
return @context
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
@active = definition.new(@driver)
|
|
23
|
+
@active.view if visit == true
|
|
24
|
+
block.call @active if block
|
|
25
|
+
|
|
26
|
+
@active
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
alias_method :on_page, :on
|
|
30
|
+
alias_method :while_on, :on
|
|
31
|
+
|
|
32
|
+
# Creates a definition context for actions and establishes the
|
|
33
|
+
# context for display.
|
|
34
|
+
#
|
|
35
|
+
# @param definition [Class] the name of a definition class
|
|
36
|
+
# @param block [Proc] logic to execute in the context of the definition
|
|
37
|
+
# @return [Object] instance of the definition
|
|
38
|
+
def on_view(definition, &block)
|
|
39
|
+
on(definition, true, &block)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
alias_method :on_visit, :on_view
|
|
43
|
+
|
|
44
|
+
# Creates a definition context for actions. Unlike the on() factory,
|
|
45
|
+
# on_new will always create a new context and will never re-use an
|
|
46
|
+
# existing one.
|
|
47
|
+
#
|
|
48
|
+
# @param definition [Class] the name of a definition class
|
|
49
|
+
# @param block [Proc] logic to execute in the context of the definition
|
|
50
|
+
# @return [Object] instance of the definition
|
|
51
|
+
def on_new(definition, &block)
|
|
52
|
+
@active = nil
|
|
53
|
+
|
|
54
|
+
if @context.kind_of?(definition)
|
|
55
|
+
@context = nil
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
on(definition, &block)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Creates a definition context for actions. If an existing context
|
|
62
|
+
# exists, that context will be re-used. This also sets a context that
|
|
63
|
+
# will be used for that definition even if the active definition
|
|
64
|
+
# changes.
|
|
65
|
+
#
|
|
66
|
+
# @param definition [Class] the name of a definition class
|
|
67
|
+
# @param block [Proc] logic to execute within the context of the definition
|
|
68
|
+
# @return [Object] instance of the definition
|
|
69
|
+
def on_set(definition, &block)
|
|
70
|
+
on(definition, &block)
|
|
71
|
+
@context = @active
|
|
72
|
+
@active
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Symbiont
|
|
2
|
+
module Helpers
|
|
3
|
+
def url_is_empty
|
|
4
|
+
puts "\nERROR".on_red
|
|
5
|
+
puts "The url_is assertion is empty on the definition #{retrieve_class(caller)}.".cyan
|
|
6
|
+
raise Symbiont::Errors::NoUrlForDefinition
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def url_match_is_empty
|
|
10
|
+
puts "\nERROR".on_red
|
|
11
|
+
puts "The url_matches assertion is empty on the definition #{retrieve_class(caller)}.".cyan
|
|
12
|
+
raise Symbiont::Errors::NoUrlMatchForDefinition
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def title_is_empty
|
|
16
|
+
puts "\nERROR".on_red
|
|
17
|
+
puts "The title_is assertion is empty on the definition #{retrieve_class(caller)}.".cyan
|
|
18
|
+
raise Symbiont::Errors::NoTitleForDefinition
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def no_url_is_provided
|
|
22
|
+
puts "\nERROR".on_red
|
|
23
|
+
puts "You called a '#{retrieve_method(caller)}' action but the definition #{self.class} does not have a url_is assertion.".cyan
|
|
24
|
+
raise Symbiont::Errors::NoUrlForDefinition
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def no_url_matches_is_provided
|
|
28
|
+
puts "\nERROR".on_red
|
|
29
|
+
puts "You called a '#{retrieve_method(caller)}' action but the definition #{self.class} does not have a url_matches assertion.".cyan
|
|
30
|
+
raise Symbiont::Errors::NoUrlMatchForDefinition
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def no_title_is_provided
|
|
34
|
+
puts "\nERROR".on_red
|
|
35
|
+
puts "You called a '#{retrieve_method(caller)}' action but the definition #{self.class} does not have a title_is assertion.".cyan
|
|
36
|
+
raise Symbiont::Errors::NoTitleForDefinition
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def retrieve_class(caller)
|
|
42
|
+
caller[1][/`.*'/][8..-3]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def retrieve_method(caller)
|
|
46
|
+
caller[0][/`.*'/][1..-2]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|