How to use info method of Verify Package

Best Inspec_ruby code snippet using Verify.info

tc01_cabo_search_pdp_checking.rb

Source:tc01_cabo_search_pdp_checking.rb Github

copy

Full Screen

1require File.expand_path('../../spec_helper', __FILE__)2require 'atg_app_center_cabo_english_page'3=begin4ATG Cabo Content: Search and check app information on Catalog + PDP page5=end6describe "CABO - Search SKU and check info on Catalog/PDP page - Env: #{Data::ENV_CONST} - Locale: #{Data::LOCALE_CONST.upcase}" do7 next unless app_exist?8 titles_list = Connection.my_sql_connection(CaboAppCenterContent::CONST_CABO_QUERY_SEARCH_TITLE)9 titles_count = titles_list.count10 next unless app_available? titles_count11 cabo_atg_app_center_page = CaboAppCenterCatalogATG.new12 tc_num = 013 titles_list.data_seek(0)14 titles_list.each_hash do |title|15 e_product_search = cabo_atg_app_center_page.get_expected_product_info_search_page title16 e_product_pdp = cabo_atg_app_center_page.get_expected_product_info_pdp_page title17 context "#{tc_num += 1}. SKU = '#{e_product_search[:sku]}' - #{e_product_search[:short_name]}" do18 a_product_search = {}19 status_code = ''20 url = ''21 context 'Search and check information on Search page' do22 product_info = nil23 url = CaboAppCenterContent::CONST_CABO_SEARCH_URL % e_product_search[:prod_number]24 before :each do25 skip ConstMessage::PRE_CONDITION_FAIL unless status_code.empty?26 end27 it "Search by Product Number: #{url}" do28 cabo_atg_app_center_page.load(url)29 product_html = cabo_atg_app_center_page.generate_product_html30 product_info = cabo_atg_app_center_page.get_product_info(product_html, e_product_search[:prod_number])31 next unless product_info.empty?32 status_code = LFCommon.get_http_code url33 fail "Could not reach page #{url}, got status #{status_code}"34 end35 it 'Verify Product info displayed successfully' do36 a_product_search = cabo_atg_app_center_page.get_actual_product_info_search_page product_info37 end38 it "Verify Content/Type is '#{e_product_search[:content_type]}'" do39 expect(a_product_search[:content_type]).to eq(e_product_search[:content_type])40 end41 it "Verify Long name is '#{e_product_search[:long_name]}'" do42 expect(a_product_search[:long_name]).to eq(e_product_search[:long_name])43 end44 it "Verify Curriculum is '#{e_product_search[:curriculum]}'" do45 expect(a_product_search[:curriculum]).to eq(e_product_search[:curriculum])46 end47 it "Verify Age is '#{e_product_search[:age]}'" do48 expect(a_product_search[:age]).to eq(e_product_search[:age])49 end50 it "Verify Price is '#{e_product_search[:price]}'" do51 expect(a_product_search[:price]).to eq(e_product_search[:price])52 end53 end54 context 'Product detail page checking' do55 a_product_pdp = {}56 skip_flag = false57 teaches_and_learning = e_product_pdp[:teaches].empty? ? ' does not display' : 'displays correctly'58 before :each do59 skip ConstMessage::PRE_CONDITION_FAIL if a_product_pdp.empty? && skip_flag60 end61 it 'Go to PDP' do62 skip_flag = true63 fail "Could not reach Search page #{url}, got status #{status_code}" unless status_code.empty?64 cabo_atg_app_center_page.go_pdp(e_product_pdp[:prod_number])65 pdp_url = AppCenterContent::CONT_PDP_URL % a_product_search[:href]66 status_code_pdp = LFCommon.get_http_code pdp_url67 fail "Could not reach PDP page #{pdp_url}, got status #{status_code_pdp}" unless status_code_pdp == '200'68 skip_flag = false69 pdp_info = cabo_atg_app_center_page.get_pdp_info70 a_product_pdp = cabo_atg_app_center_page.get_actual_product_info_pdp_page pdp_info71 pending "***Go to PDP #{pdp_url}"72 end73 it "Verify LF Long Name is '#{e_product_pdp[:long_name]}'" do74 expect(a_product_pdp[:long_name_pdp]).to eq(e_product_pdp[:long_name])75 end76 it "Verify Curriculum (top) is '#{e_product_pdp[:curriculum]}'" do77 expect(a_product_pdp[:curriculum_top]).to eq(e_product_pdp[:curriculum])78 end79 it "Verify Age is '#{e_product_pdp[:age]}'" do80 expect(a_product_pdp[:age]).to eq(e_product_pdp[:age])81 end82 it "Verify Trailer exists: '#{e_product_pdp[:has_trailer]}'" do83 expect(a_product_pdp[:has_trailer]).to eq(e_product_pdp[:has_trailer])84 end85 if e_product_pdp[:has_trailer]86 it "Verify Trailer link is: '#{e_product_pdp[:trailer_link]}'" do87 expect(a_product_pdp[:trailer_link]).to include(e_product_pdp[:trailer_link])88 end89 end90 it "Verify Legal top text is '#{e_product_pdp[:legal_top]}'" do91 expect(a_product_pdp[:legal_top]).to eq(e_product_pdp[:legal_top])92 end93 it "Verify Price is '#{e_product_pdp[:price]}'" do94 expect(a_product_pdp[:price]).to eq(e_product_pdp[:price])95 end96 it "Verify 'Add to Cart' button displays" do97 expect(a_product_pdp[:add_to_cart_btn]).to eq(e_product_pdp[:add_to_cart_btn])98 end99 it "Verify 'Add to Wishlist' link displays" do100 expect(a_product_pdp[:add_to_wishlist]).to eq(e_product_pdp[:add_to_wishlist])101 end102 it 'Verify LF Description displays correctly' do103 expect(a_product_pdp[:description]).to eq(e_product_pdp[:description])104 end105 it 'Verify one sentence description displays correctly' do106 if a_product_pdp[:description] == e_product_pdp[:description]107 pending '*** Skipped "Verify one sentence description displays correctly" This PDP displays LF Description already'108 else109 expect(a_product_pdp[:description]).to eq(e_product_pdp[:one_sentence])110 end111 end112 it "Verify Content Type is '#{e_product_pdp[:content_type]}'" do113 expect(a_product_pdp[:content_type]).to eq(e_product_pdp[:content_type])114 end115 it "Verify Notable/Highlights is '#{e_product_pdp[:notable]}'" do116 expect(a_product_pdp[:notable]).to eq(e_product_pdp[:notable])117 end118 it "Verify Curriculum bottom is '#{e_product_pdp[:curriculum]}'" do119 expect(a_product_pdp[:curriculum_bottom]).to eq(e_product_pdp[:curriculum])120 end121 it "Verify Compatible Platforms (Work With) is '#{e_product_pdp[:work_with]}'" do122 expect(a_product_pdp[:work_with]).to match_array(e_product_pdp[:work_with])123 end124 it "Verify Publisher is '#{e_product_pdp[:publisher]}'" do125 expect(a_product_pdp[:publisher]).to eq(e_product_pdp[:publisher])126 end127 it "Verify File Size is '#{e_product_pdp[:size]}'" do128 expect(a_product_pdp[:size]).to eq(e_product_pdp[:size])129 end130 it 'Verify Special message displays correctly' do131 expect(a_product_pdp[:special_message]).to eq(e_product_pdp[:special_message])132 end133 it "Verify 'More info' label displays correctly" do134 expect(a_product_pdp[:more_info_label]).to eq(e_product_pdp[:more_info_label])135 end136 it "Verify 'More info' text displays correctly" do137 expect(a_product_pdp[:more_info_text]).to eq(e_product_pdp[:more_info_text])138 end139 e_product_pdp[:details].each_with_index do |e_detail, index|140 it "Verify Details #{index + 1} Title/Text displays correctly" do141 expect(a_product_pdp[:details][index]).to eq(e_detail)142 end143 end144 it "Verify 'Credits' link exists: '#{e_product_pdp[:has_credit_link]}'" do145 expect(a_product_pdp[:has_credit_link]).to eq(e_product_pdp[:has_credit_link])146 end147 if e_product_pdp[:has_credit_link]148 it "Verify Credit link has content: '#{e_product_pdp[:long_name]}'" do149 if Data::ENV_CONST == 'PREVIEW'150 pending "*** Skipped Verify Credit link has content: '#{e_product_pdp[:long_name]}' on PREVIEW env"151 else...

