Ifd_Automation 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/project/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source 'http://rubygems.org'
2
2
  gem 'report_builder'
3
3
  gem 'Ifd_Automation'
4
+ gem 'fivemat'
data/project/Gemfile.lock CHANGED
@@ -49,6 +49,7 @@ GEM
49
49
  cucumber
50
50
  diff-lcs (1.3)
51
51
  ffi (1.10.0)
52
+ fivemat (1.3.7)
52
53
  gherkin (5.1.0)
53
54
  gyoku (1.3.1)
54
55
  builder (>= 2.1.2)
@@ -115,7 +116,8 @@ PLATFORMS
115
116
 
116
117
  DEPENDENCIES
117
118
  Ifd_Automation
119
+ fivemat
118
120
  report_builder
119
121
 
120
122
  BUNDLED WITH
121
- 2.0.1
123
+ 2.0.2
data/project/Rakefile CHANGED
@@ -6,23 +6,14 @@ begin
6
6
  testsuite_name = ENV['TESTSUITE']
7
7
  testcase_report_name = ENV['TESTCASE_REPORT_NAME']
8
8
  report_path = "Reports/#{testsuite_name}"
9
- local_opts = [ "--color", "--no-source","CONFIG_NAME=local"]
10
- server_opts = [ "--color", "--no-source","CONFIG_NAME=server"]
11
- junit_opts = ["--format junit", "--out #{report_path}", "--format json --out #{report_path}/#{testcase_report_name}.json"]
12
- namespace :ITMS_DEBUG do
13
- Cucumber::Rake::Task.new(:local, "Debug on local environment") do |t|
14
- t.cucumber_opts = [*local_opts, "ITMS_DEBUG=true"]
9
+ debug_opts = [ "--format usage", "--out"]
10
+ report_opts = ["REPORT=true","--color", "--format junit", "--out #{report_path}", "--format json --out #{report_path}/#{testcase_report_name}.json"]
11
+ namespace :execute do
12
+ Cucumber::Rake::Task.new(:report, "Execute automation test with report output.") do |t|
13
+ t.cucumber_opts = [*report_opts, "--format progress"]
15
14
  end
16
- Cucumber::Rake::Task.new(:server, "Debug on cloud browser") do |t|
17
- t.cucumber_opts = [*server_opts, "ITMS_DEBUG=true"]
18
- end
19
- end
20
- namespace :EXECUTE do
21
- Cucumber::Rake::Task.new(:local, "Execute on local environment") do |t|
22
- t.cucumber_opts = [*local_opts, *junit_opts, "EXECUTE=true"]
23
- end
24
- Cucumber::Rake::Task.new(:server, "Execute on cloud browser") do |t|
25
- t.cucumber_opts = [*server_opts, *junit_opts, "EXECUTE=true"]
15
+ Cucumber::Rake::Task.new(:debug, "Debug automation test without report output.") do |t|
16
+ t.cucumber_opts = [*debug_opts]
26
17
  end
27
18
  end
28
19
  rescue LoadError
@@ -0,0 +1,5 @@
1
+ {
2
+ :capabilities => "test"
3
+ }
4
+
5
+
@@ -1,5 +1,6 @@
1
+ @announce
1
2
  Feature: anhpham test
2
3
 
3
-
4
4
  Scenario: new scenario
5
- * I test
5
+ * I open the page "https://frontend.sportpartner-staging.test.infodation.vn/dk"
6
+ * Register a new user with age "25" and username "TestIFDSportPartner01" and email "TestIFDSportPartner01@yopmail.com" and password "12345678" and country "Danmark"
@@ -1,4 +1,14 @@
1
- And /I open the page "(.*)"/ do |page|
2
- execute_openbrowser(page)
3
- sleep 10
1
+ And /I open the page "(.*)"/ do |url_site|
2
+ execute_openbrowser(url_site)
3
+ end
4
+
5
+
6
+ And /Register a new user with age "(.*)" and username "(.*)" and email "(.*)" and password "(.*)" and country "(.*)"$/ do |age, username, email, password, country|
7
+ execute_click "sp_signup_menuhomepage"
8
+ # sleep 2z
9
+ # execute_click "SP_signupbutton"
10
+ # execute_click "SP_signup_gotosignuppage"
11
+ # execute_click "SP_signup_choose_wanttoplay"
12
+ # execute_click "SP_signup_choose_sex"
13
+ # execute_click "SP_signup_choose_womanorman"
4
14
  end
