Top Level Namespace
Defined Under Namespace
Modules: IfdAutomation
Instance Method Summary collapse
- #accept_alert ⇒ Object
- #assert_string_contain(expected, actual) ⇒ Object
- #assert_string_equal(expected, actual) ⇒ Object
- #assert_string_not_equal(expected, actual) ⇒ Object
- #back ⇒ Object
- #bind_with_dyn_json_vars(json, bind_json) ⇒ Object
-
#bind_with_dyn_vars(str) ⇒ Object
bind string with $dyn_vars context.
- #check_dynamic_value(value) ⇒ Object
- #check_string_letters_only(strToCheck) ⇒ Object
- #check_valid_keys?(key) ⇒ Boolean
- #check_valid_option_by?(option_by) ⇒ Boolean
- #clear_text(element) ⇒ Object
- #close_windows ⇒ Object
-
#do_assertion_csv_tab_non_order(expected_obj, actual_obj) ⇒ Object
Assert two files, rows not in order and REMOVE 1 COLUMN OF ID.
- #do_assertion_json(expected_obj, actual_obj, options = {}) ⇒ Object
- #double_click(element) ⇒ Object
- #drag_and_drop_by_offset(element, x, y) ⇒ Object
- #drag_and_drop_to_object(from_element, element) ⇒ Object
-
#eval_with_dyn_vars(operation) ⇒ Object
evaluate operation/statement with $dyn_vars context.
- #execute_checkproperty(element, property, negate, value, isSpecialChar = false) ⇒ Object
- #execute_click(element) ⇒ Object
- #execute_click_offset(element, x, y) ⇒ Object
- #execute_javascript(script) ⇒ Object
- #execute_mouse_over(element) ⇒ Object
- #execute_openbrowser(url_site) ⇒ Object
- #execute_select(element, text) ⇒ Object
- #execute_sendkeys(element, key) ⇒ Object
-
#execute_setstate(element, state) ⇒ Object
Set state.
- #execute_settext(element, text) ⇒ Object
- #find_object(string_object) ⇒ Object
- #find_object_check_Class(element, strClass) ⇒ Object
- #find_object_check_Id(element, strId) ⇒ Object
- #find_object_check_maxHeight(element, maxHeight) ⇒ Object
- #find_object_check_maxWidth(element, maxWidth) ⇒ Object
- #find_object_check_minHeight(element, minHeight) ⇒ Object
- #find_object_check_minWidth(element, minWidth) ⇒ Object
- #find_object_check_Name(element, strName) ⇒ Object
- #find_object_check_object(cur_element, ref_object, ref_object_type, strId, strClass, strName, strTagname, strText, minWidth, maxWidth, minHeight, maxHeight, ano_pros) ⇒ Object
- #find_object_check_ref_object(ref_object, ref_type, target_element) ⇒ Object
- #find_object_check_Tagname(element, strTagname) ⇒ Object
- #find_object_check_Text(element, strText) ⇒ Object
- #find_object_check_Xpath(element, strXpath) ⇒ Object
- #generate_xpath_selector(strId, strClass, strName, strTagname) ⇒ Object
- #get_computed_style(element, style) ⇒ Object
- #get_element_attribute(element, value) ⇒ Object
- #get_element_text(element) ⇒ Object
- #get_object_and_store_as_string(object, string) ⇒ Object
- #get_object_and_store_to_file(object, file_name) ⇒ Object
- #get_object_value(str_obj) ⇒ Object
- #get_objects_by_Class(strClass) ⇒ Object
- #get_objects_by_css_selector(strCssSelector) ⇒ Object
- #get_objects_by_Id(strId) ⇒ Object
- #get_objects_by_Name(strName) ⇒ Object
- #get_objects_by_Tagname(strTagname) ⇒ Object
- #get_objects_by_xpath_selector(strXpathSelector) ⇒ Object
- #maximize_browser ⇒ Object
- #movemouseandclick(var, element) ⇒ Object
- #print_variable(variable) ⇒ Object
- #put_log(str) ⇒ Object
- #refresh ⇒ Object
-
#reg_compare(sActual, regValue, isSpecialChar = false) ⇒ Object
Assert 2 values.
- #remove_element_attribute(element, attr) ⇒ Object
- #replace_day(str) ⇒ Object
- #replace_month(str) ⇒ Object
- #replace_pipe(str_pipe) ⇒ Object
- #replace_year(str) ⇒ Object
- #resize_window_screen(x, y) ⇒ Object
- #resolve_params(url) ⇒ Object
- #scroll_to_end_page ⇒ Object
- #scroll_to_top_page ⇒ Object
-
#set_var(var_name, var_value) ⇒ Object
set value to a variable.
- #store_string_as_variable(string, variable) ⇒ Object
- #switch_to_frame(element) ⇒ Object
- #switch_to_window_by_title(window_title) ⇒ Object
- #validate_option_by(option_by) ⇒ Object
- #validate_supported_keys(key) ⇒ Object
- #var_collect(string_var) ⇒ Object
- #verify_alert_text(text) ⇒ Object
- #verify_element_not_has_text(element, value) ⇒ Object
- #verify_element_not_has_value(element, value) ⇒ Object
- #verify_element_text(element, value) ⇒ Object
- #verify_element_value(element, value) ⇒ Object
- #verify_title(expected_title) ⇒ Object
Instance Method Details
#accept_alert ⇒ Object
148 149 150 151 152 153 154 155 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 148 def accept_alert begin page.driver.browser.switch_to.alert.accept rescue Exception => e raise "\n>>> ERROR: #{e}" exit end end |
#assert_string_contain(expected, actual) ⇒ Object
81 82 83 84 85 |
# File 'lib/Ifd_Automation/assertion_helper.rb', line 81 def assert_string_contain(expected, actual) unless (actual.to_s).include? (expected.to_s) raise ("*** ASSERTION ERROR: \nExpected: #{expected}. \nGot: #{actual}.") end end |
#assert_string_equal(expected, actual) ⇒ Object
87 88 89 90 91 |
# File 'lib/Ifd_Automation/assertion_helper.rb', line 87 def assert_string_equal(expected, actual) if expected.to_s != actual.to_s raise ("*** ASSERTION ERROR: \nExpected: #{expected}. \nGot: #{actual}.") end end |
#assert_string_not_equal(expected, actual) ⇒ Object
93 94 95 96 97 |
# File 'lib/Ifd_Automation/assertion_helper.rb', line 93 def assert_string_not_equal(expected, actual) if expected.to_s == actual.to_s raise ("*** ASSERTION ERROR: \nExpected: #{expected}. \nGot: #{actual}.") end end |
#back ⇒ Object
157 158 159 160 161 162 163 164 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 157 def back begin page.execute_script('window.history.back()') rescue Exception => e raise "\n>>> ERROR: #{e}" exit end end |
#bind_with_dyn_json_vars(json, bind_json) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/Ifd_Automation/auto_util.rb', line 62 def bind_with_dyn_json_vars(json, bind_json) if json.kind_of? Hash json.each_pair do |k, v| if v.kind_of? String bind_json[bind_with_dyn_vars(k)] = bind_with_dyn_json_vars(v, bind_json) elsif v.kind_of? Hash temp = Hash.new v.each_pair do |k1, v1| temp[bind_with_dyn_vars(k1)] = bind_with_dyn_json_vars(v1, temp) end bind_json[bind_with_dyn_vars(k)] = temp elsif v.kind_of? Array temp1 = Array.new v.each { |item| temp2 = Hash.new bind_with_dyn_json_vars(item, temp2) temp1 << temp2 } bind_json[bind_with_dyn_vars(k)] = temp1 end end elsif json.kind_of? Array temp1 = Array.new json.each { |item| temp2 = Hash.new bind_with_dyn_json_vars(item, temp2) temp1 << temp2 } return temp1 else return bind_with_dyn_vars(json) end end |
#bind_with_dyn_vars(str) ⇒ Object
bind string with $dyn_vars context
44 45 46 47 48 49 50 51 |
# File 'lib/Ifd_Automation/auto_util.rb', line 44 def bind_with_dyn_vars(str) if $dyn_vars == nil $dyn_vars = binding end strEval = '"' + str + '"' return eval strEval, $dyn_vars end |
#check_dynamic_value(value) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/Ifd_Automation/auto_util.rb', line 16 def check_dynamic_value value if !value.is_a? Fixnum if value.include? "params=" resolve_params value else bind_with_dyn_vars value end else value end end |
#check_string_letters_only(strToCheck) ⇒ Object
671 672 673 674 675 676 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 671 def check_string_letters_only(strToCheck) if strToCheck != nil and strToCheck.length > 0 and strToCheck =~ /^[a-zA-Z]+$/ return true end return false end |
#check_valid_keys?(key) ⇒ Boolean
484 485 486 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 484 def check_valid_keys?(key) %w(:cancel :help :backspace :tab :clear :return :enter :shift :control :alt :pause :escape :space :page_up :page_down :end :home :left :up :right :down :insert :delete :semicolon :equals).include? key end |
#check_valid_option_by?(option_by) ⇒ Boolean
476 477 478 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 476 def check_valid_option_by?(option_by) %w(text value).include? option_by end |
#clear_text(element) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 175 def clear_text(element) foundElement = find_object(element) if foundElement != nil? begin foundElement.native.clear rescue Exception => e raise "\n>>> ERROR: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#close_windows ⇒ Object
264 265 266 267 268 269 270 271 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 264 def close_windows begin page.execute_script "window.close();" rescue StandardError => e raise "\n>>> Error: #{e}" exit end end |
#do_assertion_csv_tab_non_order(expected_obj, actual_obj) ⇒ Object
Assert two files, rows not in order and REMOVE 1 COLUMN OF ID
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/Ifd_Automation/assertion_helper.rb', line 2 def do_assertion_csv_tab_non_order(expected_obj, actual_obj) for i in (1..expected_obj.length - 1) expected_row = expected_obj[i].drop(1).to_s.split("\t") found = false for j in (1..actual_obj.length - 1) actual_row = actual_obj[j].drop(1).to_s.split("\t") if (expected_row == actual_row) found = true break end end assert(found, "Expected Record: [#{expected_obj[i].to_s}] is not included in reporting file") end end |
#do_assertion_json(expected_obj, actual_obj, options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/Ifd_Automation/assertion_helper.rb', line 47 def do_assertion_json(expected_obj, actual_obj, = {}) # puts "\n\n actual_obj.class: #{actual_obj.class}" # puts "\n\n expected_obj.class: #{expected_obj.class}" if expected_obj.kind_of? Hash # if options['isIncludedAssertion'].nil? or options['isIncludedAssertion'] == false # do_assertion(expected_obj.keys.size, actual_obj.keys.size) # end expected_obj.keys.each do |key| # puts "\n\n key: #{key}" # puts "\n\n value: #{expected_obj[key]}" # puts "\n\n value: #{actual_obj[key]}" if actual_obj[key].nil? raise "[%s] expected [%s] but actual value was nil." % [key, expected_obj[key].to_s] else do_assertion_json(expected_obj[key], actual_obj[key], ) end end elsif expected_obj.kind_of? Array if ['isIncludedAssertion'].nil? or ['isIncludedAssertion'] == false do_assertion_json(expected_obj.size, actual_obj.size) end for i in (0..expected_obj.length-1) do_assertion_json(expected_obj[i], actual_obj[i], ) end else begin assert_string_equal(expected_obj.to_s, actual_obj.to_s) rescue => e raise("Assert fail. \n\n Expected: '#{expected_obj}' \n\n Got: '#{actual_obj}'. Detail info: #{e.}") end end end |
#double_click(element) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 54 def double_click(element) foundElement = find_object(element) if foundElement != nil begin foundElement.double_click rescue StandardError => e raise "\n>>> Error: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#drag_and_drop_by_offset(element, x, y) ⇒ Object
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 1006 def drag_and_drop_by_offset(element, x, y) foundElement = find_object(element) if foundElement != nil begin page.driver.browser.action.drag_and_drop_by(foundElement, x, y).perform rescue Exception => e raise "\n>>> ERROR: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#drag_and_drop_to_object(from_element, element) ⇒ Object
1021 1022 1023 1024 1025 1026 1027 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 1021 def drag_and_drop_to_object(from_element, element) found_from_element = find_object(from_element) foundElement = find_object(element) if foundElement != nil and found_from_element != nil found_from_element.drag_to(foundElement) end end |
#eval_with_dyn_vars(operation) ⇒ Object
evaluate operation/statement with $dyn_vars context
54 55 56 57 58 59 60 |
# File 'lib/Ifd_Automation/auto_util.rb', line 54 def eval_with_dyn_vars(operation) if $dyn_vars == nil $dyn_vars = binding end eval operation, $dyn_vars end |
#execute_checkproperty(element, property, negate, value, isSpecialChar = false) ⇒ Object
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 424 def execute_checkproperty(element, property, negate, value, isSpecialChar=false) validate_option_by(property) Capybara.configure do |config| config.ignore_hidden_elements = false end foundElement = find_object(element) check = false if foundElement == nil and value == "" check = true # check.should eq true expect(check).to eq true else # put_log "\n\n\t>>> execute_checkproperty: finish to found element" if foundElement != nil if property.upcase == 'VALUE' actual_value = foundElement.value() elsif property.upcase == 'TEXT' actual_value = foundElement.text() else actual_value = foundElement["#{property}"] end if actual_value == nil actual_value = '' end else put_log "\nError >> Not found object: #{element}" end Capybara.configure do |config| config.ignore_hidden_elements = true end # if IFD_Assertion.reg_compare(actual_value, value, isSpecialChar) # check = true # end put_log "\n#{property} :: Actual result is: '#{actual_value}' -- Expected result is: '#{value}'" if negate == " not" actual_value.should_not eq value expect(actual_value).not_to eql value elsif actual_value.should eq value expect(actual_value).to eq value end end end |
#execute_click(element) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 23 def execute_click(element) foundElement = find_object(element) if foundElement != nil begin foundElement.click rescue StandardError => e raise "\n>>> Error: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#execute_click_offset(element, x, y) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 38 def execute_click_offset(element, x, y) foundElement = find_object(element) if foundElement != nil begin page.driver.browser.mouse.move_to(foundElement.native,x.to_i,y.to_i) page.driver.browser.mouse.click() rescue Exception => e raise "\n>>> Error: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#execute_javascript(script) ⇒ Object
190 191 192 193 194 195 196 197 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 190 def execute_javascript(script) begin page.execute_script(script) rescue Exception => e raise "\nError >> Not found object: #{element}" exit end end |
#execute_mouse_over(element) ⇒ Object
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 217 def execute_mouse_over(element) foundElement = find_object(element) if foundElement != nil begin page.driver.browser.action.move_to(foundElement.native, element).click.perform sleep(1) rescue StandardError => e raise "\n>>> Error: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#execute_openbrowser(url_site) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 5 def execute_openbrowser(url_site) begin if $_CFWEB['Maximize Browser'] == true page.driver.browser.manage.window.maximize end rescue StandardError => e raise "\n>>> Error: #{e}" exit end if url_site == "" raise "\n>>> Error: Null web page URL." exit else visit(url_site) end end |
#execute_select(element, text) ⇒ Object
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 199 def execute_select(element, text) #select(text, :xpath => element) foundElement = find_object(element) if foundElement != nil begin option_value = page.evaluate_script("$(\"##{foundElement[:id]} option:contains('#{text}')\").val()") page.execute_script("$('##{foundElement[:id]}').val('#{option_value}')") page.execute_script("$('##{foundElement[:id]}').trigger('liszt:updated').trigger('change')") rescue Exception => e raise "\n>>> ERROR: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#execute_sendkeys(element, key) ⇒ Object
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 1029 def execute_sendkeys(element, key) validate_supported_keys(key) foundElement = find_object(element) if foundElement != nil begin foundElement.native.send_keys(key) rescue Exception => e raise "\n>>> ERROR: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#execute_setstate(element, state) ⇒ Object
Set state
250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 250 def execute_setstate(element, state) foundElement = find_object(element) if foundElement != nil if state foundElement.select_option else foundElement.unselect_option end else raise "\nError >> Not found object: #{element}" exit end end |
#execute_settext(element, text) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 69 def execute_settext(element, text) foundElement = find_object(element) if foundElement != nil begin foundElement.set(text) rescue StandardError => e raise "\n>>> Error: #{e}" end else raise "\nError >> Not found object: #{element}" exit end end |
#find_object(string_object) ⇒ Object
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 492 def find_object string_object startTime = Time.new.to_i string_object = string_object.gsub(/"/, "'") locator_matching = /(.*?)(\{.*?\})/.match(string_object) dyn_pros = {} if locator_matching != nil string_object = locator_matching[1] eval(locator_matching[2].gsub(/['][\s,\t]*?:[\s,\t]*?[']?/, "'=>'")).each { |k, v| dyn_pros[k.to_s.upcase] = v } end hash_object = $OBJECT[string_object] if hash_object == nil raise "ERROR: >>> Object: #{string_object} is not found in Object Repository." end upcase_attrb = {} if hash_object != nil hash_object.each {|k,v| k = k.to_s.upcase if k =~ /ph_/i if dyn_pros[k] != nil if v =~ /<ph_value>/i upcase_attrb[k[3..k.size-1]] = v.gsub(/<ph_value>/i, dyn_pros[k]) else upcase_attrb[k[3..k.size-1]] = dyn_pros[k] end dyn_pros.delete(k) end else upcase_attrb[k.to_s.upcase] = v end } end ph_attrs = {} dyn_pros.each{|k,v| if k =~ /ph_/i ph_attrs[k] = v else upcase_attrb[k.to_s.upcase] = v end } if upcase_attrb.size > 0 strId = "" strClass = "" strName = "" strTagname = "" strCssSelector = "" strXpathSelector = "" strText = "" = "" = "" index = nil minWidth = -1 maxWidth = -1 minHeight = -1 maxHeight = -1 ano_pros = {} upcase_attrb.each{|key, value| upcase_key = key.to_s.upcase case upcase_key when "XPATH_SELECTOR" strXpathSelector = value when "CSS_SELECTOR" strCssSelector = value when "ID" strId = value when "CLASS" strClass = value when "NAME" strName = value when "TAGNAME" strTagname = value when "TEXT" strText = value when "INDEX" index = value else raise "ERROR: >>> Wrong format type: #{key.to_s} of object: #{string_object}. Available supported format are: XPATH_SELECTOR | CSS_SELECTOR | ID | NAME | CLASS | TEXT | TAGNAME | INDEX" end } continue_run = true; ref_object = nil; if != nil and .length > 0 ref_object = find_object() if (ref_object == nil) continue_run = false end end if continue_run == true begin if strCssSelector != nil and strCssSelector.length > 0 foundElements = get_objects_by_css_selector(strCssSelector) elsif strXpathSelector != nil and strXpathSelector.length > 0 foundElements = get_objects_by_xpath_selector(strXpathSelector) else strGenerateXpathSel = generate_xpath_selector(strId, strClass, strName, strTagname) if strGenerateXpathSel.length > 0 foundElements = get_objects_by_xpath_selector(strGenerateXpathSel) else if (check_string_letters_only(strId)) foundElements = get_objects_by_Id(strId) elsif (check_string_letters_only(strName)) foundElements = get_objects_by_Name(strName) elsif (check_string_letters_only(strClass)) foundElements = get_objects_by_Class(strClass) elsif (check_string_letters_only(strTagname)) foundElements = get_objects_by_Tagname(strTagname) end end end if foundElements == nil or foundElements.length == 0 currentTime = Time.new.to_i else break end sleep(0.5) end while (currentTime - startTime) < $_CFWEB['Wait Time'] if foundElements != nil or foundElements.length != 0 if index != nil and index.to_i >= 0 matched_index = 0; return_element = nil foundElements.each{|cur_element| passCheck = find_object_check_object(cur_element, ref_object, , strId, strClass, strName, strTagname, strText, minWidth, maxWidth, minHeight, maxHeight, ano_pros) if passCheck if matched_index == index.to_i return_element = cur_element break else matched_index = matched_index + 1 end end } return return_element else return_element = nil foundElements.each{|cur_element| passCheck = find_object_check_object(cur_element, ref_object, , strId, strClass, strName, strTagname, strText, minWidth, maxWidth, minHeight, maxHeight, ano_pros) if passCheck return_element = cur_element break end } return return_element end # if index != nil and index.to_i >= 0 end #if foundElements != nil or foundElements.length != 0 end #if continue = true end return nil end |
#find_object_check_Class(element, strClass) ⇒ Object
858 859 860 861 862 863 864 865 866 867 868 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 858 def find_object_check_Class(element, strClass) actual_Class = element[:class] if actual_Class != nil and actual_Class.length > 0 actual_Class = actual_Class.strip if reg_compare(actual_Class, strClass) return true end end return false end |
#find_object_check_Id(element, strId) ⇒ Object
847 848 849 850 851 852 853 854 855 856 857 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 847 def find_object_check_Id(element, strId) actual_Id = element[:id] if actual_Id != nil and actual_Id.length > 0 actual_Id = actual_Id.strip if reg_compare(actual_Id, strId) return true end end return false end |
#find_object_check_maxHeight(element, maxHeight) ⇒ Object
930 931 932 933 934 935 936 937 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 930 def find_object_check_maxHeight(element, maxHeight) height = element[:height] if (height <= maxHeight) return true end return false end |
#find_object_check_maxWidth(element, maxWidth) ⇒ Object
914 915 916 917 918 919 920 921 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 914 def find_object_check_maxWidth(element, maxWidth) width = element[:width] if (width <= maxWidth) return true end return false end |
#find_object_check_minHeight(element, minHeight) ⇒ Object
922 923 924 925 926 927 928 929 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 922 def find_object_check_minHeight(element, minHeight) height = element[:height] if (height <= minHeight) return true end return false end |
#find_object_check_minWidth(element, minWidth) ⇒ Object
906 907 908 909 910 911 912 913 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 906 def find_object_check_minWidth(element, minWidth) width = element[:width] if (width >= minWidth) return true end return false end |
#find_object_check_Name(element, strName) ⇒ Object
869 870 871 872 873 874 875 876 877 878 879 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 869 def find_object_check_Name(element, strName) actual_Name = element[:name] if actual_Name != nil and actual_Name.length > 0 actual_Name = actual_Name.strip if reg_compare(actual_Name, strName) return true end end return false end |
#find_object_check_object(cur_element, ref_object, ref_object_type, strId, strClass, strName, strTagname, strText, minWidth, maxWidth, minHeight, maxHeight, ano_pros) ⇒ Object
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 742 def find_object_check_object(cur_element, ref_object, ref_object_type, strId, strClass, strName, strTagname, strText, minWidth, maxWidth, minHeight, maxHeight, ano_pros) passCheck = true if cur_element != nil # Check ref_object if (ref_object != nil) if find_object_check_ref_object(ref_object, ref_object_type, cur_element) == false passCheck = false end end # Check ID if strId != nil and strId.length > 0 if strId =~ /^#/ strId = strId[1..-1] end if find_object_check_Id(cur_element, strId) == false passCheck = false end end # Check Class if passCheck and strClass != nil and strClass.length > 0 if strClass =~ /^#/ strClass = strClass[1..-1] end if find_object_check_Class(cur_element, strClass) == false passCheck = false end end # Check Name if passCheck and strName != nil and strName.length > 0 if strName =~ /^#/ strName = strName[1..-1] end if find_object_check_Name(cur_element, strName) == false passCheck = false end end # Check Tag name if passCheck and strTagname != nil and strTagname.length > 0 if find_object_check_Tagname(cur_element, strTagname) == false passCheck = false end end # Check Text if passCheck and strText != nil and strText.length > 0 if (strText =~ /^#/) strText = strText[1..-1] end if find_object_check_Text(cur_element, strText) == false passCheck = false end end # Check minWidth if passCheck and minWidth > 0 if !find_object_check_minWidth(cur_element, minWidth) passCheck = false end end # Check maxWidth if passCheck and maxWidth > 0 if !find_object_check_maxWidth(cur_element, maxWidth) passCheck = false end end # Check minHeight if passCheck and minHeight > 0 if !find_object_check_minHeight(cur_element, minHeight) passCheck = false end end # Check maxHeight if passCheck and maxHeight > 0 if !find_object_check_maxHeight(cur_element, maxHeight) passCheck = false end end # Check another properties if passCheck and ano_pros.length > 0 ano_pros.each{|property, value| if value =~ /^#/ value = value[1..-1] end if !find_object_check_property(cur_element, property, value) passCheck = false break end } end return passCheck end return false end |
#find_object_check_ref_object(ref_object, ref_type, target_element) ⇒ Object
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 939 def find_object_check_ref_object(ref_object, ref_type, target_element) begin ref = ref_object.native target = target_element.native if(ref_type == "up" or ref_type == "down") ref_x1 = ref.location.x - 10 ref_x2 = ref.location.x + ref.size.width + 10 target_x1 = target.location.x target_x2 = target_x1 + target.size.width elsif(ref_type == "left" or ref_type == "right") ref_y1 = ref.location.y - 10 ref_y2 = ref.location.y + ref_object.native.size.height + 10 target_y1 = target.location.y target_y2 = target_y1 + target.size.height elsif(ref_type == "child" or ref_type == "parent") ref_W = ref.location.x + ref.size.width ref_H = ref.location.y + ref.size.height target_W = target.location.x + target.size.width target_H = target.location.y + target.size.height end if(ref_type == "up" and target_x1 > ref_x1 and target_x2 < ref_x2 and # has same column or X Position target.location.y < ref.location.y) # at row or Y position, target is upper return true elsif(ref_type == "down" and target_x1 > ref_x1 and target_x2 < ref_x2 and # has same column or X Position target.location.y > ref.location.y) # at row or Y position, target is at down return true elsif(ref_type == "left" and target.location.x < ref.location.x and # at column or X Position, target is at left target_y1 > ref_y1 and target_y2 < ref_y2) # at row or Y position, target is same as ref object return true elsif(ref_type == "right" and target.location.x > ref.location.x and # at column or X Position, target is at right target_y1 > ref_y1 and target_y2 < ref_y2) # at row or Y position, target is same as ref object return true elsif(ref_type == "child" and (target_W < ref_W) and (target_H < ref_H) and (target.location.x > ref.location.x) and (target.location.y > ref.location.y)) return true elsif(ref_type == "parent" and (target_W > ref_W) and (target_H > ref_H) and (target.location.x < ref.location.x) and (target.location.y < ref.location.y)) return true end rescue StandardError => e raise "\n>>> Error: #{e}" end return false; end |
#find_object_check_Tagname(element, strTagname) ⇒ Object
881 882 883 884 885 886 887 888 889 890 891 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 881 def find_object_check_Tagname(element, strTagname) actual_Tagname = element.tag_name() if actual_Tagname != nil and actual_Tagname.length > 0 actual_Tagname = actual_Tagname.strip if reg_compare(actual_Tagname, strTagname) return true end end return false end |
#find_object_check_Text(element, strText) ⇒ Object
895 896 897 898 899 900 901 902 903 904 905 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 895 def find_object_check_Text(element, strText) actual_Text = element.text() if actual_Text != nil and actual_Text.length > 0 actual_Text = actual_Text.strip if reg_compare(actual_Text, strText) return true end end return false end |
#find_object_check_Xpath(element, strXpath) ⇒ Object
892 893 894 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 892 def find_object_check_Xpath(element, strXpath) end |
#generate_xpath_selector(strId, strClass, strName, strTagname) ⇒ Object
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 648 def generate_xpath_selector(strId, strClass, strName, strTagname) strGenerateXpathSel = "" if strId != nil and strId.length > 0 and (strId =~ /^#/) == nil strGenerateXpathSel = "[@id='#{strId}']" end if strClass != nil and strClass.length > 0 and (strClass =~ /^#/) == nil strGenerateXpathSel = "#{strGenerateXpathSel}[@class='#{strClass}']" end if strName != nil and strName.length > 0 and (strName =~ /^#/) == nil strGenerateXpathSel = "#{strGenerateXpathSel}[@name='#{strName}']" end if strGenerateXpathSel.length > 0 if strTagname != nil and strTagname.length > 0 strGenerateXpathSel = "//#{strTagname}#{strGenerateXpathSel}" else strGenerateXpathSel = "//*#{strGenerateXpathSel}" end end return strGenerateXpathSel end |
#get_computed_style(element, style) ⇒ Object
292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 292 def get_computed_style(element, style) foundElement = get_object_value(element) computedStyle = "" if foundElement != nil computedStyle = page.evaluate_script("window.getComputedStyle(document.querySelector('#{foundElement}')).#{style}") else raise "\nError >> Not found object: #{element}" exit end puts "\nActual object style value is: #{computedStyle}" computedStyle end |
#get_element_attribute(element, value) ⇒ Object
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 339 def get_element_attribute(element,value) foundElement = find_object(element) if foundElement != nil begin result = foundElement.value() puts "Attribute of #{element}: #{result}" rescue StandardError => e raise "\n>>> Error: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#get_element_text(element) ⇒ Object
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 323 def get_element_text(element) foundElement = find_object(element) if foundElement != nil begin result = foundElement.text() puts "Text of #{element}: #{result}" rescue StandardError => e raise "\n>>> Error: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#get_object_and_store_as_string(object, string) ⇒ Object
992 993 994 995 996 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 992 def get_object_and_store_as_string(object,string) text = execute_gettext(object) txt = "'" + text + "'" set_var(string, txt) end |
#get_object_and_store_to_file(object, file_name) ⇒ Object
999 1000 1001 1002 1003 1004 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 999 def get_object_and_store_to_file(object,file_name) $text = execute_gettext(object) open($test_data_dir+file_name, 'a+') do |f| f << $text + "\n" end end |
#get_object_value(str_obj) ⇒ Object
309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 309 def get_object_value(str_obj) string_object = str_obj.gsub(/"/, "'") hash_object = $OBJECT[string_object] if hash_object == nil raise ">>> OBJECT: #{str_obj} NAME MAYBE NOT FOUND!!!" exit end if hash_object.keys[0].to_s.upcase != "CSS_SELECTOR" raise ">>> OBJECT: #{str_obj} should be formatted as Css Selector." exit end hash_object[hash_object.keys[0]] end |
#get_objects_by_Class(strClass) ⇒ Object
689 690 691 692 693 694 695 696 697 698 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 689 def get_objects_by_Class(strClass) foundElements = nil begin foundElements = page.all("*[@class='#{strClass}']") rescue StandardError => e raise "\n>>> Error: #{e}" end return foundElements end |
#get_objects_by_css_selector(strCssSelector) ⇒ Object
722 723 724 725 726 727 728 729 730 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 722 def get_objects_by_css_selector(strCssSelector) foundElements = nil begin foundElements = page.all(:css, strCssSelector) rescue StandardError => e raise "\n>>> Error: #{e}" end foundElements end |
#get_objects_by_Id(strId) ⇒ Object
678 679 680 681 682 683 684 685 686 687 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 678 def get_objects_by_Id(strId) foundElements = nil begin foundElements = page.all("*[@id='#{strId}']") rescue StandardError => e raise "\n>>> Error: #{e}" end return foundElements end |
#get_objects_by_Name(strName) ⇒ Object
700 701 702 703 704 705 706 707 708 709 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 700 def get_objects_by_Name(strName) foundElements = nil begin foundElements = page.all("*[@name='#{strName}']") rescue StandardError => e raise "\n>>> Error: #{e}" end return foundElements end |
#get_objects_by_Tagname(strTagname) ⇒ Object
711 712 713 714 715 716 717 718 719 720 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 711 def get_objects_by_Tagname(strTagname) foundElements = nil begin foundElements = page.all("#{strTagname}") rescue StandardError => e raise "\n>>> Error: #{e}" end return foundElements end |
#get_objects_by_xpath_selector(strXpathSelector) ⇒ Object
732 733 734 735 736 737 738 739 740 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 732 def get_objects_by_xpath_selector(strXpathSelector) foundElements = nil begin foundElements = page.all(:xpath, strXpathSelector) rescue StandardError => e raise "\n>>> Error: #{e}" end foundElements end |
#maximize_browser ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 83 def maximize_browser begin page.driver.browser.manage.window.maximize rescue StandardError => e raise "\n>>> Error: #{e}" exit end end |
#movemouseandclick(var, element) ⇒ Object
1045 1046 1047 1048 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 1045 def movemouseandclick var, element Selenium::WebDriver::Support::Select.new(page.driver.browser.find_element(:id, "#{var}")).select_by(:text, "#{element}") page.driver.browser.find_element(:id, "#{var}").click end |
#print_variable(variable) ⇒ Object
159 160 161 |
# File 'lib/Ifd_Automation/auto_util.rb', line 159 def print_variable(variable) puts "VALUE OF #{variable}: #{eval_with_dyn_vars(variable)}" end |
#put_log(str) ⇒ Object
305 306 307 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 305 def put_log str p str if $_CFWEB['Print Log'] == true end |
#refresh ⇒ Object
166 167 168 169 170 171 172 173 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 166 def refresh begin page.execute_script('window.location.reload()') rescue Exception => e raise "\n>>> ERROR: #{e}" exit end end |
#reg_compare(sActual, regValue, isSpecialChar = false) ⇒ Object
Assert 2 values
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 |
# File 'lib/Ifd_Automation/assertion_helper.rb', line 18 def reg_compare sActual, regValue, isSpecialChar=false begin if !isSpecialChar sActual = sActual.strip regValue = regValue.strip.gsub("[", "\\[").gsub("]", "\\]").gsub("(", "\\(").gsub(")", "\\)").gsub(">", "\\>") end rescue StandardError => myStandardError raise "\n>>> Error: #{myStandardError}" end # put_log "\nsActual:#{sActual}, regValue:#{regValue}" if ((sActual.nil? and regValue.nil?) or (!sActual.nil? and sActual.empty? and !regValue.nil? and regValue.empty?)) return true end if ((sActual.nil? and !regValue.nil?) or (!sActual.nil? and regValue.nil?)) return false end if (!sActual.nil? and !sActual.empty?) sCookActual = sActual.gsub(/\n|\r/, " ") if (sCookActual == regValue or (isSpecialChar and sCookActual.include? regValue) or (!isSpecialChar and sCookActual =~ /^.*#{regValue}.*$/)) return true end end return false end |
#remove_element_attribute(element, attr) ⇒ Object
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 233 def remove_element_attribute(element, attr) foundElement = find_object(element) if foundElement != nil begin page.driver.browser.execute_script("arguments[0].removeAttribute('#{attr}');", foundElement.native) sleep(1) rescue StandardError => e raise "\n>>> Error: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#replace_day(str) ⇒ Object
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/Ifd_Automation/auto_util.rb', line 133 def replace_day str t = Time.now() _day = t.day if _day < 10 return str.gsub("{day}", "0#{_day.to_s}") else return str.gsub("{day}", "#{_day.to_s}") end return str end |
#replace_month(str) ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/Ifd_Automation/auto_util.rb', line 122 def replace_month str t = Time.now() _month = t.month if _month < 10 return str.gsub("{month}", "0#{_month.to_s}") else return str.gsub("{month}", "#{_month.to_s}") end return str end |
#replace_pipe(str_pipe) ⇒ Object
144 145 146 147 148 149 150 |
# File 'lib/Ifd_Automation/auto_util.rb', line 144 def replace_pipe str_pipe put_log ">>>> #{str_pipe}" if str_pipe =~ /^.*{pipe}.*$/ return str_pipe.gsub("{pipe}", "|") end return str_pipe end |
#replace_year(str) ⇒ Object
117 118 119 120 |
# File 'lib/Ifd_Automation/auto_util.rb', line 117 def replace_year str t = Time.now() return str.gsub("{year}", t.year.to_s) end |
#resize_window_screen(x, y) ⇒ Object
273 274 275 276 277 278 279 280 281 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 273 def resize_window_screen(x, y) begin page.driver.browser.manage.window.resize_to(x, y) puts page.driver.browser.manage.window.size rescue StandardError => e raise "\n>>> Error: #{e}" exit end end |
#resolve_params(url) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/Ifd_Automation/auto_util.rb', line 29 def resolve_params url condition = url.match(/params='([^']*)'/)[0] if condition params_name = url.match(/params='([^']*)'/)[1] params_value = $PARAMS["#{params_name.downcase}"].to_s.strip if params_value.present? url = url.gsub(condition, params_value) else raise "ERROR: no data found with given params #{params_name}" end end url end |
#scroll_to_end_page ⇒ Object
108 109 110 111 112 113 114 115 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 108 def scroll_to_end_page begin page.driver.execute_script('window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight));') rescue StandardError => e raise "\n>>> Error: #{e}" exit end end |
#scroll_to_top_page ⇒ Object
117 118 119 120 121 122 123 124 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 117 def scroll_to_top_page begin page.driver.execute_script('window.scrollTo(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight),0);') rescue StandardError => e raise "\n>>> Error: #{e}" exit end end |
#set_var(var_name, var_value) ⇒ Object
set value to a variable
7 8 9 10 11 12 13 14 |
# File 'lib/Ifd_Automation/auto_util.rb', line 7 def set_var(var_name, var_value) if $dyn_vars == nil $dyn_vars = binding end strEval = var_name + "=" + var_value eval strEval, $dyn_vars end |
#store_string_as_variable(string, variable) ⇒ Object
152 153 154 155 156 157 |
# File 'lib/Ifd_Automation/auto_util.rb', line 152 def store_string_as_variable(string,variable) # $context_value = bind_with_dyn_vars(string) # set_var(variable, '$context_value') require 'erb' ERB.new(string, 0, "", "#{variable}").result(binding) end |
#switch_to_frame(element) ⇒ Object
283 284 285 286 287 288 289 290 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 283 def switch_to_frame(element) begin page.driver.browser.switch_to.frame element rescue Exception => e raise "\n>>> Error: #{e}" exit end end |
#switch_to_window_by_title(window_title) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 92 def switch_to_window_by_title(window_title) $previous_window = page.driver.browser.window_handle @window_found = false page.driver.browser.window_handles.each { |handle| page.driver.browser.switch_to.window handle if page.title == window_title @window_found = true break end } if @window_found == false raise "Window having title \"#{window_title}\" not found" exit end end |
#validate_option_by(option_by) ⇒ Object
480 481 482 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 480 def validate_option_by(option_by) raise "Please select valid option, invalid option - #{option_by}" unless check_valid_option_by? option_by end |
#validate_supported_keys(key) ⇒ Object
488 489 490 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 488 def validate_supported_keys(key) raise "Please select valid keys, invalid key - #{key}" unless check_valid_option_by? key end |
#var_collect(string_var) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/Ifd_Automation/auto_util.rb', line 97 def var_collect string_var if string_var =~ /^.*{year}.*$/ string_var = replace_year(string_var) end if string_var =~ /^.*{month}.*$/ string_var = replace_month(string_var) end if string_var =~ /^.*{day}.*$/ string_var = replace_day(string_var) end if string_var =~ /^.*{store_value}.*$/ string_var = $context_value end return string_var end |
#verify_alert_text(text) ⇒ Object
137 138 139 140 141 142 143 144 145 146 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 137 def verify_alert_text(text) begin alert = page.driver.browser.switch_to.alert.text puts "Actual Page alert text : #{alert}, Expected value : #{text}" expect(alert).to eq text rescue StandardError => e raise "\n>>> Error: #{e}" exit end end |
#verify_element_not_has_text(element, value) ⇒ Object
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 372 def verify_element_not_has_text(element,value) foundElement = find_object(element) if foundElement != nil begin actual_value = foundElement.text() put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'" expect(actual_value).not_to eql value rescue Exception => e raise "\n>>> ERROR: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#verify_element_not_has_value(element, value) ⇒ Object
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 407 def verify_element_not_has_value(element,value) foundElement = find_object(element) if foundElement != nil begin actual_value = foundElement.value() put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'" expect(actual_value).not_to eql value rescue Exception => e raise "\n>>> ERROR: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#verify_element_text(element, value) ⇒ Object
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 355 def verify_element_text(element,value) foundElement = find_object(element) if foundElement != nil begin actual_value = foundElement.text() put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'" expect(actual_value).to eq value rescue Exception => e raise "\n>>> ERROR: #{e} " exit end else raise "\nError >> Not found object: #{element}" exit end end |
#verify_element_value(element, value) ⇒ Object
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 390 def verify_element_value(element,value) foundElement = find_object(element) if foundElement != nil begin actual_value = foundElement.value() put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'" expect(actual_value).to eq value rescue Exception => e raise "\n>>> ERROR: #{e}" exit end else raise "\nError >> Not found object: #{element}" exit end end |
#verify_title(expected_title) ⇒ Object
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/Ifd_Automation/web_steps_helper.rb', line 126 def verify_title(expected_title) begin page_title = page.title puts "Actual Page Title : #{page_title}, Expected Page Title : #{expected_title}" expect(page_title).to eq expected_title rescue StandardError => e raise "\n>>> Error: #{e}" exit end end |