Full Screen

Full Screen

create_user_account.rb

Source:create_user_account.rb Github

copy

Full Screen

...7 qa_acc = 'ltrc_qa_test@leapfrog.test'8 power_acc = 'ltrc_power_test@leapfrog.test'9 admin_acc = 'ltrc_admin_test@leapfrog.test'10 password = '123456'11 acc_info = nil12 context 'TC01 - Create new QA account - active' do13 before :all do14 User.new.do_create_user(first_name, last_name, qa_acc, password, 1, 3)15 acc_info = User.new.get_user_info(qa_acc)16 end17 it 'Verify that account is added to DB successfully' do18 expect(acc_info[:id]).to_not eq(nil)19 end20 it 'Verify that account is added to DB with correct First-name' do21 expect(acc_info[:first_name]).to eq(first_name)22 end23 it 'Verify that account is added to DB with correct Last-name' do24 expect(acc_info[:last_name]).to eq(last_name)25 end26 it 'Verify that account is added to DB with correct Email' do27 expect(acc_info[:email]).to eq(qa_acc)28 end29 it "Verify that account is added to DB with 'is_active' = true" do30 expect(acc_info[:is_active]).to eq(true)31 end32 it 'Verify user information in UserRoleMap table' do33 expect(acc_info[:role_id]).to eq(3)34 end35 after :all do36 User.find_by(id: acc_info[:id]).destroy37 UserRoleMap.find_by(user_id: acc_info[:id]).destroy38 end39 end40 context 'TC02 - Create new POWER account - active' do41 before :all do42 User.new.do_create_user(first_name, last_name, power_acc, password, 1, 2)43 acc_info = User.new.get_user_info(power_acc)44 end45 it 'Verify that account is added to DB successfully' do46 expect(acc_info[:id]).to_not eq(nil)47 end48 it 'Verify that account is added to DB with correct First-name' do49 expect(acc_info[:first_name]).to eq(first_name)50 end51 it 'Verify that account is added to DB with correct Last-name' do52 expect(acc_info[:last_name]).to eq(last_name)53 end54 it 'Verify that account is added to DB with correct Email' do55 expect(acc_info[:email]).to eq(power_acc)56 end57 it "Verify that account is added to DB with 'is_active' = true" do58 expect(acc_info[:is_active]).to eq(true)59 end60 it 'Verify user information in UserRoleMap table' do61 expect(acc_info[:role_id]).to eq(2)62 end63 after :all do64 User.find_by(id: acc_info[:id]).destroy65 UserRoleMap.find_by(user_id: acc_info[:id]).destroy66 end67 end68 context 'TC03 - Create new ADMIN account - active' do69 before :all do70 User.new.do_create_user(first_name, last_name, admin_acc, password, 1, 1)71 acc_info = User.new.get_user_info(admin_acc)72 end73 it 'Verify that account is added to DB successfully' do74 expect(acc_info[:id]).to_not eq(nil)75 end76 it 'Verify that account is added to DB with correct First-name' do77 expect(acc_info[:first_name]).to eq(first_name)78 end79 it 'Verify that account is added to DB with correct Last-name' do80 expect(acc_info[:last_name]).to eq(last_name)81 end82 it 'Verify that account is added to DB with correct Email' do83 expect(acc_info[:email]).to eq(admin_acc)84 end85 it "Verify that account is added to DB with 'is_active' = true" do86 expect(acc_info[:is_active]).to eq(true)87 end88 it 'Verify user information in UserRoleMap table' do89 expect(acc_info[:role_id]).to eq(1)90 end91 after :all do92 User.find_by(id: acc_info[:id]).destroy93 UserRoleMap.find_by(user_id: acc_info[:id]).destroy94 end95 end96 context 'TC04 - Create new QA account - non-active' do97 before :all do98 User.new.do_create_user(first_name, last_name, qa_acc, password, 0, 3)99 acc_info = User.new.get_user_info(qa_acc)100 end101 it 'Verify that account is added to DB successfully' do102 expect(acc_info[:id]).to_not eq(nil)103 end104 it 'Verify that account is added to DB with correct First-name' do105 expect(acc_info[:first_name]).to eq(first_name)106 end107 it 'Verify that account is added to DB with correct Last-name' do108 expect(acc_info[:last_name]).to eq(last_name)109 end110 it 'Verify that account is added to DB with correct Email' do111 expect(acc_info[:email]).to eq(qa_acc)112 end113 it "Verify that account is added to DB with 'is_active' = false" do114 expect(acc_info[:is_active]).to eq(false)115 end116 it 'Verify user information in UserRoleMap table' do117 expect(acc_info[:role_id]).to eq(3)118 end119 after :all do120 User.find_by(id: acc_info[:id]).destroy121 UserRoleMap.find_by(user_id: acc_info[:id]).destroy122 end123 end124 context 'TC05 - Create new POWER account - non-active' do125 before :all do126 User.new.do_create_user(first_name, last_name, power_acc, password, 0, 2)127 acc_info = User.new.get_user_info(power_acc)128 end129 it 'Verify that account is added to DB successfully' do130 expect(acc_info[:id]).to_not eq(nil)131 end132 it 'Verify that account is added to DB with correct First-name' do133 expect(acc_info[:first_name]).to eq(first_name)134 end135 it 'Verify that account is added to DB with correct Last-name' do136 expect(acc_info[:last_name]).to eq(last_name)137 end138 it 'Verify that account is added to DB with correct Email' do139 expect(acc_info[:email]).to eq(power_acc)140 end141 it "Verify that account is added to DB with 'is_active' = false" do142 expect(acc_info[:is_active]).to eq(false)143 end144 it 'Verify user information in UserRoleMap table' do145 expect(acc_info[:role_id]).to eq(2)146 end147 after :all do148 User.find_by(id: acc_info[:id]).destroy149 UserRoleMap.find_by(user_id: acc_info[:id]).destroy150 end151 end152 context 'TC06 - Create new ADMIN account - non-active' do153 before :all do154 User.new.do_create_user(first_name, last_name, admin_acc, password, 0, 1)155 acc_info = User.new.get_user_info(admin_acc)156 end157 it 'Verify that account is added to DB successfully' do158 expect(acc_info[:id]).to_not eq(nil)159 end160 it 'Verify that account is added to DB with correct First-name' do161 expect(acc_info[:first_name]).to eq(first_name)162 end163 it 'Verify that account is added to DB with correct Last-name' do164 expect(acc_info[:last_name]).to eq(last_name)165 end166 it 'Verify that account is added to DB with correct Email' do167 expect(acc_info[:email]).to eq(admin_acc)168 end169 it "Verify that account is added to DB with 'is_active' = false" do170 expect(acc_info[:is_active]).to eq(false)171 end172 it 'Verify user information in UserRoleMap table' do173 expect(acc_info[:role_id]).to eq(1)174 end175 after :all do176 User.find_by(id: acc_info[:id]).destroy177 UserRoleMap.find_by(user_id: acc_info[:id]).destroy178 end179 end180 end181end...

