Produced by Araxis Merge on 10/12/2018 4:04:44 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Vetlink 2.0.zip\Vetlink 2.0\vetlink-web.zip\vetlink-web\acceptance_test\selenium-ruby\module | DriverUtility_Test_Unit.rb | Thu Nov 2 15:14:16 2017 UTC |
| 2 | Vetlink 2.0.zip\Vetlink 2.0\vetlink-web.zip\vetlink-web\acceptance_test\selenium-ruby\module | DriverUtility_Test_Unit.rb | Fri Oct 12 13:42:41 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 1372 |
| Changed | 3 | 10 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | ||
| 2 | module Dri verUtility TestUnit | |
| 3 | require 'mongo' | |
| 4 | include Mongo | |
| 5 | ||
| 6 | ||
| 7 | USER_ID = "PATID26 " # "D1234 01" | |
| 8 | ||
| 9 | def dete rmineEnvir onment | |
| 10 | hostna me = `host name`.stri p.chomp | |
| 11 | puts " DriverUtil ity.determ ineEnviron ment hostn ame=[#{hos tname}]" | |
| 12 | ||
| 13 | # To t est EULA R est Servic e for Vetl ink, try t his in bro wser http: //localhos t:4520/ser vices/comm on/eula/ve tlink | |
| 14 | # Thes e 3 URL re turns temp late assum ing 192.16 8.101.103 is Vagrant IP | |
| 15 | # http ://localho st:4520/se rvices/com mon/eula/v etlink | |
| 16 | # http ://192.168 .101.103:8 0/services /common/eu la/vetlink | |
| 17 | # http ://192.168 .101.103:9 095/eula/t emplate ( Use this s etup) | |
| 18 | # | |
| 19 | @EULA_ SERVICE_PA TH = "/eul a/template " | |
| 20 | ##Eula | |
| 21 | @DO_EU LA_FULL_CH ECK = true #OKK | |
| 22 | @EULA_ ID_FOR_JIF = "52fbd7 7dbd7f9556 84a76817" # | |
| 23 | @EULA_ AGENCY_JIF = "JIF" | |
| 24 | @EULA_ APPLICATIO N_KEY = "v etlink" | |
| 25 | ||
| 26 | #Vetli nk uploads folder | |
| 27 | @UPLOA DS_PATH = "#{@BASE_U RL}/upload s" | |
| 28 | @ABOUT _PDF = "#{ @UPLOADS_P ATH}/vetli nk.pdf" | |
| 29 | @EULA_ DB_NAME = "eula" # Db that h ouse eula and eulaAp plication collection s | |
| 30 | nodeJ= false #Set to true w hen we don t have vag rant box y et. Make s ure to run nodeJ fir st via com mands cd ~/Projects /vetlink/a pp_test; n ode server .js | |
| 31 | ||
| 32 | #=begin | |
| 33 | if nod eJ | |
| 34 | @RUN NING_ON_MA C = true | |
| 35 | @RUN NING_ON_BU ILD_SERVER = true | |
| 36 | @RUN NING_ON_MA E_SERVER = false | |
| 37 | @RUN NING_ON_IE 9_WIN7 = f alse | |
| 38 | ||
| 39 | @HOS T = "local host" | |
| 40 | @EUL A_HOST = " 192.168.10 1.31" | |
| 41 | #Running within no deJ server | |
| 42 | @POR T = "9798" # set to value defi ned for DE FAULT_HTTP _LISTEN_PO RT = 9798; in file ~ /Projects/ vetlink/ap p_test/app .js | |
| 43 | @MON GO_PORT = "4525" | |
| 44 | @EUL A_PORT = " 9095" # "9 798" | |
| 45 | @BAS E_URL = "h ttp://#{@H OST}:#{@PO RT}" | |
| 46 | ||
| 47 | ||
| 48 | #=end | |
| 49 | ||
| 50 | elsif hostname = = 'nakamaj 990' #- - Running on John Na kama ocal PC | |
| 51 | @RUN NING_ON_BU ILD_SERVER = false | |
| 52 | @RUN NING_ON_MA C = false | |
| 53 | @RUN NING_ON_MA E_SERVER = false | |
| 54 | @RUN NING_ON_IE 9_WIN7 = f alse | |
| 55 | ||
| 56 | @HOS T = "local host" | |
| 57 | @EUL A_HOST = " 192.168.10 1.31" #-- -From Andy | |
| 58 | @POR T = "8089" | |
| 59 | @EUL A_PORT = " 9095" #"90 90" | |
| 60 | @MON GO_PORT = "27017" | |
| 61 | @BAS E_URL = "h ttp://#{@H OST}:#{@PO RT}" | |
| 62 | ||
| 63 | elsif hostname = = 'navyBui ld' #-- Running o n MAE Buil d Server n avyBuild | |
| 64 | @RUN NING_ON_MA C = false | |
| 65 | @RUN NING_ON_BU ILD_SERVER = true | |
| 66 | @RUN NING_ON_MA E_SERVER = true | |
| 67 | @RUN NING_ON_IE 9_WIN7 = f alse | |
| 68 | ||
| 69 | @EUL A_HOST = " 192.168.10 1.31" #Ge t Eula ip server fro m Andy | |
| 70 | @HOS T = "192.1 68.101.57" #Ge t Appl ip server fro m Andy | |
| 71 | @POR T = "80" | |
| 72 | @MON GO_PORT = "27017" | |
| 73 | @EUL A_PORT = " 9095" | |
| 74 | @BAS E_URL = "h ttp://#{@H OST}:#{@PO RT}/vetlin k/src/weba pp" | |
| 75 | ||
| 76 | elsif hostname = = 'navyGit ' #-- R unning on MAE Test S erver navy Git | |
| 77 | @RUN NING_ON_MA C = false | |
| 78 | @RUN NING_ON_BU ILD_SERVER = true | |
| 79 | @RUN NING_ON_MA E_SERVER = true | |
| 80 | @RUN NING_ON_IE 9_WIN7 = f alse | |
| 81 | ||
| 82 | @HOS T = "local host" | |
| 83 | @EUL A_HOST = " 192.168.10 1.31" #-- -From Andy | |
| 84 | @POR T = "80" | |
| 85 | @MON GO_PORT = "27017" | |
| 86 | @EUL A_PORT = " 80" | |
| 87 | @BAS E_URL = "h ttp://#{@H OST}:#{@PO RT}/vetlin k/src/weba pp" | |
| 88 | ||
| 89 | elsif ((hostname .slice(-9. .-1) == "M BP.local") ) #-- R unning on local macP ro from Ag ilex build ing | |
| 90 | @RUN NING_ON_MA C = true | |
| 91 | @RUN NING_ON_BU ILD_SERVER = true | |
| 92 | @RUN NING_ON_MA E_SERVER = false | |
| 93 | @RUN NING_ON_IE 9_WIN7 = f alse | |
| 94 | ||
| 95 | #Run ning with vagrant bo x | |
| 96 | #@HO ST = "loca lhost" | |
| 97 | @HOST = " IP " #"192.16 8.101.103" #IP of Vet link vagra nt box fro m Thuy Hom e via VPN, different from Agil ex buikdin g | |
| 98 | @EULA_HOST = "192.16 8.101.103" #" IP " #IP of vag rant box t hat hosts Eula (MUST NOT use l ocalhost). Now it is in Vetlin k vagrant box, get i t via cmds vagrant s sh, ifconf ig | |
| 99 | @EUL A_PORT = " 9095" | |
| 100 | if ( @HOST == "localhost " ) | |
| 101 | @ PORT = "45 20" #Get value from "con fig.vm.for ward_port 80, 4520" in Vagrant file | |
| 102 | @ MONGO_PORT = "4525" #Get value from "con fig.vm.for ward_port 27017, 452 5" in Vagr antfile | |
| 103 | else | |
| 104 | @P ORT = "80" #Port 80 i f @HOST se t to VetLi nk Vagrant box IPadd ress | |
| 105 | @M ONGO_PORT = "27017" #Port 2701 7 if @HOST set to Ve tLink Vagr ant box IP address | |
| 106 | end | |
| 107 | ||
| 108 | @BAS E_URL = "h ttp://#{@H OST}:#{@PO RT}/vetlin k/src/weba pp" | |
| 109 | elsif ((hostname .slice(-5. .-1) == ". home" ) ) #-- Runn ing on loc al macPro from Agile x building | |
| 110 | @R UNNING_ON_ MAC_AT_HOM E = true | |
| 111 | @R UNNING_ON_ MAC = fals e | |
| 112 | @R UNNING_ON_ BUILD_SERV ER = false | |
| 113 | @R UNNING_ON_ MAE_SERVER = false | |
| 114 | @R UNNING_ON_ IE9_WIN7 = false | |
| 115 | ||
| 116 | #R unning wit h vagrant box | |
| 117 | #@ HOST = "lo calhost" | |
| 118 | @HOST = "1 92.168.101 .103" #" IP " #IP of Vet link vagra nt box fro m Thuy Hom e via VPN, different from Agil ex buikdin g | |
| 119 | @E ULA_HOST = "192.168. 101.103" #IP of vag rant box t hat hosts Eula (MUST NOT use l ocalhost). Now it is in Vetlin k vagrant box, get i t via cmds vagrant s sh, ifconf ig | |
| 120 | @E ULA_PORT = "9095" | |
| 121 | if ( @HOST = = "localho st" ) | |
| 122 | @PORT = " 4520" #Get val ue from "c onfig.vm.f orward_por t 80, 4520 " in Vagra ntfile | |
| 123 | @MONGO_PO RT = "4525 " #Get val ue from "c onfig.vm.f orward_por t 27017, 4 525" in Va grantfile | |
| 124 | el se | |
| 125 | @PORT = "8 0" #Port 80 if @HOST set to Vet Link Vagra nt box IPa ddress | |
| 126 | @MONGO_POR T = "27017 " #Port 27 017 if @HO ST set to VetLink Va grant box IPaddress | |
| 127 | en d | |
| 128 | ||
| 129 | @B ASE_URL = "http://#{ @HOST}:#{@ PORT}/vetl ink/src/we bapp" | |
| 130 | ||
| 131 | elsif ( hostname = = 'IE9Win7 ' ) #-- Running on IE9Win7 V MWindows t hat has IE 9 | |
| 132 | puts ("Yes, I a m in " + h ostname) | |
| 133 | @R UNNING_ON_ MAC = fals e | |
| 134 | @R UNNING_ON_ BUILD_SERV ER = false | |
| 135 | @R UNNING_ON_ MAE_SERVER = false | |
| 136 | @R UNNING_ON_ IE9_WIN7 = true | |
| 137 | ||
| 138 | #R unning wit h vagrant box | |
| 139 | #@ HOST = "lo calhost" | |
| 140 | @H OST = "192 .168.101.5 5" #IP of Vetlink v agrant box from Thuy Home via VPN, diffe rent from Agilex bui kding | |
| 141 | @E ULA_HOST = "192.168. 101.55" # IP of vagr ant box th at hosts E ula (MUST NOT use lo calhost). Now it is in Vetlink vagrant b ox, get it via cmds vagrant ss h, ifconfi g | |
| 142 | @E ULA_PORT = "9095" | |
| 143 | if ( @HOST = = "localho st" ) | |
| 144 | @PORT = " 4520" #Get val ue from "c onfig.vm.f orward_por t 80, 4520 " in Vagra ntfile | |
| 145 | @MONGO_PO RT = "4525 " #Get val ue from "c onfig.vm.f orward_por t 27017, 4 525" in Va grantfile | |
| 146 | el se | |
| 147 | @PORT = "8 0" #Port 80 if @HOST set to Vet Link Vagra nt box IPa ddress | |
| 148 | @MONGO_POR T = "27017 " #Port 27 017 if @HO ST set to VetLink Va grant box IPaddress | |
| 149 | en d | |
| 150 | ||
| 151 | @B ASE_URL = "http://#{ @HOST}:#{@ PORT}/vetl ink/src/we bapp" | |
| 152 | ||
| 153 | else #-- Runn ing on Agi lex Build Server | |
| 154 | @RUN NING_ON_BU ILD_SERVER = true | |
| 155 | @RUN NING_ON_MA C = false | |
| 156 | @RUN NING_ON_MA E_SERVER = false | |
| 157 | @RUN NING_ON_IE 9_WIN7 = f alse | |
| 158 | ||
| 159 | @HOST = " IP " #Get Appl ip server from Andy | |
| 160 | @EULA_HOST = " IP " #Get Eula ip server from Andy | |
| 161 | @POR T = "80" | |
| 162 | @MON GO_PORT = "27017" | |
| 163 | @EUL A_PORT = " 9095" | |
| 164 | @BAS E_URL = "h ttp://#{@H OST}:#{@PO RT}/vetlin k/src/weba pp" | |
| 165 | ||
| 166 | end | |
| 167 | ||
| 168 | puts " DriverUtil ity.determ ineEnviron ment set @ BASE_URL=# {@BASE_URL }" | |
| 169 | ||
| 170 | end | |
| 171 | ||
| 172 | ||
| 173 | ||
| 174 | ||
| 175 | def getD riverBased OnHost | |
| 176 | #Need to call de termineEnv ironment f irst befor e calling this metho d | |
| 177 | ||
| 178 | if @RU NNING_ON_I E9_WIN7 | |
| 179 | @dr iver = Sel enium::Web Driver.for :ie | |
| 180 | put s("Setting Driver fo r IE") | |
| 181 | else | |
| 182 | @dr iver = Sel enium::Web Driver.for :firefox | |
| 183 | put s("Setting Driver fo r FIREFOX" ) | |
| 184 | end | |
| 185 | end | |
| 186 | ||
| 187 | ||
| 188 | ||
| 189 | ||
| 190 | def init ializeConf igurations () | |
| 191 | #https ://code.go ogle.com/p /selenium/ wiki/Pytho nBindings for IE | |
| 192 | #How t o use Sele nium 2 web driver wit h new IE D river at h ttp://soat esting.wor dpress.com /2013/02/2 6/how-to-u se-seleniu m-2-webdri ver-with-n ew-ie-driv er-2/ | |
| 193 | ||
| 194 | determ ineEnviron ment | |
| 195 | getDri verBasedOn Host | |
| 196 | #if $R UNNING_ON_ IE9_WIN7 | |
| 197 | # @driver = Selenium: :WebDriver .for :ie | |
| 198 | #else | |
| 199 | # @driver = Selenium: :WebDriver .for :fire fox | |
| 200 | #end | |
| 201 | #Selen ium IDE pu t in a sla sh at end of base_ur l which ca used bad u rl's below | |
| 202 | @drive r.get(@BAS E_URL + "/ ") | |
| 203 | @drive r.manage.t imeouts.im plicit_wai t = 30 | |
| 204 | @accep t_next_ale rt = true | |
| 205 | @verif ication_er rors = [] | |
| 206 | #Place holder to reset dat abase | |
| 207 | # clear ActionPlan () | |
| 208 | end | |
| 209 | ||
| 210 | ||
| 211 | ||
| 212 | def init ializeConf igurations NoClear () | |
| 213 | ||
| 214 | #@driv er = Selen ium::WebDr iver.for : firefox | |
| 215 | determ ineEnviron ment #Def ine to use IE or Fir eFox first | |
| 216 | getDri verBasedOn Host #The n get appr opriate dr iver for I E or FF | |
| 217 | #Selen ium IDE pu t in a sla sh at end of base_ur l which ca used bad u rl's below | |
| 218 | @drive r.get(@BAS E_URL + "/ ") | |
| 219 | @drive r.manage.t imeouts.im plicit_wai t = 30 | |
| 220 | @accep t_next_ale rt = true | |
| 221 | @verif ication_er rors = [] | |
| 222 | end | |
| 223 | ||
| 224 | ||
| 225 | #Caller should on ly call th is method for FireFo x environm ent only | |
| 226 | def ini tializeCon figWithFir eFoxProfil e() | |
| 227 | ||
| 228 | deter mineEnviro nment | |
| 229 | if $R UNNING_ON_ IE9_WIN7 | |
| 230 | pu ts("You ar e running on IE9_WIN 7, why do you call t his FireFo x specific method - initialize ConfigWith FireFoxPro file- ???? ") | |
| 231 | pu ts("Must e xit until you fix th is problem ") | |
| 232 | ex it | |
| 233 | end | |
| 234 | ||
| 235 | @FIRE FOX_PROFIL E_PATH = F ile.dirnam e(__FILE__ ) + "/../f irefoxProf ile" | |
| 236 | ||
| 237 | profi le = Selen ium::WebDr iver::Fire fox::Profi le.new(@FI REFOX_PROF ILE_PATH) | |
| 238 | ||
| 239 | @driv er = Selen ium::WebDr iver.for : firefox, : profile => profile | |
| 240 | ||
| 241 | @driv er.manage. timeouts.i mplicit_wa it = 30 | |
| 242 | ||
| 243 | @driv er.manage. delete_all _cookies | |
| 244 | ||
| 245 | @driv er.get(@BA SE_URL + " /") | |
| 246 | @acce pt_next_al ert = true | |
| 247 | @driv er.manage. timeouts.i mplicit_wa it = 30 | |
| 248 | @veri fication_e rrors = [] | |
| 249 | clear ActionPlan () | |
| 250 | end | |
| 251 | ||
| 252 | ||
| 253 | ||
| 254 | def qui tDriver() | |
| 255 | @driv er.quit | |
| 256 | asser t_equal [] , @verific ation_erro rs | |
| 257 | end | |
| 258 | ||
| 259 | ||
| 260 | #Module: Selenium: :WebDriver ::Keys | |
| 261 | #http:// selenium.g ooglecode. com/svn/tr unk/docs/a pi/rb/Sele nium/WebDr iver/Keys. html | |
| 262 | def open UrlInNewTa b(url) | |
| 263 | #handl es of all existing w indows b4 opening ne w window | |
| 264 | active WindowHand leList = @ driver.win dow_handle s | |
| 265 | #Open new tab | |
| 266 | if (@R UNNING_ON_ MAC or @RU NNING_ON_M AC_AT_HOME ) | |
| 267 | #Mus t open a n ew window NOT new ta b in brows er because ruby wont treat new tab as ne w window | |
| 268 | puts ("Its a MA C: send_ke ys([:comma nd, 'n']") | |
| 269 | @dri ver.find_e lement(:xp ath, "//bo dy" ).send _keys([:co mmand, 'n' ]) # com mand-n for Mac | |
| 270 | else | |
| 271 | puts ("Its a PC : send_key s([:contro l, 'n']") | |
| 272 | @dri ver.find_e lement(:cl ass, "cont ainer").se nd_keys [: control, ' n'] # con trol-n by default | |
| 273 | end | |
| 274 | handle OfNewWindo w=nil | |
| 275 | pause 2.0 | |
| 276 | puts(" after open up new wi ndow, Loop through [ #{@driver. window_han dles.count }] window handles th at @driver returns") | |
| 277 | @drive r.window_h andles.eac h do |hand le| | |
| 278 | put s("switchi ng to hand le...#{han dle}") | |
| 279 | @dr iver.switc h_to.windo w handle | |
| 280 | thi sHandleIsH andleOfNew Window = t rue | |
| 281 | act iveWindowH andleList. each_with_ index do | activeHand le, i| | |
| 282 | puts("#{ha ndle}: a h andle of e xisting wi ndow?") | |
| 283 | if (handle == active Handle) | |
| 284 | puts(" Yes-Skip- handle of existing w indow #{(i +1)}th ") | |
| 285 | thisHand leIsHandle OfNewWindo w = false | |
| 286 | break | |
| 287 | end | |
| 288 | ||
| 289 | end #of acti veWindowHa ndleList l oop | |
| 290 | if ( thisHandle IsHandleOf NewWindow) | |
| 291 | pu ts(" No -Handle of newly cre ated windo w found!") | |
| 292 | ha ndleOfNewW indow = ha ndle | |
| 293 | br eak | |
| 294 | end | |
| 295 | end # of all win dow handle s list tha t driver r eturns | |
| 296 | if (ha ndleOfNewW indow != n il) | |
| 297 | puts ("switchin g to handl eOfNewWind ow[#{handl eOfNewWind ow}]") | |
| 298 | @dri ver.switch _to.window handleOfN ewWindow | |
| 299 | puts ("and fill ing it wit h this url [#{url}]") | |
| 300 | @dri ver.get(ur l) | |
| 301 | else | |
| 302 | puts ("Failed t o open a n ew window[ #{handleOf NewWindow} ]") | |
| 303 | end | |
| 304 | return (handleOf NewWindow) | |
| 305 | end | |
| 306 | ||
| 307 | ||
| 308 | ||
| 309 | def get CurrentURL () | |
| 310 | retur n @driver. current_ur l | |
| 311 | end | |
| 312 | ||
| 313 | ||
| 314 | ||
| 315 | def got oHomePage( ) | |
| 316 | @driv er.get(@BA SE_URL + " /") | |
| 317 | end | |
| 318 | ||
| 319 | ||
| 320 | #Get <t ile> tag u nder <head > section <title cla ss="ng-bin ding">Vete ran Link</ title> | |
| 321 | def get PageTitle( ) | |
| 322 | wait = Selenium: :WebDriver ::Wait.new (:timeout => 10) | |
| 323 | wait.u ntil {@dri ver.title} | |
| 324 | return @driver.t itle | |
| 325 | end | |
| 326 | ||
| 327 | ||
| 328 | #Get tex t of id "t itle" | |
| 329 | def getT itleById() | |
| 330 | return @driver.f ind_elemen t(:id, TIT LE_ID).tex t | |
| 331 | end | |
| 332 | ||
| 333 | ||
| 334 | ||
| 335 | #VetLink has heade r with thi s class | |
| 336 | def getP ageHeaderT ext() | |
| 337 | return getTitleB yId() | |
| 338 | end | |
| 339 | ||
| 340 | ||
| 341 | def cli ck(how, wh at) | |
| 342 | #puts "testunit. click" | |
| 343 | #how (:class, : class_name , :id, :li nk_text, : link, :par tial_link_ text, :nam e, :tag_na me, :xpath ) | |
| 344 | #what (String) | |
| 345 | @dri ver.find_e lement(how , what).cl ick | |
| 346 | end | |
| 347 | ||
| 348 | #--jnakama comment o ut. This is redefin ed in Page Utility | |
| 349 | # def isE lementPres ent?(how, what) | |
| 350 | # @driv er.manage. timeouts.i mplicit_wa it = 2 | |
| 351 | # begin | |
| 352 | # @dr iver.find_ element(ho w, what) | |
| 353 | # @dr iver.manag e.timeouts .implicit_ wait = 30 | |
| 354 | # ret urn true | |
| 355 | # rescu e Exceptio n=>e | |
| 356 | # @dr iver.manag e.timeouts .implicit_ wait = 30 | |
| 357 | # ret urn false | |
| 358 | # end | |
| 359 | # end | |
| 360 | ||
| 361 | ||
| 362 | def relo adPage() | |
| 363 | @drive r.find_ele ment(:xpat h, "//body " ).send_k eys(:f5) | |
| 364 | pause 0.1 | |
| 365 | end | |
| 366 | alias re freshPage reloadPage | |
| 367 | ||
| 368 | ||
| 369 | ||
| 370 | def goto BottomOfPa ge() | |
| 371 | 5.time s do | |
| 372 | @dri ver.find_e lement(:xp ath, "//bo dy" ).send _keys(:pag e_down) | |
| 373 | paus e 0.1 | |
| 374 | end | |
| 375 | end | |
| 376 | ||
| 377 | ||
| 378 | ||
| 379 | def rest artBrowser | |
| 380 | quitDr iver() | |
| 381 | initia lizeConfig urationsNo Clear() | |
| 382 | @mainp age = site GetMainPag e() | |
| 383 | end | |
| 384 | ||
| 385 | ||
| 386 | #Vetlink | |
| 387 | def tapO nDSLogonBu tton | |
| 388 | @drive r.find_ele ment(:id, "dslogon-b utton").cl ick; | |
| 389 | pause 0.5 | |
| 390 | end | |
| 391 | ||
| 392 | ||
| 393 | ||
| 394 | ||
| 395 | #Vetlink | |
| 396 | def acce ptEulaClic kOnDSLogon Go2_LoginP age | |
| 397 | puts " acceptEula ClickOnDSL ogonGo2_Lo ginPage" | |
| 398 | ||
| 399 | @drive r.manage.d elete_all_ cookies | |
| 400 | assert Header("EU LA") | |
| 401 | eulaPa ge = siteG etEulaPage () | |
| 402 | mainpa ge = eulaP age.clickO nAccept # to get to DSLogon Pa ge | |
| 403 | assert Title4VetL inks | |
| 404 | puts(" acceptEula ClickOnDSL ogonGo2_Lo ginPage: AT DSLOGON page now, about to click on D SLogon but ton to bri ng up MAE LOgin scre en ") | |
| 405 | dsLogo nPage = ma inpage.cli ckOnDSLogo n() | |
| 406 | pause 0.5 | |
| 407 | return dsLogonPa ge | |
| 408 | ||
| 409 | end | |
| 410 | ||
| 411 | ||
| 412 | ||
| 413 | #Vetlink | |
| 414 | def acce ptEulaGo2_ DSLogonPag e | |
| 415 | puts " [acceptEul aGo2DSLogo nPage]" | |
| 416 | ||
| 417 | @drive r.manage.d elete_all_ cookies | |
| 418 | assert Header("EU LA") | |
| 419 | eulaPa ge = siteG etEulaPage () | |
| 420 | mainPa ge = eulaP age.clickO nAccept # to get to DSLogon Pa ge | |
| 421 | assert Title4VetL inks | |
| 422 | puts(" acceptEula Go2_DSLogo nPage: AT DSLOGON p age now, r eturning m ainPage ") | |
| 423 | return mainPage | |
| 424 | ||
| 425 | end | |
| 426 | ||
| 427 | ||
| 428 | ||
| 429 | ||
| 430 | def logi nToWelcome Page | |
| 431 | puts " [loginToWe lcomePage] " | |
| 432 | mainpa ge = accep tEulaGo2_D SLogonPage | |
| 433 | dsLogo nPage = ma inpage.cli ckOnDSLogo n() | |
| 434 | pause 1 | |
| 435 | return dsLogonPa ge.loginAs TestUserTo WelcomePag e() #Retu rn Welcome page | |
| 436 | end | |
| 437 | ||
| 438 | ||
| 439 | ||
| 440 | ||
| 441 | ||
| 442 | #======= ========== ========== ========== == | |
| 443 | def log inToHomePa ge | |
| 444 | mainp age = site GetMainPag e() | |
| 445 | asser tTitle4Vet Links | |
| 446 | ||
| 447 | eulaP age = site GetEulaPag e() | |
| 448 | eulaP age.clickO nAccept | |
| 449 | asser tTitle4Vet Links | |
| 450 | ||
| 451 | dsLog onPage = m ainpage.cl ickOnDSLog on() | |
| 452 | retur n dsLogonP age.loginA sTestUser( ); | |
| 453 | end | |
| 454 | ||
| 455 | ||
| 456 | def logi nSkipSetup AndGotoHom ePage(over duedays=-1 ) | |
| 457 | puts " loginSkipS etupAndGot oHomePage overdueday s=[#{overd uedays}]" | |
| 458 | @drive r.manage.d elete_all_ cookies | |
| 459 | mainpa ge = siteG etMainPage () | |
| 460 | assert Title4VetL inks | |
| 461 | eulaPa ge = siteG etEulaPage () | |
| 462 | #dumpP age("Drive rUtility.l oginSkipSe tupAndGoTo HomePage:s iteGetEula Page():") | |
| 463 | eulaPa ge.clickOn Accept | |
| 464 | assert Title4VetL inks | |
| 465 | dsLogo nPage = ma inpage.cli ckOnDSLogo n() | |
| 466 | welcom ePage = ds LogonPage. loginAsTes tUserToWel comePage(o verduedays ); | |
| 467 | pause 0.2 | |
| 468 | return welcomePa ge.tapOnEx it | |
| 469 | end | |
| 470 | ||
| 471 | ||
| 472 | ||
| 473 | def dump Page (msg= "DriverUti lity.dumpP age") | |
| 474 | # puts "'#{msg}= [#{@driver .find_elem ent(:xpath , '/html/b ody').text }]" | |
| 475 | puts " '#{msg}=[# {@driver.f ind_elemen t(:xpath, '/html/bod y').text}] " | |
| 476 | # puts "'page_so urce=[#{@d river.page _source}]" | |
| 477 | end | |
| 478 | ||
| 479 | ||
| 480 | ||
| 481 | def dump PageSource | |
| 482 | # puts "'#{msg}= [#{@driver .find_elem ent(:xpath , '/html/b ody').text }]" | |
| 483 | # puts "'#{msg}= [#{@driver .find_elem ent(:xpath , '/html/b ody').text }]" | |
| 484 | puts " DUMPING PA GE_SOURCE= [#{@driver .page_sour ce}]" | |
| 485 | end | |
| 486 | ||
| 487 | ||
| 488 | ||
| 489 | def clea rActionPla n | |
| 490 | puts " DriverUtil ity.clearA ctionPlan" | |
| 491 | mongo_ client = M ongoClient .new(@HOST , @MONGO_P ORT) | |
| 492 | db = m ongo_clien t.db("vetl ink") | |
| 493 | coll = db.collec tion("acti onPlan") | |
| 494 | coll.r emove() | |
| 495 | mongo_ client.clo se | |
| 496 | end | |
| 497 | ||
| 498 | ||
| 499 | ||
| 500 | def clea rEulaFromD atabase | |
| 501 | puts " DriverUtil ity.clearE ulaFromDat abase" | |
| 502 | mongo_ client = M ongoClient .new(@HOST , @MONGO_P ORT) | |
| 503 | db = m ongo_clien t.db(@EULA _DB_NAME) | |
| 504 | coll = db.collec tion("eula ") | |
| 505 | coll.r emove() | |
| 506 | pause 2.0 | |
| 507 | coll2 = db.colle ction("eul aApplicati on") | |
| 508 | coll2. remove() | |
| 509 | pause 2.0 | |
| 510 | mongo_ client.clo se | |
| 511 | end | |
| 512 | ||
| 513 | ||
| 514 | ||
| 515 | def clea rPatientTr iggers | |
| 516 | puts " DriverUtil ity.clearP atientTrig gers" | |
| 517 | mongo_ client = M ongoClient .new(@HOST , @MONGO_P ORT) | |
| 518 | db = m ongo_clien t.db("vetl ink") | |
| 519 | coll = db.collec tion("pati entTrigger ") | |
| 520 | coll.r emove({"pa tientId" = > {'$ne' = > "0"}}) | |
| 521 | mongo_ client.clo se | |
| 522 | end | |
| 523 | ||
| 524 | ||
| 525 | ||
| 526 | def clea rControlTe stScore | |
| 527 | puts " DriverUtil ity.clearC ontrolTest " | |
| 528 | mongo_ client = M ongoClient .new(@HOST , @MONGO_P ORT) | |
| 529 | db = m ongo_clien t.db("vetl ink") | |
| 530 | coll = db.collec tion("cont rolTestSco re") | |
| 531 | coll.r emove() | |
| 532 | mongo_ client.clo se | |
| 533 | end | |
| 534 | ||
| 535 | ||
| 536 | def clea rAssessmen ts | |
| 537 | puts " DriverUtil ity.clearA ssessments " | |
| 538 | mongo_ client = M ongoClient .new(@HOST , @MONGO_P ORT) | |
| 539 | db = m ongo_clien t.db("vetl ink") | |
| 540 | coll = db.collec tion("asse ssments") | |
| 541 | coll.r emove() | |
| 542 | mongo_ client.clo se | |
| 543 | end | |
| 544 | ||
| 545 | ||
| 546 | ||
| 547 | ||
| 548 | def getC urrentWind owHandle | |
| 549 | return @driver.w indow_hand le | |
| 550 | end | |
| 551 | ||
| 552 | ||
| 553 | ||
| 554 | ||
| 555 | def swit chToNextWi ndow | |
| 556 | curren tWindowHan dle = getC urrentWind owHandle | |
| 557 | retHan dle = curr entWindowH andle | |
| 558 | if (@d river.wind ow_handles .count == 1) | |
| 559 | put s "Only 1 window, re turn curre nt handle. .." | |
| 560 | ret urn retHan dle #If on ly 1 windo w, return handle of current on e | |
| 561 | end | |
| 562 | @drive r.window_h andles.eac h do |hand le| | |
| 563 | re tHandle = handle | |
| 564 | #p ause 1.0 | |
| 565 | #p uts "switc hing handl e..." | |
| 566 | @d river.swit ch_to.wind ow handle | |
| 567 | #p uts handle | |
| 568 | #p uts "curre nt url=[#{ getCurrent URL()}]" | |
| 569 | br eak if han dle != cur rentWindow Handle | |
| 570 | end | |
| 571 | if ( r etHandle ! = nil) | |
| 572 | swit chWindow(r etHandle) | |
| 573 | end | |
| 574 | return retHandle | |
| 575 | end | |
| 576 | ||
| 577 | ||
| 578 | ||
| 579 | def clos eCurrentWi ndow | |
| 580 | @drive r.close | |
| 581 | end | |
| 582 | ||
| 583 | ||
| 584 | ||
| 585 | def swit chWindow(h andle) | |
| 586 | @drive r.switch_t o.window h andle | |
| 587 | end | |
| 588 | ||
| 589 | ||
| 590 | def update _all_dates _to_30_day s_past | |
| 591 | mongo_ client = M ongoClient .new(@HOST , @MONGO_P ORT) | |
| 592 | db = m ongo_clien t.db("vetl ink") | |
| 593 | contro lTestScore = db.coll ection('co ntrolTestS core') | |
| 594 | thirty DaysAgo = formatDate Time(addDa ys(getToda yInZeroTim eUTC, -30) ) | |
| 595 | puts " [#{thirtyD aysAgo}]" | |
| 596 | contro lTestScore .update( { :_id => { '$exists' => true }} , | |
| 597 | {'$s et' => {'s coreDate' => thirtyD aysAgo }}, | |
| 598 | { :m ulti => tr ue, :upser t => false } ) | |
| 599 | ||
| 600 | # db.c ontrolTest Score.upda te( { "_id " : { $exi sts : true } }, | |
| 601 | # { $s et: { scor eDate: "20 12-01-17T0 0:00:00.00 0Z" } }, t rue,true) | |
| 602 | mongo_ client.clo se | |
| 603 | end | |
| 604 | ||
| 605 | ||
| 606 | def update _all_setre minder(sta te) | |
| 607 | mongo_ client = M ongoClient .new(@HOST , @MONGO_P ORT) | |
| 608 | db = m ongo_clien t.db("vetl ink") | |
| 609 | contro lTestScore = db.coll ection('co ntrolTestS core') | |
| 610 | contro lTestScore .update( { :_id => { '$exists' => true }} , | |
| 611 | {'$s et' => {'r eminder' = > state}}, | |
| 612 | { :m ulti => tr ue, :upser t => false } ) | |
| 613 | mongo_ client.clo se | |
| 614 | end | |
| 615 | ||
| 616 | ||
| 617 | #def updat e_score_da ys(parm = {}) | |
| 618 | # sign = parm[:scor e].to_i | |
| 619 | # absScor e = sign.a bs | |
| 620 | # score = sign | |
| 621 | # days = parm[:days ] | |
| 622 | # puts "u pdate..day s=[#{days} ]" | |
| 623 | # newDate = format Date(addDa ys(getToda yInZeroTim eUTC, day s)) | |
| 624 | # puts "u pdate..new Date=[#{ne wDate}]" | |
| 625 | ||
| 626 | def upda te_score_d ays(parmSc ore, parmD ays) | |
| 627 | sign = parmScore .to_i | |
| 628 | absSco re = sign. abs | |
| 629 | score = sign | |
| 630 | days = parmDays | |
| 631 | puts " update..da ys=[#{days }]" | |
| 632 | newDat e = forma tDateTime( addDays(ge tTodayInZe roTimeUTC, days)) | |
| 633 | puts " update..ne wDate=[#{n ewDate}]" | |
| 634 | ||
| 635 | mongo_cl ient = Mon goClient.n ew(@HOST, @MONGO_POR T) | |
| 636 | db = mon go_client. db("vetlin k") | |
| 637 | controlT estScore = db.collec tion('cont rolTestSco re') | |
| 638 | ||
| 639 | if sign < 0 | |
| 640 | contro lTestScore .update( { "patientId " => USER_ ID, 'tota lScore' => {'$ne' => absScore} }, \ | |
| 641 | {'$s et' => {'s coreDate' => newDate }}, \ | |
| 642 | { :m ulti => tr ue, :upser t => false } ) | |
| 643 | else | |
| 644 | puts " else [#{sc ore}]" | |
| 645 | contro lTestScore .update( { "patientId " => USER_ ID, 'total Score' => score}, \ | |
| 646 | {'$s et' => {'s coreDate' => newDate }}, \ | |
| 647 | { :m ulti => fa lse, :upse rt => fals e} ) | |
| 648 | end | |
| 649 | ||
| 650 | # db.con trolTestSc ore.update ({"patien tId" : "D1 23401", "t otalScore" : 13}, | |
| 651 | #{ $set: { scoreDa te: "2014- 01-01T00:0 0:00.000Z" } }) | |
| 652 | mongo_cl ient.close | |
| 653 | end | |
| 654 | ||
| 655 | ||
| 656 | def getTod ayInZeroTi meUTC | |
| 657 | # Get cu rrent time into arra y | |
| 658 | # format is [sec,m in,hour,da y,month,ye ar,wday,yd ay,isdst,z one] | |
| 659 | a = Time .now.utc.t o_a | |
| 660 | # Zero o ut sec, mi n, hrs pos itions | |
| 661 | a[0] = 0 | |
| 662 | a[1] = 0 | |
| 663 | a[2] = 0 | |
| 664 | # Conver t it to da te | |
| 665 | return T ime.utc(*a ) | |
| 666 | end | |
| 667 | ||
| 668 | ||
| 669 | ||
| 670 | def addDay s(t, d) | |
| 671 | # Conver t days int o seconds and add it to date | |
| 672 | return t +(d*86400) | |
| 673 | end | |
| 674 | ||
| 675 | ||
| 676 | ||
| 677 | def format DateTime(t ) | |
| 678 | return t .strftime( "%Y-%m-%dT %H:%M:%S.0 00Z") | |
| 679 | end | |
| 680 | ||
| 681 | def format Date(t) | |
| 682 | return t .strftime( "%-m/%-d/% Y") | |
| 683 | end | |
| 684 | ||
| 685 | ||
| 686 | ||
| 687 | def getBod yContent() | |
| 688 | return @ driver.fin d_element( :xpath, '/ html/body' ).text | |
| 689 | end | |
| 690 | ||
| 691 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.