Created
December 29, 2017 07:33
-
-
Save abidvf/d99c97eb46b20b137a22c9d5be79281b to your computer and use it in GitHub Desktop.
step definition file cucumber rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capybara' | |
require 'byebug' | |
require 'faker' | |
extend Pages | |
Before do |scenario| | |
@page = Pages::Pos.new | |
end | |
Given(/^Initiating browser$/) do | |
@page.initiate_browser() | |
end | |
Given(/^Hit Site home$/) do | |
@page.site_url '/' | |
sleep 3 | |
end | |
When(/^Clicked on login link$/) do | |
@page.click_element ".u-login" | |
sleep 2 | |
end | |
Then(/^On login page enter email address$/) do | |
@page.fill_with_id('muhammad.abid@virtual-force.com', "user_email") | |
end | |
Then(/^Enter admin password$/) do | |
@page.fill_with_id('admin@123', "user_password") | |
end | |
Then(/^Click on login button$/) do | |
@page.click_element '#up-btn' | |
sleep 15 | |
end | |
Then(/^Hover on providers link$/) do | |
@page.hover_find_with_class('.providers-hover') | |
sleep 5 | |
end | |
Then(/^Click on add provider link$/) do | |
@page.click_element('#add-provider-link') | |
sleep 5 | |
end | |
Then(/^Add provider name$/) do | |
@page.fill_with_id('UI test provider', "provider_name") | |
sleep 2 | |
end | |
Then(/^Select provider state$/) do | |
@page.dropdown_select('CA','provider_state') | |
sleep 2 | |
end | |
Then(/^Enter short name$/) do | |
@page.fill_with_id('UItest', "provider_short_name") | |
end | |
Then(/^Enter discounted amount percentage$/) do | |
@page.fill_with_id('5', "provider_provider_loan_option_attributes_discounted_amount_percentage") | |
end | |
Then(/^Enter minimum payment per month$/) do | |
@page.fill_with_id('60', "provider_provider_loan_option_attributes_min_payment_per_month") | |
end | |
Then(/^Enter max term$/) do | |
@page.fill_with_id('12', "provider_provider_loan_option_attributes_max_term") | |
end | |
Then(/^Enter threshold limit amount$/) do | |
@page.fill_with_id('2000', "provider_provider_loan_option_attributes_threshold_limit_amount") | |
end | |
Then(/^Minimum procedure amount limit$/) do | |
@page.fill_with_id('500', "provider_provider_loan_option_attributes_min_procedure_amount_limit") | |
end | |
Then(/^Maximum procedure amount limit$/) do | |
@page.fill_with_id('2000', "provider_provider_loan_option_attributes_max_procedure_amount_limit") | |
sleep 5 | |
end | |
Then(/^Click create button$/) do | |
@page.click_element '.provider-create' | |
sleep 10 | |
end | |
Then(/^Hover on profile link$/) do | |
@page.hover_find_with_class('.profile-nav') | |
sleep 5 | |
end | |
Then(/^Click on logout link$/) do | |
@page.click_element('.logout-link') | |
sleep 5 | |
end | |
Given(/^Go to pos landing page$/) do | |
@page.site_url '/UItest' | |
end | |
When(/^Click Get Started button$/) do | |
@page.click_element '.get-start-btn' | |
end | |
When(/^Check radio button with value yes$/) do | |
@page.click_element '#bill_amount_is_bill_amount_true' | |
end | |
Then(/^Enter procedure amount$/) do | |
@page.fill_with_class("1000", "bill-input") | |
end | |
When(/^Click submit button$/) do | |
@page.click_element('.pos-proc-submit') | |
sleep 5 | |
end | |
When(/^Enter first name$/) do | |
@page.fill_with_class(Faker::Name.first_name, "live-fname") | |
end | |
When(/^Enter last name$/) do | |
@page.fill_with_id(Faker::Name.last_name, "live-lname") | |
end | |
When(/^Enter email$/) do | |
@page.fill_with_id(Faker::Internet.email, "live-email") | |
sleep 2 | |
end | |
When(/^Enter date of birth$/) do | |
@page.set_val("#live-dob",'12/12/2000') | |
sleep 2 | |
end | |
When(/^Enter zip code$/) do | |
@page.set_val("#application_zip",'44444') | |
sleep 5 | |
end | |
When(/^Enter address$/) do | |
@page.fill_with_id('10 downing street down town', "live-street-address") | |
end | |
When(/^Enter phone number$/) do | |
@page.set_val("#live-phone-line",'8569651598') | |
end | |
When(/^Enter Social security number$/) do | |
@page.fill_with_id('234234234', "live-ssn-line") | |
page.execute_script("$('#live-ssn-line').trigger('keyup');") | |
sleep 3 | |
end | |
When(/^Enter Password$/) do | |
@page.fill_with_id('12345678', "live-pwd") | |
sleep 2 | |
end | |
When(/^Enter Password Confirmation$/) do | |
@page.fill_with_id('12345678', "live-pwd-conf") | |
end | |
When(/^Check agree button$/) do | |
@page.click_element '#live-agree-check' | |
end | |
Then(/^Click submit and signup$/) do | |
@page.click_element('.live-register') | |
sleep 5 | |
end | |
Then(/^Redirected to plan customization page$/) do | |
@page.get_element('.patient_plans_new') | |
sleep 15 | |
end | |
Then(/^Select month on slider$/) do | |
@page.drag_by('no-of-months',5) | |
sleep 3 | |
end | |
Then(/^Check consent checkbox$/) do | |
@page.click_element "#plan-agreement-check" | |
sleep 3 | |
end | |
Then(/^Click submit customized patient plan$/) do | |
@page.click_element ".sim-submit" | |
end | |
Then(/^Enter credit card number$/) do | |
@page.fill_with_id('4111111111111111',"x_card_num") | |
sleep 2 | |
end | |
Then(/^Enter expiration date$/) do | |
@page.fill_with_id('1222',"x_exp_date") | |
sleep 2 | |
end | |
Then(/^Enter card code$/) do | |
@page.fill_with_id('123',"x_card_code") | |
sleep 2 | |
end | |
Then(/^Click on pay now button$/) do | |
@page.click_element "#btnSubmit" | |
sleep 2 | |
end | |
Then(/^Click on continue to Payment Plan Contract$/) do | |
@page.crediyo_click_link "Continue to Payment Plan Contract" | |
sleep 2 | |
end | |
Then(/^Check agreement checkbox$/) do | |
@page.check_a_box "application_is_agreed" | |
end | |
Then(/^Click on accept button$/) do | |
@page.click_element ".agreement-btn" | |
sleep 2 | |
end | |
Then(/^Redirected to thanks page$/) do | |
@page.get_element ".thanks-text" | |
end | |
Then(/^Click on ok button\.$/) do | |
@page.crediyo_click_link 'OK' | |
sleep 5 | |
end | |
Then(/^Redirected back to POS page$/) do | |
@page.get_element ".welcome_pos" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment