Best Active_mocker_ruby code snippet using Sort.none
RLI.rb
Source:RLI.rb
1Given(/^I should navigate to salesforce Home page$/) do2 visit get_url3 sleep 154 value = getCredentialInfo5 fill_in('username', :with => value["Username"])6 fill_in('password', :with => value["Password"])7 find(:id,"Login").click8 sleep 209end10Then(/^I should see salesforce home page succesfully$/) do11 $pageTitle = page.title12 puts "current page title = #{$pageTitle}"13 if $pageTitle == "Salesforce - Performance Edition"14 puts "succesfully visited home page"15 else16 writeFailure "Not visited home page successfully"17 end18end19When(/^I click on Opportunity tab from all tabs section$/) do20 find(:xpath,".//*[@id='AllTab_Tab']/a/img").click21 sleep 2022 find(:xpath,".//a[@class='listRelatedObject opportunityBlock title']").click23 sleep 2024end25Then(/^I should see Opportunity page succesfully$/) do26 $pageTitle = page.title27 puts "current page title = #{$pageTitle}"28 if $pageTitle == "Opportunities: Home ~ Salesforce - Performance Edition"29 puts "succesfully visited home page"30 else31 writeFailure "Not visited home page successfully"32 end33end34When(/^I click on continue button to create a new opportunity$/) do35 within(:id,'bottomButtonRow') do36 click_on "Continue"37 end38end39Then(/^I should see following:$/) do |string|40 if page.has_content?(string)41 puts "string is visible"42 else43 writeFailure "Failed to see following string"44 end45end46Then(/^I should see create Opportunity page succesfully$/) do47 $pageTitle = page.title48 puts "current page title = #{$pageTitle}"49 if $pageTitle == "Opportunity Edit: New Opportunity ~ Salesforce - Performance Edition"50 puts "succesfully visited home page"51 else52 writeFailure "Not visited home page successfully"53 end54end55When(/^I enter all mandantory fields to create new random opportunity$/) do56 randomvalue=('0000'..'9999').to_a.sample57 $newopportunity = "smoke-test-opportunity-" + randomvalue58 sleep 559 fill_in('Opportunity Name', with: $newopportunity, match: :prefer_exact)60 fill_in('Account Name', with: "smoke-test-account-123", match: :prefer_exact)61 select('Not Contacted', :from => 'Stage', match: :prefer_exact)62 fill_in('Price Book', with: "Standard Price Book", match: :prefer_exact)63 fill_in('Close Date', with: " 7/21/2017", match: :prefer_exact)64 select('Renewal', :from => 'Opportunity Type', match: :prefer_exact)65 select('EMEA', :from => 'Client Region', match: :prefer_exact)66 select('United States', :from => 'Country', match: :prefer_exact)67 select('NALA', :from => 'SSI Theatre', match: :prefer_exact)68 sleep 1569end70When(/^I click on renewal opportunity under renewable line item detail section$/) do71 click_on $newopportunity72 sleep 2073end74When(/^I fill in "([^"]*)" with "([^"]*)"$/) do |field_name, value|75 fill_in(field_name, with: value, match: :prefer_exact)76end77When(/^I click on "([^"]*)" button under renewable line item section$/) do |button_name|78 click_on button_name79 sleep 1080end81Then(/^I should see "([^"]*)" field with read and write permission for Ops Manager and Ops Rep$/) do |field_name|82 if (ENV['UserRole'] == "OperationManagerSit") || (ENV['UserRole'] == "OperationRepSit") || (ENV['UserRole'] == "OperationManagerProd") || (ENV['UserRole'] == "OperationRepProd")83 if page.has_field?(field_name)84 puts "#{field_name} field is visible with editable permission"85 elsif page.has_content?(field_name)86 writeFailure "#{field_name} field is visible with readable permission"87 else88 writeFailure "#{field_name} field is not visible"89 end90 else91 if page.has_field?(field_name)92 writeFailure "#{field_name} field is visible with editable permission"93 elsif page.has_content?(field_name)94 puts "#{field_name} field is visible with readable permission"95 else96 writeFailure "#{field_name} field is not visible"97 end98 end99end100Then(/^I should see Batch Type picklist values for renewable line item page layout$/) do101 if page.has_field?("Batch Type")102 actualvalues = find_field("Batch Type", match: :prefer_exact).all('option').collect(&:text)103 puts "actual values = #{actualvalues}"104 expectedvalues = ["--None--","Expired","IBOW","Renewal","Warranty","Adds/Recovery IBOC","Adds/Recovery Renewal","Adds/Recovery Warranty","Adds/Recovery IBOW"]105 puts "expectedvalues = #{expectedvalues}"106 if actualvalues.sort == expectedvalues.sort107 puts "expected values are visible in Batch Type picklist"108 else109 Extravalue = (actualvalues.sort-expectedvalues.sort)110 puts "Extra value = #{Extravalue}"111 MissingValue = (expectedvalues.sort - actualvalues.sort)112 puts "Missing Value = #{MissingValue}"113 writeFailure "expected values are not visible in Batch Type picklist"114 end115 else116 writeFailure "Batch Type field not visible"117 end118end119When(/^I enter all mandantory fields to create new renewable line item$/) do120 page.driver.browser.window_handles.first121 main = page.driver.browser.window_handles.first122 find(:xpath,".//*[@id='j_id0:theFrm:pageBlockId:j_id29:j_id31:10:j_id32_lkwgt']/img").click123 sleep 25124 page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)125 lookup = page.driver.browser.window_handles.last126 page.driver.browser.switch_to.frame("searchFrame")127 sleep 20128 if (ENV['UserRole'] == "OperationManagerSit") || (ENV['UserRole'] == "OperationRepSit") || (ENV['UserRole'] == "OperationManagerProd") || (ENV['UserRole'] == "OperationRepProd")129 fill_in("lksrch",:with=> "Ope")130 else131 if (ENV['UserRole'] == "SalesManagerSit") || (ENV['UserRole'] == "SalesRepSit") || (ENV['UserRole'] == "SalesOperationSit") || (ENV['UserRole'] == "SalesManagerProd") || (ENV['UserRole'] == "SalesRepProd") || (ENV['UserRole'] == "SalesOperationProd")132 fill_in("lksrch",:with=> "Sales")133 else134 if (ENV['UserRole'] == "AdminSit") || (ENV['UserRole'] == "AdminProd")135 fill_in("lksrch",:with=> "DSIntegration")136 end137 end138 end139 sleep 5140 find_button('Go!').click141 sleep 20142 page.driver.browser.switch_to.window(lookup)143 page.driver.browser.switch_to.frame("resultsFrame")144 within('.pbBody') do145 sleep 15146 if (ENV['UserRole'] == "OperationManagerSit") || (ENV['UserRole'] == "OperationManagerProd")147 click_on "Operations Manager Leica"148 puts "assigned to Operations Manager 1PF5"149 sleep 2150 else if (ENV['UserRole'] == "OperationRepSit") || (ENV['UserRole'] == "OperationRepProd")151 click_on "Operations Rep Leica"152 puts "assigned to Operations Rep 1PF5"153 sleep 2154 else if (ENV['UserRole'] == "SalesManagerSit") || (ENV['UserRole'] == "SalesManagerProd")155 click_on "Sales Manager leica"156 puts "assigned to Sales Manager 1PF5"157 sleep 2158 else if (ENV['UserRole'] == "SalesRepSit") || (ENV['UserRole'] == "SalesRepProd")159 click_on "Sales rep Leica"160 puts "assigned to Sales Rep 1PF5"161 sleep 2162 else if (ENV['UserRole'] == "AdminSit") || (ENV['UserRole'] == "AdminProd")163 click_on "DSIntegration Admin"164 puts "assigned to DSIntegration Admin"165 sleep 2166 else if (ENV['UserRole'] == "SalesOperationSit") || (ENV['UserRole'] == "SalesOperationProd")167 click_on "Sales Ops leica"168 puts "assigned to Sales Ops 1PF5"169 sleep 2170 end171 end172 end173 end174 end175 end176 end177 page.driver.browser.switch_to.window(main)178 sleep 10179 180 fill_in('New Start Date', with: "7/21/2017", match: :prefer_exact)181 fill_in('Existing End Date', with: "7/21/2017", match: :prefer_exact)182 fill_in('New End Date', with: "7/21/2017", match: :prefer_exact)183 fill_in('Previous Price', with: "10", match: :prefer_exact)184 fill_in('Existing Start Date', with: "7/21/2017", match: :prefer_exact)185 fill_in('Previous Local Currency Amount', with: "20", match: :prefer_exact)186 fill_in('Existing Product', with: "Smoke Test Product", match: :prefer_exact)187 fill_in('Quantity', with: "10", match: :prefer_exact)188 189 # if (ENV['UserRole'] == "OperationManagerSit")190 # fill_in('Owner', with: "Operations Manager Leica", match: :prefer_exact)191 # elsif(ENV['UserRole'] == "OperationRepSit")192 # fill_in('Owner', with: "Operations Rep Leica", match: :prefer_exact)193 # elsif(ENV['UserRole'] == "SalesManagerSit")194 # fill_in('Owner', with: "Sales Manager leica", match: :prefer_exact)195 # elsif(ENV['UserRole'] == "SalesRepSit")196 # fill_in('Owner', with: "Sales rep Leica", match: :prefer_exact)197 # elsif(ENV['UserRole'] == "SalesOperationSit")198 # fill_in('Owner', with: "Sales Ops leica", match: :prefer_exact)199 # else200 # fill_in('Owner', with: "DS Integration Admin", match: :prefer_exact)201 # end202 sleep 10203end204When(/^I click on any existing RLI under Renewable Line Item$/) do205 click_on "a1841000001tgex"206 sleep 25207end208When(/^I click on Save button in create renewable line item page$/) do209 within('.pbHeader') do210 click_on 'Save'211 end212 sleep 20213end214Then(/^I should see SSI sub result reason picklist values when we select HA Already Renewed ARN from Renewal Status$/) do215 select("HA - Already Renewed â ARN", :from => "Renewal Status", match: :prefer_exact)216 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)217 puts "actual values = #{actualvalues}"218 expectedvalues = ["--None--","(None)"]219 puts "expectedvalues = #{expectedvalues}"220 if actualvalues.sort == expectedvalues.sort221 puts "expected values are visible in SSI Sub Result Reason picklist"222 else223 Extravalue = (actualvalues.sort-expectedvalues.sort)224 puts "Extra value = #{Extravalue}"225 MissingValue = (expectedvalues.sort - actualvalues.sort)226 puts "Missing Value = #{MissingValue}"227 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"228 end229 sleep 10230end231Then(/^I should see SSI sub result reason picklist values when we select HA \- Bad Data \- BDT from Renewal Status$/) do232 select("HA - Bad Data - BDT", :from => "Renewal Status", match: :prefer_exact)233 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)234 puts "actual values = #{actualvalues}"235 expectedvalues = ["--None--","(None)"]236 puts "expectedvalues = #{expectedvalues}"237 if actualvalues.sort == expectedvalues.sort238 puts "expected values are visible in SSI Sub Result Reason picklist"239 else240 Extravalue = (actualvalues.sort-expectedvalues.sort)241 puts "Extra value = #{Extravalue}"242 MissingValue = (expectedvalues.sort - actualvalues.sort)243 puts "Missing Value = #{MissingValue}"244 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"245 end246sleep 10247end248Then(/^I should see SSI sub result reason picklist values when we select HA \- Duplicate \- DUP from Renewal Status$/) do249 select("HA - Duplicate - DUP", :from => "Renewal Status", match: :prefer_exact)250 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)251 puts "actual values = #{actualvalues}"252 expectedvalues = ["--None--","(None)","Duplicate entry"]253 puts "expectedvalues = #{expectedvalues}"254 if actualvalues.sort == expectedvalues.sort255 puts "expected values are visible in SSI Sub Result Reason picklist"256 else257 Extravalue = (actualvalues.sort-expectedvalues.sort)258 puts "Extra value = #{Extravalue}"259 MissingValue = (expectedvalues.sort - actualvalues.sort)260 puts "Missing Value = #{MissingValue}"261 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"262 end263 sleep 10264end265Then(/^I should see SSI sub result reason picklist values when we select HA End Of Support EOL from Renewal Status$/) do266 select("HA - End Of Support - EOL", :from => "Renewal Status", match: :prefer_exact)267 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)268 puts "actual values = #{actualvalues}"269 expectedvalues = ["--None--","(None)"]270 puts "expectedvalues = #{expectedvalues}"271 if actualvalues.sort == expectedvalues.sort272 puts "expected values are visible in SSI Sub Result Reason picklist"273 else274 Extravalue = (actualvalues.sort-expectedvalues.sort)275 puts "Extra value = #{Extravalue}"276 MissingValue = (expectedvalues.sort - actualvalues.sort)277 puts "Missing Value = #{MissingValue}"278 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"279 end280 sleep 10281end282Then(/^I should see SSI sub result reason picklist values when we select HA Other OTH from Renewal Status$/) do283 select("HA - Other - OTH", :from => "Renewal Status", match: :prefer_exact)284 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)285 puts "actual values = #{actualvalues}"286 expectedvalues = ["--None--","(None)","Reseller/Dealer"]287 puts "expectedvalues = #{expectedvalues}"288 if actualvalues.sort == expectedvalues.sort289 puts "expected values are visible in SSI Sub Result Reason picklist"290 else291 Extravalue = (actualvalues.sort-expectedvalues.sort)292 puts "Extra value = #{Extravalue}"293 MissingValue = (expectedvalues.sort - actualvalues.sort)294 puts "Missing Value = #{MissingValue}"295 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"296 end297 sleep 10298end299Then(/^I should see SSI sub result reason picklist values when we select HA \- Previously Renewed Contract \- REN from Renewal Status$/) do300 select("HA - Previously Renewed Contract - REN", :from => "Renewal Status", match: :prefer_exact)301 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)302 puts "actual values = #{actualvalues}"303 expectedvalues = ["--None--","(None)"]304 puts "expectedvalues = #{expectedvalues}"305 if actualvalues.sort == expectedvalues.sort306 puts "expected values are visible in SSI Sub Result Reason picklist"307 else308 Extravalue = (actualvalues.sort-expectedvalues.sort)309 puts "Extra value = #{Extravalue}"310 MissingValue = (expectedvalues.sort - actualvalues.sort)311 puts "Missing Value = #{MissingValue}"312 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"313 end314 sleep 10315end316Then(/^I should see SSI sub result reason picklist values when we select HA \- Sales Pull Back \- SPB from Renewal Status$/) do317 select("HA - Sales Pull Back - SPB", :from => "Renewal Status", match: :prefer_exact)318 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)319 puts "actual values = #{actualvalues}"320 expectedvalues = ["--None--","(None)"]321 puts "expectedvalues = #{expectedvalues}"322 if actualvalues.sort == expectedvalues.sort323 puts "expected values are visible in SSI Sub Result Reason picklist"324 else325 Extravalue = (actualvalues.sort-expectedvalues.sort)326 puts "Extra value = #{Extravalue}"327 MissingValue = (expectedvalues.sort - actualvalues.sort)328 puts "Missing Value = #{MissingValue}"329 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"330 end331 sleep 10332end333Then(/^I should see SSI sub result reason picklist values when we select HA \- Theater Swap \- THS from Renewal Status$/) do334 select("HA - Theater Swap - THS", :from => "Renewal Status", match: :prefer_exact)335 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)336 puts "actual values = #{actualvalues}"337 expectedvalues = ["--None--","(None)"]338 puts "expectedvalues = #{expectedvalues}"339 if actualvalues.sort == expectedvalues.sort340 puts "expected values are visible in SSI Sub Result Reason picklist"341 else342 Extravalue = (actualvalues.sort-expectedvalues.sort)343 puts "Extra value = #{Extravalue}"344 MissingValue = (expectedvalues.sort - actualvalues.sort)345 puts "Missing Value = #{MissingValue}"346 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"347 end348 sleep 10349end350Then(/^I should see SSI sub result reason picklist values when we select HA \- Upgrade \- EUG from Renewal Status$/) do351 select("HA - Upgrade - EUG", :from => "Renewal Status", match: :prefer_exact)352 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)353 puts "actual values = #{actualvalues}"354 expectedvalues = ["--None--","(None)"]355 puts "expectedvalues = #{expectedvalues}"356 if actualvalues.sort == expectedvalues.sort357 puts "expected values are visible in SSI Sub Result Reason picklist"358 else359 Extravalue = (actualvalues.sort-expectedvalues.sort)360 puts "Extra value = #{Extravalue}"361 MissingValue = (expectedvalues.sort - actualvalues.sort)362 puts "Missing Value = #{MissingValue}"363 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"364 end365 sleep 10366end367Then(/^I should see SSI sub result reason picklist values when we select NS \- Bid \- NBD from Renewal Status$/) do368 select("NS - Bid - NBD", :from => "Renewal Status", match: :prefer_exact)369 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)370 puts "actual values = #{actualvalues}"371 expectedvalues = ["--None--","(None)"]372 puts "expectedvalues = #{expectedvalues}"373 if actualvalues.sort == expectedvalues.sort374 puts "expected values are visible in SSI Sub Result Reason picklist"375 else376 Extravalue = (actualvalues.sort-expectedvalues.sort)377 puts "Extra value = #{Extravalue}"378 MissingValue = (expectedvalues.sort - actualvalues.sort)379 puts "Missing Value = #{MissingValue}"380 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"381 end382 sleep 10383end384Then(/^I should see SSI sub result reason picklist values when we select NS \- Can not Reach Contact \- CNC from Renewal Status$/) do385 select("NS - Can not Reach Contact - CNC", :from => "Renewal Status", match: :prefer_exact)386 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)387 puts "actual values = #{actualvalues}"388 expectedvalues = ["--None--","(None)","No answer to phone / email","Unable to obtain customer details to engage"]389 puts "expectedvalues = #{expectedvalues}"390 if actualvalues.sort == expectedvalues.sort391 puts "expected values are visible in SSI Sub Result Reason picklist"392 else393 Extravalue = (actualvalues.sort-expectedvalues.sort)394 puts "Extra value = #{Extravalue}"395 MissingValue = (expectedvalues.sort - actualvalues.sort)396 puts "Missing Value = #{MissingValue}"397 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"398 end399 sleep 10400end401Then(/^I should see SSI sub result reason picklist values when we select NS \- Client Product Replacement \- PTR from Renewal Status$/) do402 select("NS - Client Product Replacement - PTR", :from => "Renewal Status", match: :prefer_exact)403 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)404 puts "actual values = #{actualvalues}"405 expectedvalues = ["--None--","(None)","Contract led decision â Managed Services","Price led decision","Product Replaced with existing Manufacturer Product"]406 puts "expectedvalues = #{expectedvalues}"407 if actualvalues.sort == expectedvalues.sort408 puts "expected values are visible in SSI Sub Result Reason picklist"409 else410 Extravalue = (actualvalues.sort-expectedvalues.sort)411 puts "Extra value = #{Extravalue}"412 MissingValue = (expectedvalues.sort - actualvalues.sort)413 puts "Missing Value = #{MissingValue}"414 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"415 end416 sleep 5417end418Then(/^I should see SSI sub result reason picklist values when we select NS \- Competitive DVAR \- SCV from Renewal Status$/) do419 select("NS - Competitive DVAR - SCV", :from => "Renewal Status", match: :prefer_exact)420 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)421 puts "actual values = #{actualvalues}"422 expectedvalues = ["--None--","(None)"]423 puts "expectedvalues = #{expectedvalues}"424 if actualvalues.sort == expectedvalues.sort425 puts "expected values are visible in SSI Sub Result Reason picklist"426 else427 Extravalue = (actualvalues.sort-expectedvalues.sort)428 puts "Extra value = #{Extravalue}"429 MissingValue = (expectedvalues.sort - actualvalues.sort)430 puts "Missing Value = #{MissingValue}"431 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"432 end433sleep 5434end435Then(/^I should see SSI sub result reason picklist values when we select NS \- Competitive Service Loss Other \- SCS from Renewal Status$/) do436 select("NS - Competitive Service Loss Other - SCS", :from => "Renewal Status", match: :prefer_exact)437 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)438 puts "actual values = #{actualvalues}"439 expectedvalues = ["--None--","(None)","Problems solved by customer â Self Repair"]440 puts "expectedvalues = #{expectedvalues}"441 if actualvalues.sort == expectedvalues.sort442 puts "expected values are visible in SSI Sub Result Reason picklist"443 else444 Extravalue = (actualvalues.sort-expectedvalues.sort)445 puts "Extra value = #{Extravalue}"446 MissingValue = (expectedvalues.sort - actualvalues.sort)447 puts "Missing Value = #{MissingValue}"448 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"449 end450 sleep 5451end452Then(/^I should see SSI sub result reason picklist values when we select NS \- Customer Cost\-Benefit Decision \- SCB from Renewal Status$/) do453 select("NS - Customer Cost-Benefit Decision - SCB", :from => "Renewal Status", match: :prefer_exact)454 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)455 puts "actual values = #{actualvalues}"456 expectedvalues = ["--None--","(None)","Bi-annual Preventive Maintenance","Contract led decision â Managed Services","Does not see Value in Service","On Demand Preference","Price led decision","Service led decision"]457 puts "expectedvalues = #{expectedvalues}"458 if actualvalues.sort == expectedvalues.sort459 puts "expected values are visible in SSI Sub Result Reason picklist"460 else461 Extravalue = (actualvalues.sort-expectedvalues.sort)462 puts "Extra value = #{Extravalue}"463 MissingValue = (expectedvalues.sort - actualvalues.sort)464 puts "Missing Value = #{MissingValue}"465 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"466 end467 sleep 5468end469Then(/^I should see SSI sub result reason picklist values when we select NS \- Customer No Longer Exists \- RNE from Renewal Status$/) do470 select("NS - Customer No Longer Exists - RNE", :from => "Renewal Status", match: :prefer_exact)471 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)472 puts "actual values = #{actualvalues}"473 expectedvalues = ["--None--","(None)","Company has been Acquired and budget lies with new company","Company has gone out of business","Premises have been destroyed"]474 puts "expectedvalues = #{expectedvalues}"475 if actualvalues.sort == expectedvalues.sort476 puts "expected values are visible in SSI Sub Result Reason picklist"477 else478 Extravalue = (actualvalues.sort-expectedvalues.sort)479 puts "Extra value = #{Extravalue}"480 MissingValue = (expectedvalues.sort - actualvalues.sort)481 puts "Missing Value = #{MissingValue}"482 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"483 end484 sleep 5485end486Then(/^I should see SSI sub result reason picklist values when we select NS \- Customer Satisfaction Driven \- SSD from Renewal Status$/) do487 select("NS - Customer Satisfaction Driven - SSD", :from => "Renewal Status", match: :prefer_exact)488 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)489 puts "actual values = #{actualvalues}"490 expectedvalues = ["--None--","(None)"]491 puts "expectedvalues = #{expectedvalues}"492 if actualvalues.sort == expectedvalues.sort493 puts "expected values are visible in SSI Sub Result Reason picklist"494 else495 Extravalue = (actualvalues.sort-expectedvalues.sort)496 puts "Extra value = #{Extravalue}"497 MissingValue = (expectedvalues.sort - actualvalues.sort)498 puts "Missing Value = #{MissingValue}"499 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"500 end501 sleep 5502end503Then(/^I should see SSI sub result reason picklist values when we select NS \- End of Service Life \- PEL from Renewal Status$/) do504 select("NS - End of Service Life - PEL", :from => "Renewal Status", match: :prefer_exact)505 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)506 puts "actual values = #{actualvalues}"507 expectedvalues = ["--None--","(None)"]508 puts "expectedvalues = #{expectedvalues}"509 if actualvalues.sort == expectedvalues.sort510 puts "expected values are visible in SSI Sub Result Reason picklist"511 else512 Extravalue = (actualvalues.sort-expectedvalues.sort)513 puts "Extra value = #{Extravalue}"514 MissingValue = (expectedvalues.sort - actualvalues.sort)515 puts "Missing Value = #{MissingValue}"516 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"517 end518 sleep 5519end520Then(/^I should see SSI sub result reason picklist values when we select NS \- Not in Budget \- NIB from Renewal Status$/) do521 select("NS - Not in Budget - NIB", :from => "Renewal Status", match: :prefer_exact)522 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)523 puts "actual values = #{actualvalues}"524 expectedvalues = ["--None--","(None)","No Budget available for Service"]525 puts "expectedvalues = #{expectedvalues}"526 if actualvalues.sort == expectedvalues.sort527 puts "expected values are visible in SSI Sub Result Reason picklist"528 else529 Extravalue = (actualvalues.sort-expectedvalues.sort)530 puts "Extra value = #{Extravalue}"531 MissingValue = (expectedvalues.sort - actualvalues.sort)532 puts "Missing Value = #{MissingValue}"533 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"534 end535 sleep 5536end537Then(/^I should see SSI sub result reason picklist values when we select NS \- Other Data Management \- RDM from Renewal Status$/) do538 select("NS - Other Data Management - RDM", :from => "Renewal Status", match: :prefer_exact)539 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)540 puts "actual values = #{actualvalues}"541 expectedvalues = ["--None--","(None)"]542 puts "expectedvalues = #{expectedvalues}"543 if actualvalues.sort == expectedvalues.sort544 puts "expected values are visible in SSI Sub Result Reason picklist"545 else546 Extravalue = (actualvalues.sort-expectedvalues.sort)547 puts "Extra value = #{Extravalue}"548 MissingValue = (expectedvalues.sort - actualvalues.sort)549 puts "Missing Value = #{MissingValue}"550 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"551 end552 sleep 5553end554Then(/^I should see SSI sub result reason picklist values when we select NS \- Outside Vendor Supporting \- OVS from Renewal Status$/) do555 select("NS - Outside Vendor Supporting - OVS", :from => "Renewal Status", match: :prefer_exact)556 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)557 puts "actual values = #{actualvalues}"558 expectedvalues = ["--None--","(None)"]559 puts "expectedvalues = #{expectedvalues}"560 if actualvalues.sort == expectedvalues.sort561 puts "expected values are visible in SSI Sub Result Reason picklist"562 else563 Extravalue = (actualvalues.sort-expectedvalues.sort)564 puts "Extra value = #{Extravalue}"565 MissingValue = (expectedvalues.sort - actualvalues.sort)566 puts "Missing Value = #{MissingValue}"567 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"568 end569 sleep 5570end571Then(/^I should see SSI sub result reason picklist values when we select NS \- Prefers Time & Materials \- T&M from Renewal Status$/) do572 select("NS - Prefers Time & Materials - T&M", :from => "Renewal Status", match: :prefer_exact)573 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)574 puts "actual values = #{actualvalues}"575 expectedvalues = ["--None--","(None)"]576 puts "expectedvalues = #{expectedvalues}"577 if actualvalues.sort == expectedvalues.sort578 puts "expected values are visible in SSI Sub Result Reason picklist"579 else580 Extravalue = (actualvalues.sort-expectedvalues.sort)581 puts "Extra value = #{Extravalue}"582 MissingValue = (expectedvalues.sort - actualvalues.sort)583 puts "Missing Value = #{MissingValue}"584 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"585 end586 sleep 5587end588Then(/^I should see SSI sub result reason picklist values when we select NS \- Unsatisfied with Service \- UWS from Renewal Status$/) do589 select("NS - Unsatisfied with Service - UWS", :from => "Renewal Status", match: :prefer_exact)590 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)591 puts "actual values = #{actualvalues}"592 expectedvalues = ["--None--","(None)","Dissatisfied with Product","Dissatisfied with Service","On Demand Preference"]593 puts "expectedvalues = #{expectedvalues}"594 if actualvalues.sort == expectedvalues.sort595 puts "expected values are visible in SSI Sub Result Reason picklist"596 else597 Extravalue = (actualvalues.sort-expectedvalues.sort)598 puts "Extra value = #{Extravalue}"599 MissingValue = (expectedvalues.sort - actualvalues.sort)600 puts "Missing Value = #{MissingValue}"601 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"602 end603 sleep 5604end605Then(/^I should see SSI sub result reason picklist values when we select NS \- Unresponsive VAR \- RUV from Renewal Status$/) do606 select("NS - Unresponsive VAR - RUV", :from => "Renewal Status", match: :prefer_exact)607 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)608 puts "actual values = #{actualvalues}"609 expectedvalues = ["--None--","(None)"]610 puts "expectedvalues = #{expectedvalues}"611 if actualvalues.sort == expectedvalues.sort612 puts "expected values are visible in SSI Sub Result Reason picklist"613 else614 Extravalue = (actualvalues.sort-expectedvalues.sort)615 puts "Extra value = #{Extravalue}"616 MissingValue = (expectedvalues.sort - actualvalues.sort)617 puts "Missing Value = #{MissingValue}"618 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"619 end620 sleep 5621end622Then(/^I should see SSI sub result reason picklist values when we select NS \- Unresponsive End User \- REU from Renewal Status$/) do623 select("NS - Unresponsive End User - REU", :from => "Renewal Status", match: :prefer_exact)624 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)625 puts "actual values = #{actualvalues}"626 expectedvalues = ["--None--","(None)","Contact responsive but not on updates relating to this asset","No answer to phone / email","Unable to reach contact"]627 puts "expectedvalues = #{expectedvalues}"628 if actualvalues.sort == expectedvalues.sort629 puts "expected values are visible in SSI Sub Result Reason picklist"630 else631 Extravalue = (actualvalues.sort-expectedvalues.sort)632 puts "Extra value = #{Extravalue}"633 MissingValue = (expectedvalues.sort - actualvalues.sort)634 puts "Missing Value = #{MissingValue}"635 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"636 end637 sleep 5638end639Then(/^I should see SSI sub result reason picklist values when we select NS \- Third Party Maintenance \- SPM from Renewal Status$/) do640 select("NS - Third Party Maintenance - SPM", :from => "Renewal Status", match: :prefer_exact)641 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)642 puts "actual values = #{actualvalues}"643 expectedvalues = ["--None--","(None)","Contract led decision â Managed Services","Price led decision","Service led decision"]644 puts "expectedvalues = #{expectedvalues}"645 if actualvalues.sort == expectedvalues.sort646 puts "expected values are visible in SSI Sub Result Reason picklist"647 else648 Extravalue = (actualvalues.sort-expectedvalues.sort)649 puts "Extra value = #{Extravalue}"650 MissingValue = (expectedvalues.sort - actualvalues.sort)651 puts "Missing Value = #{MissingValue}"652 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"653 end654 sleep 5655end656Then(/^I should see SSI sub result reason picklist values when we select NS \- Switched to Competitor \- STC from Renewal Status$/) do657 select("NS - Switched to Competitor - STC", :from => "Renewal Status", match: :prefer_exact)658 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)659 puts "actual values = #{actualvalues}"660 expectedvalues = ["--None--","(None)","Contract led decision â Managed Services","Price led decision","Product Replaced with Competitors Product","Service led decision"]661 puts "expectedvalues = #{expectedvalues}"662 if actualvalues.sort == expectedvalues.sort663 puts "expected values are visible in SSI Sub Result Reason picklist"664 else665 Extravalue = (actualvalues.sort-expectedvalues.sort)666 puts "Extra value = #{Extravalue}"667 MissingValue = (expectedvalues.sort - actualvalues.sort)668 puts "Missing Value = #{MissingValue}"669 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"670 end671 sleep 5672end673Then(/^I should see SSI sub result reason picklist values when we select NS \- Product Decommissioned \- PPD from Renewal Status$/) do674 select("NS - Product Decommissioned - PPD", :from => "Renewal Status", match: :prefer_exact)675 actualvalues = find_field("SSI Sub Result Reason", match: :prefer_exact).all('option').collect(&:text)676 puts "actual values = #{actualvalues}"677 expectedvalues = ["--None--","(None)","Product Decommissioned","Product Replaced with Competitors Product","Product Replaced with existing Manufacturer Product"]678 puts "expectedvalues = #{expectedvalues}"679 if actualvalues.sort == expectedvalues.sort680 puts "expected values are visible in SSI Sub Result Reason picklist"681 else682 Extravalue = (actualvalues.sort-expectedvalues.sort)683 puts "Extra value = #{Extravalue}"684 MissingValue = (expectedvalues.sort - actualvalues.sort)685 puts "Missing Value = #{MissingValue}"686 writeFailure "expected values are not visible in SSI Sub Result Reason picklist"687 end688 sleep 5689end...
request_validation_service_spec.rb
Source:request_validation_service_spec.rb
...69 profile_id = nil70 client_id = ''71 rva_id = 'rva-789'72 sort_key = Time.now.to_i.to_s73 key_template = "#{collection}#{delim}#{LOG_KEY_IDS[:pid]}(none)#{delim}#{LOG_KEY_IDS[:cid]}(none)#{delim}#{LOG_KEY_IDS[:rid]}(#{rva_id})#{delim}#{LOG_KEY_IDS[:sort]}(#{sort_key})#{delim}"74 key = @@request_verification_service.create_log_key(collection, profile_id, client_id, rva_id, sort_key)75 puts key76 expect(key).to eq(key_template)77 end78 it 'should get substring value from log key' do79 key = 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1433985859)|'80 key_id = 'rid'81 value = @@request_verification_service.get_value_from_log_key(key, key_id)82 expect(value).to eq('rva-789')83 end84 it 'should get hash values from log key' do85 key = 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1433985859)|'86 expected = {"rid"=>"rva-789", "pid"=>"none", "cid"=>"none", "sort"=>"1433985859"}87 hash = @@request_verification_service.get_hash_from_log_key(key)88 expect(hash).to eq(expected)89 end90 it 'should sort values in asc order' do91 unsorted = [92 'rva|pid(none)|cid(none)|rid(rva-789)|sort(4)|',93 'rva|pid(none)|cid(none)|rid(rva-789)|sort(3)|',94 'rva|pid(none)|cid(none)|rid(rva-789)|sort(5)|',95 'rva|pid(none)|cid(none)|rid(rva-789)|sort(2)|',96 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1)|',97 'rva|pid(none)|cid(none)|rid(rva-789)|sort(6)|'98 ]99 sorted = [100 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1)|',101 'rva|pid(none)|cid(none)|rid(rva-789)|sort(2)|',102 'rva|pid(none)|cid(none)|rid(rva-789)|sort(3)|',103 'rva|pid(none)|cid(none)|rid(rva-789)|sort(4)|',104 'rva|pid(none)|cid(none)|rid(rva-789)|sort(5)|',105 'rva|pid(none)|cid(none)|rid(rva-789)|sort(6)|'106 ]107 values = @@request_verification_service.sort_log_keys(unsorted)108 expect(values).to eq(sorted)109 end110 it 'should sort values in desc order' do111 unsorted = [112 'rva|pid(none)|cid(none)|rid(rva-789)|sort(4)|',113 'rva|pid(none)|cid(none)|rid(rva-789)|sort(3)|',114 'rva|pid(none)|cid(none)|rid(rva-789)|sort(5)|',115 'rva|pid(none)|cid(none)|rid(rva-789)|sort(2)|',116 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1)|',117 'rva|pid(none)|cid(none)|rid(rva-789)|sort(6)|'118 ]119 sorted = [120 'rva|pid(none)|cid(none)|rid(rva-789)|sort(6)|',121 'rva|pid(none)|cid(none)|rid(rva-789)|sort(5)|',122 'rva|pid(none)|cid(none)|rid(rva-789)|sort(4)|',123 'rva|pid(none)|cid(none)|rid(rva-789)|sort(3)|',124 'rva|pid(none)|cid(none)|rid(rva-789)|sort(2)|',125 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1)|'126 ]127 values = @@request_verification_service.sort_log_keys(unsorted, false)128 expect(values).to eq(sorted)129 end130 it 'should get values that are over the limit' do131 org_list = [132 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1)|',133 'rva|pid(none)|cid(none)|rid(rva-789)|sort(2)|',134 'rva|pid(none)|cid(none)|rid(rva-789)|sort(3)|',135 'rva|pid(none)|cid(none)|rid(rva-789)|sort(4)|',136 'rva|pid(none)|cid(none)|rid(rva-789)|sort(5)|',137 'rva|pid(none)|cid(none)|rid(rva-789)|sort(6)|',138 'rva|pid(none)|cid(none)|rid(rva-789)|sort(7)|',139 'rva|pid(none)|cid(none)|rid(rva-789)|sort(8)|',140 'rva|pid(none)|cid(none)|rid(rva-789)|sort(9)|',141 'rva|pid(none)|cid(none)|rid(rva-789)|sort(10)|'142 ]143 trunc_list = [144 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1)|',145 'rva|pid(none)|cid(none)|rid(rva-789)|sort(2)|',146 'rva|pid(none)|cid(none)|rid(rva-789)|sort(3)|',147 'rva|pid(none)|cid(none)|rid(rva-789)|sort(4)|',148 'rva|pid(none)|cid(none)|rid(rva-789)|sort(5)|'149 ]150 values = @@request_verification_service.get_ids_for_logs_outside_limit(org_list)151 expect(values).to eq(trunc_list)152 end153 it 'should return empty array if log count is within limit' do154 org_list = [155 'rva|pid(none)|cid(none)|rid(rva-789)|sort(1)|',156 'rva|pid(none)|cid(none)|rid(rva-789)|sort(2)|',157 'rva|pid(none)|cid(none)|rid(rva-789)|sort(3)|',158 'rva|pid(none)|cid(none)|rid(rva-789)|sort(4)|',159 'rva|pid(none)|cid(none)|rid(rva-789)|sort(5)|'160 ]161 trunc_list = []162 values = @@request_verification_service.get_ids_for_logs_outside_limit(org_list)163 expect(values).to eq(trunc_list)164 end165 end166end...
ex1_files_test.rb
Source:ex1_files_test.rb
...31 end32 def test_not33 all_expr = All.new34 all_files = all_expr.evaluate('dir2').sort35 none_expr = Bigger.new(999999999)36 mp3_expr = FileName.new('*.mp3')37 mp3_files = mp3_expr.evaluate('dir2').sort38 not_mp3_expr = Not.new( mp3_expr )39 not_mp3_files = not_mp3_expr.evaluate('dir2').sort40 41 assert_equal [], Not.new(All.new).evaluate('dir2')42 assert_equal all_files, Not.new(none_expr).evaluate('dir2').sort43 assert_equal not_mp3_files, (all_files - mp3_files).sort44 assert_equal mp3_files, Not.new(Not.new(mp3_expr)).evaluate('dir2').sort45 end46 def test_or47 all_expr = All.new48 all_files = all_expr.evaluate('dir2').sort49 none_expr = Bigger.new(999999999)50 assert_equal all_files, Or.new(all_expr, none_expr).evaluate('dir2').sort51 assert_equal [], Or.new(none_expr, none_expr).evaluate('dir2').sort52 assert_equal all_files, Or.new(all_expr, all_expr).evaluate('dir2').sort53 mp3_or_jpg = Or.new( FileName.new('*.mp3'), FileName.new('*.jpg') )54 expected = ["dir2/big.mp3", "dir2/small.mp3", 55 "dir2/subdir/other.mp3", "dir2/subdir/small.jpg"].sort56 assert_equal expected, mp3_or_jpg.evaluate('dir2').sort57 end58 def test_and59 all_expr = All.new60 all_files = all_expr.evaluate('dir2').sort61 mp3_expr = FileName.new("*.mp3")62 none_expr = Bigger.new(999999999)63 assert_equal all_files, And.new(all_expr, all_expr).evaluate('dir2').sort64 assert_equal [], And.new(all_expr, none_expr).evaluate('dir2').sort65 assert_equal [], And.new( FileName.new('*.mp3'), FileName.new('*.jpg') ).evaluate('dir2').sort66 mp3_files = mp3_expr.evaluate('dir2').sort67 assert_equal mp3_files, And.new( mp3_expr, all_expr).evaluate('dir2').sort68 end69 70end71#expr=And.new(Not.new(Directories.new), Not.new( Files.new ))72# expr=And.new( Bigger.new(5000), FileName.new("*.rtf"))73#puts "jpg..."74#expr_jpg = FileName.new("*.jpg")75#expr_jpg.evaluate("test_dir").each {|f| puts f }76#77#puts "++++++++++++ bigger +++++++++"78#expr_big = Bigger.new(10000)...
none
Using AI Code Generation
1sort.none?(array) {|x| x > 10}2sort.none?(array) {|x| x > 5}3sort.none?(array) {|x| x > 0}4sort.none?(array) {|x| x > 0}5sort.none?(array) {|x| x}6sort.none?(array) {|x| x < 0}
none
Using AI Code Generation
1puts arr.none? { |a| a > 5 }2h = { "a" => 100, "b" => 200, "c" => 300, "d" => 400 }3puts h.none? { |key, value| value < 200 }4r = (1..10)5puts r.none? { |i| i < 1 }6puts s.none? { |c| c == "x" }7puts arr.none? { |a| a > 10 }8puts s.none? { |i| i > 5 }9puts arr.none? { |a| a > 10 }
none
Using AI Code Generation
1array.sort! { |a, b| b <=> a }2array.sort! { |a, b| b <=> a }3array.sort! { |a, b| b <=> a }4array.sort! { |a, b| b <=> a }5array.sort! { |a, b| b <=> a }6array.sort! { |a, b
none
Using AI Code Generation
1Sort.ascending( a )2Sort.descending( a )3Sort.none( a )4 def self.ascending( a )5 def self.descending( a )6 def self.none( a )
none
Using AI Code Generation
1array = Sort.none(array)2array = Sort.none(array) do |a, b|3array = Sort.none(array) do |a, b|4array = Sort.none(array, :desc)5array = Sort.none(array, :desc) do |a, b|6array = Sort.none(array, :desc) do |a
none
Using AI Code Generation
1sort.none?(array) {|x| x > 10}2sort.none?(array) {|x| x > 5}3sort.none?(array) {|x| x > 0}4sort.none?(array) {|x| x > 0}5sort.none?(array) {|x| x}
none
Using AI Code Generation
1array.sort! { |a, b| b <=> a }2array.sort! { |a, b| b <=> a }3array.sort! { |a, b| b <=> a }4array.sort! { |a, b| b <=> a }5array.sort! { |a, b| b <=> a }6array.sort! { |a, b
none
Using AI Code Generation
1Sort.ascending( a )2Sort.descending( a )3Sort.none( a )4 def self.ascending( a )5 def self.descending( a )6 def self.none( a )
none
Using AI Code Generation
1array = Sort.none(array)2array = Sort.none(array) do |a, b|3array = Sort.none(array) do |a, b|4array = Sort.none(array, :desc)5array = Sort.none(array, :desc) do |a, b|6array = Sort.none(array, :desc) do |a
none
Using AI Code Generation
1puts arr.none? { |a| a > 5 }2h = { "a" => 100, "b" => 200, "c" => 300, "d" => 400 }3puts h.none? { |key, value| value < 200 }4r = (1..10)5puts r.none? { |i| i < 1 }6puts s.none? { |c| c == "x" }7puts arr.none? { |a| a > 10 }8puts s.none? { |i| i > 5 }9puts arr.none? { |a| a > 10 }
none
Using AI Code Generation
1array.sort! { |a, b| b <=> a }2array.sort! { |a, b| b <=> a }3array.sort! { |a, b| b <=> a }4array.sort! { |a, b| b <=> a }5array.sort! { |a, b| b <=> a }6array.sort! { |a, b
none
Using AI Code Generation
1Sort.ascending( a )2Sort.descending( a )3Sort.none( a )4 def self.ascending( a )5 def self.descending( a )6 def self.none( a )
none
Using AI Code Generation
1array = Sort.none(array)2array = Sort.none(array) do |a, b|3array = Sort.none(array) do |a, b|4array = Sort.none(array, :desc)5array = Sort.none(array, :desc) do |a, b|6array = Sort.none(array, :desc) do |a
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!