Full Screen

Full Screen

secure_controller.rb

Source:secure_controller.rb Github

copy

Full Screen

...6 end7 def confirmphone8 end9 def real_name10 verification = current_user.user_info.verification11 if verification.idstatus == "verified"12 @verify = verification13 else14 if params[:id_number] == "370502198503126415"15 verification.realname = params[:real_name]16 verification.personalid = params[:id_number]17 verification.idstatus = "verified"18 verification.securyscore += 119 verification.save!20 else21 flash[:notice] = "验证失败"22 end23 end24 end25 def set_real_name26 verification = current_user.user_info.verification27 if params[:id_number] == "370502198503126415"28 verification.realname = params[:real_name]29 verification.personalid = params[:id_number]30 verification.idstatus = "verified"31 verification.securyscore += 132 verification.save!33 @verify = verification34 render "realname"35 else36 render "auth/fail"37 end38 end39 def check_real_name40 verification = current_user.user_info.verification41 if params[:id_number] == "370502198503126415"42 verification.realname = params[:real_name]43 verification.personalid = params[:id_number]44 verification.idstatus = "verified"45 verification.securyscore += 146 verification.save!47 else48 flash[:notice] = "验证失败"49 end50 redirect_to securecenter_secure_real_name_path51 end52 def confirm53 @phone_confirm = current_user.user_info.verification.phone_confirm_status54 end55 def new_phone56 if params[:verify_code] == current_user.user_info.verification.verify_code57 render "new_phone" and return58 else59 render "auth/fail" and return60 end61 end62 def secure_active63 verify = current_user.user_info.verification64 verify.phone_confirm_status = !verify.phone_confirm_status65 verify.save!66 redirect_to securecenter_secure_confirm_path67 end68 def change_phone69 # if request.post?70 # phonenum = params[:phone_number]71 # secure_num = params[:secure_number]72 # if UserInfo.exists?(:mobile => phonenum)73 # flash[:notice] = "该号码已经被使用#{phonenum}"74 # else75 # uinfo =current_user.user_info76 # verify = uinfo.verification77 # if verify.phone == phonenum and secure_num == verify.verify_code78 # verify.phonetime = Time.now79 # uinfo.payment_password = params[:pay_password]80 # verify.securyscore += 181 # verify.phonestatus = "verified"82 # verify.save!83 # uinfo.save!84 # flash[:notice] = "验证成功"85 # else86 # flash[:notice] = "验证码与手机不符"87 # end88 # end89 # else90 # verify = current_user.user_info.verification91 # if verify.phonestatus == "verified"92 # @verification = verify93 # end94 # end95 verify = current_user.user_info.verification96 if verify.phonestatus == "verified"97 @verification = verify98 end99 end100 def change_email101 end102 def change_secret103 end104 def verify_code105 phonenum = params[:phone]106 verify_code = rand(10 ** 6)107 verify = current_user.user_info.verification108 verify.phone = phonenum109 verify.verify_code = verify_code110 verify.phonetime = Time.now111 verify.save!112 render :json => {:verify => verify_code}113 end114 def checkphone115 phonenum = params[:phone_number]116 secure_num = params[:secure_number]117 if UserInfo.exists?(:mobile => phonenum)118 flash[:notice] = "该号码已经被使用#{phonenum}"119 redirect_to securecenter_secure_change_phone_path and return120 else121 uinfo =current_user.user_info122 verify = uinfo.verification123 if verify.phone == phonenum and secure_num == verify.verify_code124 uinfo.mobile = phonenum125 uinfo.mobile_verify_date = Time.now126 uinfo.payment_password = params[:pay_password]127 uinfo.secury_score += 1128 verify.phonestatus = "verified"129 verify.save!130 uinfo.save!131 flash[:notice] = "验证成功"132 redirect_to securecenter_secure_change_phone_path and return133 else134 flash[:notice] = "验证码与手机不符"135 redirect_to securecenter_secure_change_phone_path and return136 end137 end138 end139 def set_cache_buster140 response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"141 response.headers["Pragma"] = "no-cache"142 response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"143 end144end...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Inspec_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful