class CiHelper::CiProcedure
Constants
- CI_DOMAIN
- CI_LOGIN_URL
this class hardcoding the procedure to the result page
- Result
Attributes
account[R]
console_page[RW]
issue_page[RW]
main_page[R]
matching_strategy[RW]
mechanize[R]
password[R]
raam_page[RW]
result[RW]
Public Class Methods
new(account, password)
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 16 def initialize(account, password) @account = account @password = password @mechanize = Mechanize.new end
Public Instance Methods
branch_name()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 44 def branch_name issue_link.text.split(' ')[1] end
commit_hash()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 48 def commit_hash issue_link.text.split(' ')[2] end
get_console_output()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 36 def get_console_output console_page.search("pre.console-output").text end
issue_number()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 40 def issue_number branch_name[1..4] end
re_get_console_output()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 29 def re_get_console_output self.raam_page = go_to_pull_request_page self.issue_page = go_to_issue self.console_page = go_to_console_output get_console_output end
run()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 22 def run @main_page = login @raam_page = go_to_pull_request_page @issue_page = go_to_issue @console_page = go_to_console_output end
Private Instance Methods
go_to_console_output()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 79 def go_to_console_output issue_page ? issue_page.link_with(text: 'Console Output').click : false end
go_to_develop_page()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 70 def go_to_develop_page main_page.link_with(text: 'Vansys - develop').click end
go_to_issue()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 74 def go_to_issue fail CiHelper::Exceptions::IssueNotFound, 'you may be enter wrong ticket number ' unless issue_link issue_link.click end
go_to_pull_request_page()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 66 def go_to_pull_request_page main_page.link_with(text: 'Vansys - pull request').click end
issue_link()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 83 def issue_link links = raam_page.links links.select { |link| link.text.match(matching_strategy) }.first end
login()
click to toggle source
# File lib/ci_helper/ci_procedure.rb, line 54 def login login_page = mechanize.get(CI_LOGIN_URL) response_page = login_page.form_with(action: 'j_acegi_security_check') do |form| form.fields_with(name: 'j_username').first.value = account form.fields_with(name: 'j_password').first.value = password end.click_button puts 'login success' response_page end