Title / Description
Code require 'rubygems' require 'selenium-webdriver' require 'watir-webdriver' require 'win32ole' require 'watir-webdriver-performance' #require 'test/unit' include Selenium #driver = Selenium::WebDriver.for :ff profile = WebDriver::Firefox::Profile.new profile["network.proxy.type"] = 1 profile["network.proxy.http"] = "ramkesd018-p.ra.rockwell.com" profile["network.proxy.http_port"] = 3128 driver = WebDriver.for(:firefox, :profile => profile) driver.navigate.to "https://drilling.cloudapp.net/" driver.manage.window.move_to(300, 400) driver.manage.window.resize_to(500, 800) driver.manage.window.maximize driver.navigate.to "https://drilling.cloudapp.net/" puts driver.title if driver.title == "RA Cloud Platform - Sign In" puts "1.Test PASSED. Title is :" + driver.title else puts "1.Test FAILED" end if driver.save_screenshot("RA Cloud Platform - Sign In'.png") puts "Screenshot has been saved" else puts "FAIL > Screenshot has not been saved" end # Login to Google element = driver.find_element(:name, 'Google').click element = driver.find_element(:name, 'Email').send_keys "cloudtester12345" element = driver.find_element(:name, 'Passwd').send_keys "tester12345" if element = driver.find_element(:name, 'signIn').click puts "Prihlaseni se zdarilo" else puts "Chyba prihlaseni" end if driver.title == "Canrig Monitoring Portal" puts "2.Test PASSED" puts driver.title else puts "2.Test FAILED" end sleep 9 if driver.save_screenshot("Canrig Monitoring Portal.png") puts "Obrazek ulozen" else puts "Chyba-obrazek nebyl ulozen" end puts driver.current_url #driver.navigate.to "https://drilling.cloudapp.net/Dashboards/Index.html" #element = driver.find_element(:id, 'dijit__TreeNode_4').click # FILE in menu file = driver.find_element(:xpath=> "//*[@id='dijit_PopupMenuBarItem_0']" ).click if file puts "File value in Menu pressed. " else puts "Unable to find File value" end sleep 1 #SERVER in menu Server = driver.find_element(:xpath=> "//*[@id='dijit_PopupMenuBarItem_1']" ).click if Server puts "Server value in Menu pressed" else puts "Unable to find File value" end sleep 1 # FILE in menu file = driver.find_element(:xpath=> "//*[@id='dijit_PopupMenuBarItem_0']" ).click if file puts "File value in Menu pressed. " else puts "Unable to find File value" end sleep 1 # Expand REPORTS Reports = driver.find_element(:xpath, "//div[@id='dijit__TreeNode_1']/div/img").click if Reports puts "REPORTS expanded" else puts "FAILED to expand REPORTS" end sleep 1 driver.find_element(:css, "span.dijitTreeLabel.dijitTreeLabelFocused").click sleep 1 #PUMP PERFORMANCE Pump_Performance = driver.find_element(:xpath, "//*[@id='dijit__TreeNode_4']/div[1]/span[2]/span").click if Pump_Performance puts "Pump_Performance expanded" else puts "FAILED to expand Pump_Performance" end sleep 1 #PARTS AND SERVICE Parts_Service = driver.find_element(:xpath, "//*[@id='dijit__TreeNode_5']/div[1]/span[2]/span").click if Parts_Service puts "Parts & Service expanded" else puts "FAILED to expand Parts & Service" end sleep 1 #PUMP LOCATION Pump_Location = driver.find_element(:xpath, "//*[@id='dijit__TreeNode_6']/div[1]/span[2]/span").click if Pump_Location puts "Pump Location expanded" else puts "FAILED to expand Pump Location" end sleep 1 #Map filter driver.find_element(:xpath, "//div[@id='mapFilterPane']/div/div/img").click sleep 1 driver.find_element(:xpath, "//div[@id='mapFilterPane']/div/div/img").click sleep 1 e = driver.find_element(:id, 'mapTruckSelect') e.send_keys :arrow_down sleep 1 e.send_keys "Layne", :enter sleep 4 #CIRCLE IN THE MAP #element = driver.find_element(:xpath,"//id='OpenLayers.Layer_506']/svg/g") #dragAndDrop(element,+30,+60) driver.find_element(:xpath, "//div[@id='mapPane']/div[1]/div").click sleep 1 driver.find_element(:xpath, "//div[@id='mapPane']/div[1]/div").click sleep 1 #CLOSE TAB driver.find_element(:xpath, "//div[@id='contentTabs_tablist_map']/span[2]").click sleep 2 element = driver.find_element(:id, 'contentTabs_tablist_parts').click sleep 2 #PUMP PERFORMANCE PANEL OPERATION filters = driver.find_element(:xpath, "//div[@id='partsFilterPane']/div[1]").click sleep 2 consumablestoorder = driver.find_element(:xpath, "//div[@id='partsConsumablePane']/div[1]/div").click sleep 2 filters = driver.find_element(:xpath, "//div[@id='partsFilterPane']/div[1]").click sleep 1 e = driver.find_element(:id, 'partsTruckSelect') e.send_keys :arrow_down sleep 1 e.send_keys "RockyRoad47", :enter sleep 3 consumablestoorder = driver.find_element(:xpath, "//div[@id='partsConsumablePane']/div[1]/div").click sleep 3 consumablestoorder = driver.find_element(:xpath, "//div[@id='partsConsumablePane']/div[1]/div").click sleep 2 #driver.find_element(:xpath, "//div[@id='dojox_grid__View_0']/div/div/div/div[1]/table/tbody/tr/td[1]/input").click #move = driver.find_element(:id, 'partsGridHdr3' # Button ORDER #if driver.find_element(:xpath, "//div[@id='dijit_TitlePane_1']/div[1]").click #puts "Clicked on ORDER" #else #puts "FAILED to click on Order" #end #sleep 1 #if driver.find_element(:id, 'dijit_form_Button_0_label').location_once_scrolled_into_view #puts "Scrolled on button Order" #else #puts "Scrolling on button Order FAILED" #end if driver.find_element(:id,'dijit_form_TextBox_0').send_keys "po number 123456" puts "Text box filled" else puts"FAILED : Text box havent found" end sleep 2 driver.find_element(:id,'dijit_form_Textarea_0').send_keys "bla bla 12345" sleep 2 driver.find_element(:id, 'dijit_form_Button_0_label').click sleep 3 if driver.save_screenshot("FORM.png") puts "Obrazek ulozen" else puts "Chyba-obrazek nebyl ulozen" end driver.find_element(:id, 'dijit_form_Button_1_label').click sleep 2 #CLOSE TAB driver.find_element(:xpath, "//div[@id='contentTabs_tablist_parts']/span[2]").click sleep 3 #PUMP PERFORMANCE TAB driver.find_element(:id, "fleetCustomerSelect").clear driver.find_element(:id, "fleetCustomerSelect").send_keys "Factory", :enter sleep 3 driver.find_element(:id, "fleetCustomerSelect").clear driver.find_element(:id, "fleetCustomerSelect").send_keys "Nabors", :enter sleep 3 driver.find_element(:xpath, "//div[@id='contentTabs_tablist_custom_CustomTab_0']/span[2]").click sleep 3 # close REPORTS driver.find_element(:xpath, "//div[@id='dijit__TreeNode_1']/div/img").click sleep 1 # Expand PUMPS driver.find_element(:xpath, "//div[@id='dijit__TreeNode_2']/div/img").click sleep 3 Pump001 = driver.find_element(:xpath, "//div[@id='dijit__TreeNode_8']/div[1]/span[2]/span").click sleep 10 Pump002 = driver.find_element(:xpath, "//div[@id='dijit__TreeNode_9']/div[1]/span[2]/span").click sleep 10 if driver.save_screenshot("FINAL'.png") puts "Screenshot has been saved" else puts "FAIL > Screenshot has not been saved" end sleep 1 if driver.quit puts "END OF TEST" else puts "CANNOT LEAVE TEST" end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code