@@ -1,2 +1,155 @@
1
- test: {tagname: 'a', name: 'banner-button'}
2
- test1: {tagname: 'li', class: 'list-inline-item', index: 5}
1
+ SP_signupbutton: {xpath_selector: '//li[@class="mm-listitem"]//a[@href="#"][contains(text(),"T")]'}
2
+ SP_signupwithemailbutton: {xpath_selector: './/*[@id="sign-up"]//div/a[@class="btn btn-block orangey-red btn-singup btn-singup-email"]'}
3
+ SP_signup_choose_wanttoplay: {xpath_selector: '//div[@class="field-panel"]/label[10]/div[1]/label'}
4
+ sp_signup_menuhomepage: {xpath_selector: '//a[@class="p-0 btn btn-menu"]'}
5
+ SP_signup_choose_womanorman: {xpath_selector: '//div[@class="custom-control custom-radio"]//label[@class="custom-control-label"][contains(text(),"M")]'}
6
+ SP_signup_choose_sex: {xpath_selector: './/*[@id="sign-up-new-account"]//label[1]/div/label'}
7
+ SP_signup_choose_age: {xpath_selector: './/*[@id="select-age"]/option[11]'}
8
+ SP_signup_wherewantoplaysport: {xpath_selector: '//div[@class="select-sport-panel input full-width"]//input[@name="_Address"]'}
9
+ SP_signup_gotosignuppage: {xpath_selector: '//a[@class="btn btn-block orangey-red btn-signup btn-singup-email btn-signup-mail"]'}
10
+
11
+ SP_signup_screenName: {xpath_selector: './/*[@id="ScreenName"]'}
12
+ SP_signup_email: {xpath_selector: './/*[@id="Email"]'}
13
+ SP_signup_pass: {xpath_selector: './/*[@id="Password"]'}
14
+ SP_signup_createacc: {xpath_selector: '//button[@type="submit"]'}
15
+ SP_signup_verifyusercreated: {xpath_selector: './/*[@id="page-sign-up-upload-photo"]/h3'}
16
+ SP_login_button: {xpath_selector: './/*[@id="second-menu"]/li[1]/a'}
17
+ SP_login_mbbutton: {xpath_selector: '//*[@id="second-menu"]//li[1]/a[1]'}
18
+ SP_login_email: {xpath_selector: './/*[@id="Email"]'}
19
+ SP_login_pass: {xpath_selector: './/*[@id="Password"]'}
20
+ SP_login_clicklogin: {xpath_selector: './/*[@id="form-login-email"]/button'}
21
+ SP_login_profiltekst: {xpath_selector: '//textarea[@id="AboutYourself"]'}
22
+ SP_login_clicktosaveprofile: {xpath_selector: '//button[@class="btn black-two btn-save-photo"]'}
23
+ SP_login_skip-introduction: {xpath_selector: '//a[@class="skip-introduction"]'}
24
+ SP_login_menu: {xpath_selector: './/*[@class="container-fluid"]//li/a/span[2]'}
25
+ SP_login_menulogged: {xpath_selector: './/*[@class="mm-page mm-slideout"]//a[@class="p-0 btn btn-menu"]'}
26
+ SP_login_registermyprofile: {xpath_selector: '//button[contains(text(),"R")]'}
27
+ SP_login_successful: {xpath_selector: '//p[@class="font-size-26 m-0 font-family-gilroy font-weight-bold text-white"]'}
28
+ SP_login_successfulmb: {xpath_selector: '//h3[@class="title"]'}
29
+ SP_login_clickupdateimagebutton: {xpath_selector: '//a[@class="d-block text-color-white opacity-50 font-weight-300"]'}
30
+ SP_login_skipstepupdateprofile1: {xpath_selector: '//button[@type="button"]'}
31
+ SP_login_skipstepupdateprofile2: {xpath_selector: '//*[@id="next-matches"]'}
32
+ SP_login_clickcookie: {xpath_selector: './/*[@id="mm-0"]/div[5]/div/div/div/div/div/div[2]/a[1]'}
33
+ SP_login_clickbell: {xpath_selector: ' //span[@class="sport-icons bell"]'}
34
+ SP_login_checknotification: {xpath_selector: '//p[@class="m-0"]'}
35
+ SP_login_closemenu: {xpath_selector: '//a[@class="mm-btn mm-btn_close mm-navbar__btn"]'}
36
+ SP_gettotalnewuser_admin: {xpath_selector: '//body//div[2]//div[2]//div[1]//table[1]//tbody[1]/tr[1]/td[16]/span'}
37
+ SP_typememberaccount_admin: {ph_xpath_selector: '//span[.="<ph_value>"]'}
38
+ SP_typememberaccount_admin2: {xpath_selector: '//table[@class="table table-user-information"]//span[contains(text(),"N")]'}
39
+ SP_typememberaccount_adminP1a: {xpath_selector: '//tr[18]//td[2]//span[1]'}
40
+ SP_deleteuser_signinbutton: {xpath_selector: './/*[@class="btn btn-lg btn-primary btn-block btn-signin"]'}
41
+ SP_deleteuser_loginbutton: {xpath_selector: '//button[@type="submit"]'}
42
+ SP_deleteuser_clickitemuser: {xpath_selector: '//div[@class="sidebar-nav navbar-collapse"]/ul[3]/li/a/i'}
43
+ SP_deleteuser_clickitemlookupmemeber: {xpath_selector: '//a[contains(text(),"Lookup Members")]'}
44
+ SP_deleteuser_searchuser: {xpath_selector: '//td[3]//kendo-grid-string-filter-cell[1]//kendo-grid-filter-wrapper-cell[1]//input[1]'}
45
+ SP_deleteuser_edituser: {css_selector: '//a[contains(text(),"Edit")]'}
46
+ SP_deleteuser_deleteuser: {xpath_selector: '//a[contains(text(),"Delete member")]'}
47
+ SP_deleteuser_confirmdeleteuser: {xpath_selector: '//button[contains(text(),"Ok")]'}
48
+ SP_deleteuser_verifydeleleteuser: {xpath_selector: '//td[@colspan="10"]'}
49
+ SP_deleteuser_searchuser1: {xpath_selector: '//input[@class="k-textbox ng-pristine ng-valid ng-touched"]'}
50
+
51
+ SP_Matches_profilebuttoninmenu: {xpath_selector: '//a[contains(text(),"Pro")]'}
52
+ SP_Matches_matchedbuttoninmenu: {xpath_selector: '//*[@id="main-menu"]/li[1]/a'}
53
+ SP_Matches_verifyperson: {xpath_selector: '//div[@id="landing-matches"]//div[1]//div[1]//div[1]//div[1]//div[1]//div[1]//div[1]//div[1]//section[1]//div[1]//div[4]//a'}
54
+ SP_Matches_minage: {xpath_selector: './/*[@id="age-range-settings"]/div[2]/div/div[5]'}
55
+ SP_Matches_maxage: {xpath_selector: './/*[@id="age-range-settings"]/div[2]/div/div[6]'}
56
+ SP_Matches_point1: {xpath_selector: '//div[@class="slider-handle max-slider-handle round"]'}
57
+ SP_Matches_point2: {xpath_selector: '//div[@class="slider-handle min-slider-handle round"][contains(text(),"18")]'}
58
+
59
+ SP_checkemail_searchemail: {xpath_selector: '//*[@id="f"]//input[2]'}
60
+ SP_checkemail_searchemailbtn: {xpath_selector: '//*[@id="f"]//input[1]'}
61
+ SP_checkemail_titleemail: {xpath_selector: '//span[@class="lmf"]'}
62
+ SP_checkemail_contentemail: {xpath_selector: '//span[@class="lms_m"]'}
63
+ SP_checkemail_deleteallemail: {xpath_selector: '//td[7]//a[1]'}
64
+ SP_checkemail_refreshallemail: {xpath_selector: '//td[10]//a[1]'}
65
+ SP_checkemail_selectallemail: {xpath_selector: '//a[@id="e0"]'}
66
+ SP_checkemail_approvebutton: {xpath_selector: '//button[@class="btn btn-success btn-lg"]'}
67
+ SP_checkemail_approvestatus: {xpath_selector: '//*[@class="panel-body"]//h5'}
68
+ SP_checkemail_approvewithoutsendemailbutton: {xpath_selector: '//*[@class="validate-form ng-untouched ng-pristine ng-invalid"]//div[2]/a'}
69
+ SP_checkemail_checkyopmailwithoutemail: {xpath_selector: '//*[@id="msginbox"]//center'}
70
+ SP_checkemail_useroption_crsadmin: {xpath_selector: '//div[@class="sidebar-nav navbar-collapse"]/ul[2]/li[1]/a[1]'}
71
+ SP_checkemail_searchuseroption_crsadmin: {xpath_selector: '//div[@class="sidebar-nav navbar-collapse"]/ul[2]/li[1]/ul//a[1]'}
72
+ SP_premiumuser_premiummenubutton: {xpath_selector: '//a[@class="menu-upgrade-button btn deep-sky-blue go-to-package"]'}
73
+ SP_premiumuser_movetopaypage: {xpath_selector: '//button[@type="submit"]'}
74
+ SP_premiumuser_visaoption: {xpath_selector: '//*[@id="headingOne"]//label//label'}
75
+ SP_premiumuser_Kortnavn: {xpath_selector: '//input[@id="txtName"]'}
76
+ SP_premiumuser_Kortnummer: {xpath_selector: './/*[@id="encryptedCardNumber"]'}
77
+ SP_premiumuser_Udløbsdatortnavnmm: {xpath_selector: './/*[@id="encryptedExpiryMonth"]'}
78
+ SP_premiumuser_Udløbsdatortnavnyy: {xpath_selector: './/*[@id="encryptedExpiryYear"]'}
79
+ SP_premiumuser_CVC/CW/CID: {xpath_selector: './/*[@id="encryptedSecurityCode"]'}
80
+ SP_premiumuser_btnpay: {xpath_selector: './/*[@id="btnPay"]'}
81
+ SP_premiumuser_resultpay: {xpath_selector: '//div[@id="page-payment-result-confirm"]//p[1]'}
82
+ SP_disapproveuser: {xpath_selector: '//a[contains(text(),"Disapprove and show next member")]'}
83
+ SP_signup_clickcopenhagen: {xpath_selector: '//*[@id="result-search-location"]/div/span[2]/span'}
84
+ SP_signup_clickplacesport: {xpath_selector: '//*[@id="mb-signup-city"]'}
85
+ SP_signup_chooseDKlanguage: {xpath_selector: '//a[contains(text(),"DK")]'}
86
+ SP_searchuserinfrontend: {css_selector: '#txtName'}
87
+ SP_searchuserfakeinput: {xpath_selector: '//input[@id="input-search-mobile"]'}
88
+ SP_buttonsearchuserfakeinput: {xpath_selector: '//div[@id="mb-search-result-row"]/div[1]/span[1]'}
89
+ SP_buttonsendmessage: {xpath_selector: '//button[@id="btn-start-chat"]'}
90
+ SP_contentmessage: {xpath_selector: '//textarea[@id="message"]'}
91
+ SP_totalunread: {xpath_selector: '//*[@id="total-unread"]'}
92
+ SP_verify_messagesent: {xpath_selector: '//div[@class="message"]'}
93
+ SP_sendrequestphoto: {xpath_selector: '//button[@class="btn-block btn outline-white-zero btn-request-photo"]//img'}
94
+ SP_viewsenderequestphoto: {xpath_selector: '//span[@class="sport-icons mail-comming"]'}
95
+ SP_verifysenderequestphoto: {xpath_selector: '//div[@class="inner-content"]'}
96
+ SP_searchauserinfrontend: {xpath_selector: '//div[@class="search-panel search-control"]//input'}
97
+ SP_sendmessagetouserbutton: {xpath_selector: '//button[@id="btnSubmitChat"]'}
98
+ SP_clicktousertoverifysomething: {xpath_selector: '//span[@class="name receiver-name"]'}
99
+ SP_Profile: {xpath_selector: '//a[@class="dropdown-item"][contains(text(),"Profil")]'}
100
+ SP_registeruser_selectcontry: {ph_xpath_selector: '//*[@id="Country"]/option[.="<ph_value>"]'}
101
+ SP_upgradedotpay_nooffer: {xpath_selector: '//div[4]//form[1]//button[1]'}
102
+ SP_upgradedotpay_avataruser: {xpath_selector: '//a[@class="p-0 btn btn-menu"]'}
103
+ SP_upgradedotpay_upgradebutton: {xpath_selector: '//a[@class="menu-upgrade-button btn deep-sky-blue go-to-package"]'}
104
+ SP_upgradedotpay_yesoffer: {xpath_selector: '//div[@class="row"]//div[@class="row"]//button[@class="btn btn-round azure"]'}
105
+ SP_upgradedotpay_selecmethod: {xpath_selector: '//div[@id="heading-dotpay"]//label[@class="payment-method-header collapsed"]'}
106
+ SP_upgradedotpay_submitpaymentmethod: {xpath_selector: '//button[@id="btnPay-dotpay"]'}
107
+ SP_upgradedotpay_firstname: {xpath_selector: '//input[@id="id_dp-firstname"]'}
108
+ SP_upgradedotpay_surname: {xpath_selector: '//input[@id="id_dp-lastname"]'}
109
+ SP_upgradedotpay_checkbox: {xpath_selector: '//input[@id="id_dp-marketing_agreement"]'}
110
+ SP_upgradedotpay_pay: {xpath_selector: '//button[@id="payment-form-submit-dp"]'}
111
+ SP_upgradedotpay_accept: {xpath_selector: '//input[@id="submit_success"]'}
112
+ SP_upgradedotpay_cancel: {xpath_selector: '//input[@id="submit_error"]'}
113
+ SP_upgradedotpay_paymentsuccess: {xpath_selector: '//p[@class="text-center m-0 font-size-40 text-color-white font-family-gilroy font-weight-bold"]'}
114
+ SP_upgradesepa_selecmethod: {xpath_selector: '//div[@id="heading-sepadirectdebit"]//label[@class="payment-method-header collapsed"]'}
115
+ SP_upgradesepa_ownername: {xpath_selector: '//input[@name="sepa.ownerName"]'}
116
+ SP_upgradesepa_ibannumber: {xpath_selector: '//input[@name="sepa.ibanNumber"]'}
117
+ SP_upgradesepa_submitpaymentmethod: {xpath_selector: '//button[@id="btnPay-sepadirectdebit"]'}
118
+ SP_upgradepaypal_disar: {xpath_selector: '//span[@class="slider round"]'}
119
+ SP_upgradepaypal_selectionmethod: {xpath_selector: '//div[@id="heading-paypal"]//label[@class="payment-method-header collapsed"]'}
120
+ SP_upgradepaypal_submitpaymentmethod: {xpath_selector: '//button[@id="btnPay-paypal"]'}
121
+ SP_upgradepaypal_email: {xpath_selector: '//input[@id="email"]'}
122
+ SP_upgradepaypal_password: {xpath_selector: '//input[@id="password"]'}
123
+ SP_upgradepaypal_login: {xpath_selector: '//button[@id="btnLogin"]'}
124
+ #SP_upgradepaypal_continuepayment: {xpath_selector: '//input[@id='confirmButtonTop']'}
125
+ SP_upgradepaypal_finishpayment: {xpath_selector: '//input[@id="confirmButtonTop"]'}
126
+ SP_upgradepaypal_cancel: {xpath_selector: '//a[@id="cancelLink"]'}
127
+ SP_upgradepayment_result: {xpath_selector: '//p[@class="text-center font-size-30 text-color-white font-family-gilroy font-weight-bold"]'}
128
+ SP_downgrade_admin: {xpath_selector: '//button[@class="btn btn-lg btn-primary btn-block btn-signin"]'}
129
+ SP_downgrade_email: {xpath_selector: '//input[@id="Email"]'}
130
+ SP_downgrade_password: {xpath_selector: '//input[@id="Password"]'}
131
+ SP_downgrade_submitlogin: {xpath_selector: '//button[@class="btn btn-block black-two"]'}
132
+ SP_downgrade_useritem: {xpath_selector: '//a[contains(text(),"Users")]'}
133
+ SP_downgrade_lookupuser: {xpath_selector: '//a[contains(text(),"Lookup Members")]'}
134
+ SP_downgrade_searchbox: {xpath_selector: '//input[@class="k-textbox ng-pristine ng-valid ng-touched"]'}
135
+ SP_downgrade_selectuser: {xpath_selector: '//a[contains(text(),"TestIFDSportPartner03")]'}
136
+ SP_downgrade_edituserbutton: {xpath_selector: '//button[@class="btn btn-info"]'}
137
+ SP_downgrade_membertype: {xpath_selector: '//tr[16]//td[2]//select[1]'}
138
+ SP_downgrade_selecmembertype: {ph_xpath_selector: '//*[@id="page-wrapper"]//div[2]//tr[17]/td[2]//select/option[@value="<ph_value>"]'}
139
+ SP_downgrade_save: {xpath_selector: '//button[@class="btn btn-warning"]'}
140
+ SP_payment: {xpath_selector: '//body/div[@id="payment-method"]/div[@class="sport-payment-land"]/div[@class="choose-options-method payment-chooser-wrapper"]/div[@class="content"]/form/ul[@class="list-unstyled"]/li[1]/label[1]'}
141
+ SP_submitpayment: {xpath_selector: '//button[@id="btnSubmitPayment"]'}
142
+ SP_upgradetrustpay_method: {xpath_selector: '//div[@id="heading-trustpay"]//label[@class="payment-method-header collapsed"]'}
143
+ SP_upgradetrustpay_submitmethod: {xpath_selector: '//button[@id="btnPay-trustpay"]'}
144
+ SP_upgradetrustpay_selectbank: {ph_xpath_selector: '//select[@id="trustPayOnlineBankList"]/option[contains(text(),"<ph_value>")]'} #Komerční banka a.s.
145
+ SP_upgradetrustpay_continuepayment: {xpath_selector: '//input[@id="mainSubmit"]'}
146
+ SP_upgradetrustpay_previous: {xpath_selector: '//input[@id="mainBack"]'}
147
+ SP_upgradeentercash_method: {xpath_selector: '//div[@id="heading-entercash"]//label[@class="payment-method-header collapsed"]'}
148
+ SP_upgradeentercash_selectbanks: {xpath_selector: '//div[@id="collapse-entercash"]//select[@class="form-control input-field"]/option[@value="505"]'}
149
+ SP_upgradeentercash_submitmethod: {xpath_selector: '//button[@id="btnPay-entercash"]'}
150
+ SP_upgradeentercash_username: {xpath_selector: '//tr[1]//td[2]//input[1]'}
151
+ SP_upgradeentercash_password: {xpath_selector: '//div[@id="login"]//tr[2]//td[2]//input[1]'}
152
+ SP_upgradeentercash_login: {xpath_selector: '//input[@id="login_button"]'}
153
+ SP_upgradeentercash_confirmpayment: {xpath_selector: '//input[@id="deposit_button"]'}
154
+ SP_upgradeentercash_cancelpayment: {xpath_selector: '//input[@id="cancel_button"]'}
155
+ SP_upgradeentercash_clickhere_sucessful: {xpath_selector: '//a[@id="back_to_merchant"]'}
@@ -1,22 +1,27 @@
1
- $_CFWEB = Hash.new
2
- $current_dir = File.expand_path(File.dirname(__FILE__))
3
- $base_dir = File.expand_path(File.dirname(__FILE__) + '/../..')
4
- $test_data_dir = $base_dir + '/features/TestData/'
5
- $screenshot = $base_dir + '/features/Screenshot/'
6
- $PARAMS = YAML.load_file("#{$test_data_dir}/globalData.yml")
7
- $OBJECT = YAML.load_file("#{$base_dir}/features/step_definitions/repositories/project_object.yml")
8
- CONFIG_NAME = ENV['CONFIG_NAME']
9
- if %w(server local).include? ENV['CONFIG_NAME']
10
- server_env = ENV['CONFIG_NAME']
11
- else
12
- raise "ERROR: CONFIG_NAME should be: server || local"
13
- end
14
- if %w(chrome firefox safari internet_explorer opera edge).include? ENV['BROWSER']
15
- @browser_name = ENV['BROWSER']
16
- else
17
- raise "ERROR: BROWSER should be: chrome || firefox || safari || internet_explorer || opera || edge"
18
- end
19
- BROWSER_CONFIG = YAML.load(File.read(File.join(File.dirname(__FILE__), "../../config/#{CONFIG_NAME}_browser_config.yml")))
1
+ # $_CFWEB = Hash.new
2
+ # $current_dir = File.expand_path(File.dirname(__FILE__))
3
+ # $base_dir = File.expand_path(File.dirname(__FILE__) + '/../..')
4
+ # $PARAMS = YAML.load_file("#{$test_data_dir}/globalData.yml")
5
+
6
+ # CONFIG_NAME = ENV['CONFIG_NAME']
7
+ # if %w(server local).include? ENV['CONFIG_NAME']
8
+ # server_env = ENV['CONFIG_NAME']
9
+ # else
10
+ # puts "❌ Error: CONFIG_NAME should be: server || local"
11
+ # exit(1)
12
+ # end
13
+ # begin
14
+ # puts "checking Object Repository format..."
15
+ # $OBJECT = YAML.load_file("#{$base_dir}/features/step_definitions/repositories/project_object.yml")
16
+ # puts "✅"
17
+ # puts "checking Automation Setting format..."
18
+ # BROWSER_CONFIG = YAML.load_file("#{$base_dir}/config/#{CONFIG_NAME}_browser_config.yml")
19
+ # puts ""
20
+ # rescue Psych::SyntaxError => ex
21
+ # puts "❌ SyntaxError #{ex.message[/: .+/]}"
22
+ # exit(1)
23
+ # end
24
+
20
25
  STDOUT.sync = true
21
26
  require 'rubygems'
22
27
  require 'capybara'
@@ -26,33 +31,33 @@ require 'yaml'
26
31
  require 'selenium-webdriver'
27
32
  require 'Ifd_Automation'
28
33
  require 'report_builder'
29
- require "#{$current_dir}/itms_action.rb"
30
- itms_action = ITMS.new
34
+ # require "#{$current_dir}/itms_action.rb"
35
+ # itms_action = ITMS.new
36
+
37
+ # if ENV['EXECUTE']
38
+ # if ENV['TESTSUITE'] && ENV['TESTCASE_REPORT_NAME']
39
+ # @report_path = "Reports/#{ENV['TESTSUITE']}"
40
+ # @testcase_report_name = ENV['TESTCASE_REPORT_NAME']
41
+ # else
42
+ # puts "❌ ERROR: Missing TESTSUITE || TESTCASE_REPORT_NAME"
43
+ # exit(1)
44
+ # end
45
+ # end
46
+ # $print_log = ENV["PRINT_LOG"] || false
47
+ # $_CFWEB['Maximize Browser'] = ENV["MAXIMIZE_BROWSER"] || true
48
+ # SELENIUM_SERVER_URL = ENV['SERVER_URL'] || BROWSER_CONFIG['server_url']
49
+ # BROWSER_CAPS = BROWSER_CONFIG['browser_caps'][ENV['BROWSER']]
50
+ # if CONFIG_NAME == "local"
51
+ # itms_action.getServerStatus(SELENIUM_SERVER_URL)
52
+ # end
31
53
 
32
- if ENV['EXECUTE']
33
- if ENV['TESTSUITE'] && ENV['TESTCASE_REPORT_NAME']
34
- @report_path = "Reports/#{ENV['TESTSUITE']}"
35
- @testcase_report_name = ENV['TESTCASE_REPORT_NAME']
36
- else
37
- raise "ERROR: Missing TESTSUITE || TESTCASE_REPORT_NAME"
38
- exit
39
- end
40
- end
41
- $_CFWEB['Wait Time'] = ENV["WAIT_TIME"] || 30
42
- $_CFWEB['Print Log'] = ENV["PRINT_LOG"] || false
43
- $_CFWEB['Maximize Browser'] = ENV["MAXIMIZE_BROWSER"] || true
44
- SELENIUM_SERVER_URL = ENV['SERVER_URL'] || BROWSER_CONFIG['server_url']
45
- BROWSER_CAPS = BROWSER_CONFIG['browser_caps'][ENV['BROWSER']]
46
- if CONFIG_NAME == "local"
47
- itms_action.getServerStatus(SELENIUM_SERVER_URL)
48
- end
49
- Capybara.register_driver :selenium do |app|
50
- Capybara::Selenium::Driver.new(app,
51
- :browser => :remote,
52
- :url => SELENIUM_SERVER_URL,
53
- :desired_capabilities => BROWSER_CAPS.reduce { |acc, h| (acc || {}).merge h }
54
- )
55
- end
54
+ # Capybara.register_driver :selenium do |app|
55
+ # Capybara::Selenium::Driver.new(app,
56
+ # :browser => :remote,
57
+ # :url => SELENIUM_SERVER_URL,
58
+ # :desired_capabilities => BROWSER_CAPS.reduce { |acc, h| (acc || {}).merge h }
59
+ # )
60
+ # end
56
61
 
57
- Capybara.default_driver = :selenium
58
- Capybara.run_server = false
62
+ # Capybara.default_driver = :selenium
63
+ # Capybara.run_server = false
@@ -1,34 +1,127 @@
1
1
  Before do
2
- begin
3
- $browser_data = page.driver.browser.capabilities
2
+ if ENV['SERVER_URL'].nil?
3
+ puts "❌ ERROR: Missing param SERVER_URL."
4
+ exit(1)
5
+ end
6
+ $driver = getDriver
7
+ getConfig
8
+ $browser_data = page.driver.browser.capabilities
9
+ $wait_time = ENV["WAIT_TIME"] || 30
10
+ $print_log = ENV["PRINT_LOG"] || false
11
+ if ENV['DELETE_COOKIE']
4
12
  browser = Capybara.current_session.driver.browser
5
13
  browser.manage.delete_all_cookies
6
- rescue StandardError => myStandardError
7
- raise "\n>>> Error: #{myStandardError}"
8
14
  end
9
15
  end
10
16
 
11
- After do |scenario|
12
- save_screenshot = ENV['SCREENSHOT'] || false
13
- if save_screenshot == true
14
- file_name = 'failed_%s.png' % rand(1000).to_s
15
- page.save_screenshot($screenshot+file_name) if scenario.failed?
16
- begin
17
- Capybara.page.driver.quit
18
- Capybara.send(:session_pool).delete_if { |key, value| key =~ /selenium/i }
19
- rescue StandardError => myStandardError
20
- raise "\n>>> Error: #{myStandardError}"
17
+ def getDriver
18
+ case ENV['BROWSER']
19
+ when "chrome"
20
+ Capybara.register_driver :selenium do |app|
21
+ Capybara::Selenium::Driver.new(app, browser: :chrome,:url => ENV['SERVER_URL'])
22
+ end
23
+ Capybara.current_driver = :selenium
24
+ when "firefox"
25
+ Capybara.register_driver :selenium do |app|
26
+ Capybara::Selenium::Driver.new(app, browser: :firefox,:url => ENV['SERVER_URL'])
27
+ end
28
+ Capybara.current_driver = :selenium
29
+ when "safari"
30
+ Capybara.register_driver :selenium do |app|
31
+ Capybara::Selenium::Driver.new(app, browser: :safari,:url => ENV['SERVER_URL'])
32
+ end
33
+ Capybara.current_driver = :selenium
34
+ when "ie"
35
+ Capybara.register_driver :selenium do |app|
36
+ Capybara::Selenium::Driver.new(app, browser: :ie,:url => ENV['SERVER_URL'])
37
+ end
38
+ Capybara.current_driver = :selenium
39
+ when "opera"
40
+ Capybara.register_driver :selenium do |app|
41
+ Capybara::Selenium::Driver.new(app, browser: :opera,:url => ENV['SERVER_URL'])
42
+ end
43
+ Capybara.current_driver = :selenium
44
+ when "chrome_headless"
45
+ Capybara.register_driver :selenium do |app|
46
+ Capybara::Selenium::Driver.new(app, browser: :chrome, :desired_capabilities => $CAPS)
47
+ end
48
+ Capybara.current_driver = :selenium_chrome_headless
49
+ when "firefox_headless"
50
+ Capybara.register_driver :headless_firefox do |app|
51
+ Capybara::Selenium::Driver.new(app, browser: :firefox)
52
+ end
53
+ Capybara.current_driver = :selenium_headless
54
+ when "iphone_headless"
55
+ Capybara.register_driver(:iphone_headless) do |app|
56
+ user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3'
57
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
58
+ chromeOptions: { args: (%w[ headless disable-gpu hide-scrollbars ] << "--user-agent='#{user_agent}'") }
59
+ )
60
+ Capybara::Selenium::Driver.new(app,:url => ENV['SERVER_URL'], browser: :chrome, desired_capabilities: capabilities)
61
+ end
62
+ Capybara.default_driver = :iphone_headless
63
+ when "nexus_headless"
64
+ Capybara.register_driver(:nexus_headless) do |app|
65
+ user_agent = "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"
66
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
67
+ chromeOptions: { args: (%w[ headless disable-gpu hide-scrollbars ] << "--user-agent='#{user_agent}'") }
68
+ )
69
+ # mobile_emulation = {
70
+ # "deviceMetrics" => { "width" => 360, "height" => 640, "pixelRatio" => 3.0 },
71
+ # "userAgent" => "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"
72
+ # }
73
+
74
+ Capybara::Selenium::Driver.new(app,:url => ENV['SERVER_URL'], browser: :chrome, desired_capabilities: capabilities)
21
75
  end
76
+ Capybara.default_driver = :nexus_headless
77
+ else
78
+ puts "❌ ERROR: Unsupported browser: #{ENV['BROWSER']}. Available: chrome || firefox || safari || ie || opera || chrome_headless || firefox_headless || iphone_headless || nexus_headless"
79
+ exit(1)
80
+ end
81
+ end
82
+
83
+ def getConfig
84
+ begin
85
+ $OBJECT = YAML.load_file("features/step_definitions/repositories/project_object.yml")
86
+ rescue Psych::SyntaxError => ex
87
+ puts "❌ Object Repository :: SyntaxError #{ex.message[/: .+/]}"
88
+ exit(1)
22
89
  end
23
90
  end
24
91
 
92
+ def validateReport
93
+ if ENV['TESTSUITE'] && ENV['TESTCASE_REPORT_NAME']
94
+ @report_path = "Reports/#{ENV['TESTSUITE']}"
95
+ @testcase_report_name = ENV['TESTCASE_REPORT_NAME']
96
+ else
97
+ puts "❌ ERROR: Missing param TESTSUITE || TESTCASE_REPORT_NAME"
98
+ exit(1)
99
+ end
100
+ end
101
+
102
+ After do |scenario|
103
+ # save_screenshot = ENV['SCREENSHOT'] || false
104
+ # if save_screenshot == true
105
+ # file_name = 'failed_%s.png' % rand(1000).to_s
106
+ # page.save_screenshot($screenshot+file_name) if scenario.failed?
107
+ # begin
108
+ # Capybara.page.driver.quit
109
+ # Capybara.send(:session_pool).delete_if { |key, value| key =~ /selenium/i }
110
+ # rescue StandardError => myStandardError
111
+ # puts "❌ Error: #{myStandardError}"
112
+ # exit(1)
113
+ # end
114
+ # end
115
+ end
116
+
25
117
  at_exit do
26
- if ENV['EXECUTE']
118
+ if ENV['REPORT']
119
+ validateReport
27
120
  time = Time.now.getutc
28
121
  if $browser_data
29
122
  browser_name = $browser_data[:browser_name]
30
- browser_version = $browser_data[:version]
31
- platform = $browser_data[:platform]
123
+ browser_version = $browser_data[:browser_version]
124
+ platform = $browser_data[:platform_name]
32
125
  end
33
126
  ReportBuilder.configure do |config|
34
127
  config.report_path = "#{@report_path}/#{@testcase_report_name}"