symbiont 0.10.0 → 0.11.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.
@@ -1,159 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $: << './lib'
3
-
4
- require 'rspec'
5
- include RSpec::Matchers
6
-
7
- require 'watir-webdriver'
8
-
9
- require 'symbiont'
10
- include Symbiont::Factory
11
-
12
- #========================================
13
-
14
- class Dialogic
15
- attach Symbiont
16
-
17
- url_is 'http://localhost:9292'
18
-
19
- p :login_form, id: 'open'
20
- text_field :username, id: 'username'
21
- text_field :password, id: 'password'
22
- button :login, id: 'login-button'
23
-
24
- def login_as_admin
25
- login_form.click
26
- username.set 'admin'
27
- password.set 'admin'
28
- login.click
29
- end
30
- end
31
-
32
- class Weight
33
- attach Symbiont
34
-
35
- url_is 'http://localhost:9292/weight'
36
-
37
- text_field :weight, id: 'wt', index: 0
38
- button :calculate, id: 'calculate'
39
-
40
- def convert(value)
41
- weight.set value
42
- end
43
- end
44
-
45
- class Practice
46
- attach Symbiont
47
-
48
- url_is 'http://localhost:9292/practice'
49
- url_matches /:\d{4}/
50
- title_is 'Dialogic - Practice Page'
51
-
52
- checkbox :enable_sith_list, id: 'toggleSith'
53
- select_list :sith_power, id: 'sith'
54
- select_list :physics_concept, id: 'physics'
55
-
56
- button :alert, id: 'alertButton'
57
- button :confirm, id: 'confirmButton'
58
- button :prompt, id: 'promptButton'
59
-
60
- link :view_in_frame, id: 'framed_page'
61
-
62
- iframe :boxframe, class: 'fancybox-iframe'
63
-
64
- text_field :weight, -> { boxframe.text_field(id: 'wt') }
65
-
66
- article :practice, id: 'practice'
67
-
68
- a :page_link do |text|
69
- practice.a(text: text)
70
- end
71
- end
72
-
73
- def non_framed
74
- @page = Weight.new(@driver)
75
- @page.view
76
- @page.weight.set '200'
77
- @page.calculate.click
78
- end
79
-
80
- def framed
81
- @page = Practice.new(@driver)
82
- @page.view
83
- ##@page.view_in_frame.click
84
- @page.page_link('View Weight Calculator in Frame').click
85
- @page.weight.set '200'
86
-
87
- ##on_view(Practice).page_link('View Weight Calculator in Frame').click
88
- end
89
-
90
- def basic
91
- @page = Practice.new(@driver)
92
- @page.should be_a_kind_of(Symbiont)
93
- @page.should be_an_instance_of(Practice)
94
-
95
- @page.view
96
- @page.has_correct_url?
97
- @page.has_correct_title?
98
-
99
- @page.should have_correct_url
100
- @page.should have_correct_title
101
-
102
- expect(@page.url).to eq('http://localhost:9292/practice')
103
- @page.markup.include?('<strong id="group">Apocalypticists Unite</strong>').should be_true
104
- @page.text.include?('LEAST FAVORITE WAY').should be_true
105
- expect(@page.title).to eq('Dialogic - Practice Page')
106
-
107
- script = <<-JS
108
- return arguments[0].innerHTML
109
- JS
110
-
111
- result = @page.run_script(script, @page.view_in_frame)
112
- expect(result).to eq('View Weight Calculator in Frame')
113
- end
114
-
115
- def factory
116
- on_view(Weight)
117
- on(Weight).convert('200')
118
- on(Weight).calculate.click
119
-
120
- on(Weight) do
121
- @active.convert('200')
122
- @active.calculate.click
123
- end
124
-
125
- on(Weight) do |page|
126
- page.convert('200')
127
- page.calculate.click
128
- end
129
- end
130
-
131
- def javascript_dialogs
132
- response = @page.will_alert { @page.alert.click }
133
- expect(response).to eq 'Alert Message Received'
134
-
135
- response = @page.will_confirm(false) { @page.confirm.click }
136
- expect(response).to eq 'Confirmation Message Received'
137
-
138
- response = @page.will_prompt("magenta") { @page.prompt.click }
139
- expect(response[:message]).to eq('Favorite Color')
140
- expect(response[:default_value]).to eq('blue')
141
- end
142
-
143
- def wait_state
144
- Watir::Wait.until { @page.weight.exists? }
145
- @page.weight.when_present.set '200'
146
- end
147
-
148
- #basic
149
-
150
- symbiont_browser
151
-
152
- @page = Dialogic.new(@browser)
153
- @page.view
154
- @page.login_as_admin
155
-
156
- @page = Practice.new(@browser)
157
- @page.view
158
- @page.enable_sith_list.set
159
- @page.sith_power.select 'Sundering Assault'