Module: Capybara::Bamboo::Client
- Extended by:
- BambooHelper, DSL, RSpec::Matchers
- Defined in:
- lib/capybara-bamboo-client.rb,
lib/capybara-bamboo-client/plan.rb,
lib/capybara-bamboo-client/version.rb,
lib/capybara-bamboo-client/bamboo_helper.rb
Defined Under Namespace
Modules: BambooHelper Classes: Plan
Constant Summary collapse
- VERSION =
"0.0.1"
Class Attribute Summary collapse
-
.app_host ⇒ Object
Returns the value of attribute app_host.
-
.bamboo_url ⇒ Object
Returns the value of attribute bamboo_url.
-
.capybara_timeout ⇒ Object
Returns the value of attribute capybara_timeout.
-
.password ⇒ Object
Returns the value of attribute password.
-
.phantomjs_path ⇒ Object
Returns the value of attribute phantomjs_path.
-
.plans ⇒ Object
Returns the value of attribute plans.
-
.username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Methods included from BambooHelper
app_host_from_url, get_plan_key, included, register_driver
Class Attribute Details
.app_host ⇒ Object
Returns the value of attribute app_host.
15 16 17 |
# File 'lib/capybara-bamboo-client.rb', line 15 def app_host @app_host end |
.bamboo_url ⇒ Object
Returns the value of attribute bamboo_url.
15 16 17 |
# File 'lib/capybara-bamboo-client.rb', line 15 def bamboo_url @bamboo_url end |
.capybara_timeout ⇒ Object
Returns the value of attribute capybara_timeout.
15 16 17 |
# File 'lib/capybara-bamboo-client.rb', line 15 def @capybara_timeout end |
.password ⇒ Object
Returns the value of attribute password.
15 16 17 |
# File 'lib/capybara-bamboo-client.rb', line 15 def password @password end |
.phantomjs_path ⇒ Object
Returns the value of attribute phantomjs_path.
15 16 17 |
# File 'lib/capybara-bamboo-client.rb', line 15 def phantomjs_path @phantomjs_path end |
.plans ⇒ Object
Returns the value of attribute plans.
15 16 17 |
# File 'lib/capybara-bamboo-client.rb', line 15 def plans @plans end |
.username ⇒ Object
Returns the value of attribute username.
15 16 17 |
# File 'lib/capybara-bamboo-client.rb', line 15 def username @username end |
Class Method Details
.configure {|_self| ... } ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/capybara-bamboo-client.rb', line 17 def configure yield self @capybara_timeout ||= 60 @phantomjs_path ||= File.('../../drivers/phantomjs.exe', __FILE__) @plans = [] @app_host ||= app_host_from_url(bamboo_url) register_driver , phantomjs_path, app_host self end |
.construct_plans ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/capybara-bamboo-client.rb', line 43 def construct_plans find('table[id="dashboard"]').all('tbody tr').each do |tr| tds = tr.all('td') plan_name_link = tds.first.find('a') plan_key = get_plan_key(plan_name_link[:id]) operation_links = tds.last.all('a') @plans << Plan.new({app_host: app_host, name: plan_name_link.text, key: plan_key, url: plan_name_link[:href], build_action_url: operation_links.first[:href], edit_plan_url: operation_links[1][:href], favourite_plan_url: operation_links.last[:href]}).tap{|i| p i.inspect} end end |
.login ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/capybara-bamboo-client.rb', line 27 def login visit bamboo_url expect(page.all('createPlanLink').any?).to be false click_link 'login' fill_in 'loginForm_os_username', with: username || ENV[:BAMBOO_USERNAME] fill_in 'loginForm_os_password', with: password || ENV[:BAMBOO_PASSWORD] find('#loginForm_save').click expect(page).to ('createPlanLink') end |
.logout ⇒ Object
37 38 39 40 41 |
# File 'lib/capybara-bamboo-client.rb', line 37 def logout reset_session! visit bamboo_url expect(page).to have_link('login') end |