Guest User

Hiptest Appium automation example

a guest
Dec 15th, 2015
218
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # encoding: UTF-8
  2.  
  3. module Actionwords
  4.  
  5.   def search_for_topic_article(topic)
  6.     switch_to_native_context
  7.     search =  find_element :class_name, "android.widget.TextView"
  8.     search.click
  9.     search.send_keys topic
  10.     @wait.until { @driver.text(topic).displayed? }
  11.   end
  12.  
  13.   def navigate_to_first_suggestion
  14.     text(1).click
  15.     switch_to_webview_context
  16.     @wait.until {@driver.find_element(:css, '.section_heading')}
  17.   end
  18.  
  19.   def open_the_panel_label_panel(panel_label)
  20.     switch_to_native_context
  21.     toolbar = find_element :id, "main_toolbar"
  22.     burger_menu = toolbar.find_element :class_name, "android.widget.ImageButton"
  23.     burger_menu.click
  24.     @wait.until { find_element(:id, "design_navigation_view") }
  25.  
  26.     nav_items = find_elements :id, "design_menu_item_text"
  27.     nav_items.each do |nav_item|
  28.       if nav_item.text == panel_label
  29.         nav_item.click
  30.         return
  31.       end
  32.     end
  33.   end
  34.  
  35.   def the_history_list_contains_page_title_page_link_at_index_index(page_title, index)
  36.     history_list = find_element :id, "history_entry_list"
  37.     history_list_items = history_list.find_elements :id, "page_list_item_title"
  38.     expect(history_list_items[index.to_i - 1].text).to eq page_title
  39.   end
  40.  
  41.   def app_opened_as_unregistered_user
  42.     switch_to_webview_context
  43.     h2s = find_elements :tag_name, "h2"
  44.     expect(h2s.first.text).to eq "Today's featured article"
  45.   end
  46. end
RAW Paste Data