class Dsfu::SentientStoreFront
Constants
- LINKS
Public Class Methods
execute(&block)
click to toggle source
# File lib/dsfu/sentient.rb, line 22 def self.execute(&block) dsf = self.new dsf.login dsf.instance_eval(&block) end
new()
click to toggle source
# File lib/dsfu/sentient.rb, line 18 def initialize Capybara.default_driver = :selenium end
Public Instance Methods
login()
click to toggle source
# File lib/dsfu/sentient.rb, line 28 def login visit login_path fill_in username_input, with: "administrator" fill_in password_input, with: "cTKQ&sial4xe" click_button "Login" end
method_missing(method_name)
click to toggle source
Calls superclass method
# File lib/dsfu/sentient.rb, line 62 def method_missing (method_name) return LINKS[method_name] if LINKS[method_name] super end
new_product(product)
click to toggle source
# File lib/dsfu/sentient.rb, line 36 def new_product(product) visit new_product_path fill_in product_name_field, with: product.name click_button "Next" fill_in display_name_field, with: "#{product.category} #{product.display_name}" find("#ctl00_ctl00_C_M_ctl00_W_ctl01__SKU").native.send_keys "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#{product.display_description}" upload_image(product.image_path) change_settings add_price(product.price) click_button "Next" uncheck "ctl00_ctl00_C_M_ctl00_W_ctl02_Fileupload1_OnlyTransferFiles" attach_file("ctl00$ctl00$C$M$ctl00$W$ctl02$Fileupload1$htmlInputFileUpload", product.image_path) fill_in "ctl00$ctl00$C$M$ctl00$W$ctl02$Fileupload1$TextBoxPageCount", with: "1" click_button "Upload File" sleep(5) click_button "Next" select('TF_Duratrans', :from => 'ctl00$ctl00$C$M$ctl00$W$ctl03$TicketTemplates') click_button "Finish" click_button "Done" sleep(1) end
Private Instance Methods
add_price(price)
click to toggle source
# File lib/dsfu/sentient.rb, line 69 def add_price(price) find(".rtsTxt", text: "Pricing").click fill_in "tbl_0_PriceCatalog_regularprice_1", with: price fill_in "tbl_0_PriceCatalog_setupprice_1", with: "0" page.driver.execute_script "copyTblIPriceCatalog('ctl00_ctl00_C_M_ctl00_W_ctl01_GridViewPricesheets_ctl02_PriceItemFrame_ctl17','ctl00_ctl00_C_M_ctl00_W_ctl01_GridViewPricesheets_ctl02_PriceItemFrame_imageplushid_PriceCatalog','tbl_0_PriceCatalog','','', 'PriceCatalog');" page.driver.execute_script "pasteallIPriceCatalog();" end
change_settings()
click to toggle source
# File lib/dsfu/sentient.rb, line 77 def change_settings find(".rtsTxt", text: "Settings").click choose "ctl00_ctl00_C_M_ctl00_W_ctl01_AllowBuyerConfigurationRadioButton_1" uncheck "ctl00_ctl00_C_M_ctl00_W_ctl01_FinalWdHt_ChkAllowCustom" end
upload_image(image_path)
click to toggle source
# File lib/dsfu/sentient.rb, line 83 def upload_image(image_path) within "#ctl00_ctl00_C_M_ctl00_W_ctl01__BigIconByItself_ProductIconImageAndButtonRow" do click_button "Edit" end choose "ctl00_ctl00_C_M_ctl00_W_ctl01__BigIconByItself_ProductIcon_rdbUploadIcon" check "ctl00_ctl00_C_M_ctl00_W_ctl01__BigIconByItself_ProductIcon_ChkUseSameImageIcon" attach_file("ctl00$ctl00$C$M$ctl00$W$ctl01$_BigIconByItself$ProductIcon$_uploadedFile$ctl01", image_path) click_button "Upload" end