flights_gui_henry_tests 2.7.3 → 2.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/features/data/sites.yml +0 -0
  3. data/features/step_definitions/checkout/agencia_steps.rb +0 -0
  4. data/features/step_definitions/checkout/cash_payment_steps.rb +0 -0
  5. data/features/step_definitions/checkout/chat_steps.rb +0 -0
  6. data/features/step_definitions/checkout/cupones_steps.rb +0 -0
  7. data/features/step_definitions/checkout/price_jump_steps.rb +0 -0
  8. data/features/step_definitions/checkout/thanks_steps.rb +0 -0
  9. data/features/step_definitions/landing/landing_long_tail.rb +0 -0
  10. data/features/step_definitions/others/cookies_steps.rb +0 -0
  11. data/features/step_definitions/others/flights_tracker_steps.rb +0 -0
  12. data/features/step_definitions/others/generic_steps.rb +1 -0
  13. data/features/step_definitions/results/devtools_steps.rb +0 -0
  14. data/features/step_definitions/results/itineraries_steps.rb +0 -0
  15. data/features/step_definitions/results/results_steps.rb +0 -0
  16. data/features/step_definitions/search/errors_steps.rb +0 -0
  17. data/features/step_definitions/search/wish_list_steps.rb +0 -0
  18. data/features/support/env.rb +18 -1
  19. data/features/support/lib/clusters/checkout_cluster.rb +0 -0
  20. data/features/support/lib/process_manager.rb +104 -0
  21. data/features/tests/checkout/agency.feature +0 -0
  22. data/features/tests/checkout/chat.feature +0 -0
  23. data/features/tests/checkout/cupones.feature +0 -0
  24. data/features/tests/fixes/facebook.feature +0 -0
  25. data/features/tests/landing/landing_long_tail.feature +0 -0
  26. data/features/tests/others/flights_tracker.feature +0 -0
  27. data/features/tests/search/wish_list.feature +0 -0
  28. data/flights_gui_henry_tests.gemspec +1 -1
  29. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8152b59634e277c2bf9c124dcee362fe9bfeeddd
4
- data.tar.gz: 3d2c5484deef08f81c40e230acfb9a9c94d90589
3
+ metadata.gz: 637313c935a873869a16c80fb2ca22c2280ec96e
4
+ data.tar.gz: 157c372943e0c344af5c29ea4b0855f3aaf1e479
5
5
  SHA512:
6
- metadata.gz: f71f3150bbf215094eb19e6022c6dc0992112975c094b7326efa45309a7c2d15d47d1f4184050da5d097b30aa23311047d455eae3879e8374340320da2e3c360
7
- data.tar.gz: 6485e17ce3ccf7a23f742effd7175138d7edade5418337279eb0d55108b303591a94a6fda5a6962ea88910c4cfe5e8881de78548f8ba9924abf5526e1ef416b0
6
+ metadata.gz: 7e32b158352b65dca4f359f263d7d973be3b1709cb0fa644230c4a5d56579e4c99623288eb85898c9c900f3d8c1dd828a795fbe72ec88a49236d73b220612f65
7
+ data.tar.gz: b4568e9c32a3c13278eb5483641c935774367997f711bf6df181a6f088db41300dd1729bc71ae4dbc9301de698eab943aad785556ad03b28f89c081f5c852a40
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -21,6 +21,7 @@ end
21
21
 
22
22
  at_exit do
23
23
  BROWSER.close if $henry_params['browser']
24
+ ProcessManager.kill_all_childs(Process.pid)
24
25
  end
25
26
 
26
27
  When /^Si (.*), (.*)$/ do |condition, paso |
File without changes
File without changes
File without changes
File without changes
@@ -15,6 +15,7 @@ require 'byebug'
15
15
  $VERBOSE = nil
16
16
 
17
17
  require_relative 'lib/price'
18
+ require_relative 'lib/process_manager'
18
19
  require_relative 'lib/clusters'
19
20
  require_relative 'lib/helpers'
20
21
  require_relative 'matchers'
@@ -60,8 +61,24 @@ rescue
60
61
  browser = "firefox"
61
62
  end
62
63
 
64
+ $trees = []
65
+
63
66
  if browser
64
- BROWSER = Watir::Browser.new init_browser(browser)
67
+ begin
68
+ BROWSER = Watir::Browser.new init_browser(browser)
69
+ rescue
70
+ $trees.push(ProcessManager.process_tree(Process.pid)[:childs])
71
+ reintentos -= 1
72
+ sleep 5
73
+ if reintentos > 0
74
+ puts "Error Net::ReadTimeout - Reintentando abrir el browser..."
75
+ Henry::Environment.execution.set(:error_apertura_browser, "Net::ReadTimeout")
76
+ retry
77
+ else
78
+ @hubo_error = true
79
+ browser = nil
80
+ end
81
+ end
65
82
  screen_width = BROWSER.execute_script("return screen.width;")
66
83
  screen_height = BROWSER.execute_script("return screen.height;")
67
84
  BROWSER.window.resize_to(screen_width, screen_height)
File without changes
@@ -0,0 +1,104 @@
1
+ #encoding: utf-8
2
+
3
+ class ProcessManager
4
+
5
+ #Crea un árbol de procesos, donde el PID recibido es el nodo raíz
6
+ def self.process_tree(pid)
7
+ tree = process_info(pid)
8
+ tree[:childs] = []
9
+ process_childs(pid).each do |child_pid|
10
+ tree[:childs].push(self.process_tree(child_pid))
11
+ end
12
+ tree
13
+ end
14
+
15
+ #Recibe un PID y devuelve un array con los PID de sus hijos
16
+ def self.process_childs(pid)
17
+ `ps -fea | grep #{pid} | grep -v grep | awk '$2!=#{pid} && $8!~/awk/ && $3==#{pid}{print $2}'`.split("\n")
18
+ end
19
+
20
+ #Devuelve un array con la información de los hijos
21
+ def self.process_childs_info(pid)
22
+ process_childs(pid).collect do |child_pid|
23
+ process_info(child_pid)
24
+ end
25
+ end
26
+
27
+ #Devuelve un hash con la información del proceso
28
+ def self.process_info(pid)
29
+ {
30
+ :user => process_user(pid),
31
+ :pid => pid,
32
+ :parent => process_parent(pid),
33
+ :status => process_status(pid),
34
+ :cmd => process_cmd(pid)
35
+ }
36
+ end
37
+
38
+ #Devuelve el usuario del proceso
39
+ def self.process_user(pid)
40
+ `ps -fea | grep #{pid} | awk '$2==#{pid}{print $1}'`.split("\n")[0]
41
+ end
42
+
43
+ #Devuelve el padre del proceso
44
+ def self.process_parent(pid)
45
+ `ps -fea | grep #{pid} | awk '$2==#{pid}{print $3}'`.split("\n")[0]
46
+ end
47
+
48
+ #Devuelve el estado del proceso
49
+ def self.process_status(pid)
50
+ `ps aux | grep #{pid} | awk '$2==#{pid}{print $8}'`.split("\n")[0]
51
+ end
52
+
53
+ #Devuelve el comando del proceso
54
+ def self.process_cmd(pid)
55
+ `ps -fea | grep #{pid} | awk '$2==#{pid}{print $8}'`.split("\n")[0]
56
+ end
57
+
58
+ #Mata al proceso que recibe, si existe
59
+ def self.kill_process(pid)
60
+ begin
61
+ Process.kill('INT', pid)
62
+ #Proceso matado
63
+ true
64
+ rescue Errno::EPERM
65
+ #Permiso insuficiente para matar al proceso
66
+ begin
67
+ `kill -9 #{pid.to_i}`
68
+ true
69
+ rescue
70
+ false
71
+ end
72
+ rescue Errno::ESRCH
73
+ #El proceso no existía
74
+ true
75
+ end
76
+ end
77
+
78
+ #Recibe un árbol de procesos y los mata a todos, incluyendo al nodo principal
79
+ def self.kill_tree(tree)
80
+ tree[:childs].each do |child|
81
+ kill_tree(child)
82
+ end
83
+ kill_process(tree[:pid].to_i)
84
+ end
85
+
86
+ #Recibe un PID y mata todo el árbol de procesos a partir de él, sin matar al nodo principal
87
+ def self.kill_all_childs(pid)
88
+ tree = process_tree(pid)
89
+ tree[:childs].each do |child|
90
+ kill_tree(child)
91
+ end
92
+ end
93
+
94
+ #Se asegura que no queden procesos chrome zombies
95
+ def self.chrome_zombies_collector
96
+ zombies_parent = `ps -fea | grep defunct | grep chrome | grep -v grep | grep -v chromedriver | awk '{print $3}'`.split("\n")
97
+ zombies_parent.each do |parent|
98
+ parent_info = process_info(parent)
99
+ ##Parent == 1, si se volvió huerfano
100
+ kill_process(parent.to_i) if parent_info[:parent] == '1' and parent_info[:cmd].match(/chrome/)
101
+ end
102
+ end
103
+
104
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -14,7 +14,7 @@
14
14
  gem.name = "flights_gui_henry_tests" #Debe ser unico en el Gem Server, tratemos de utilizar nombre que identifiquen de forma inequivoca
15
15
 
16
16
  gem.require_paths = ["lib"] #Usualmente es solo lib -> ["lib"]5
17
- gem.version = '2.7.3' #La version se debe incrementar cada vez que se desea publicar una nueva version del test.
17
+ gem.version = '2.7.4' #La version se debe incrementar cada vez que se desea publicar una nueva version del test.
18
18
 
19
19
  gem.add_dependency('henry-container', '>= 0.1.82')
20
20
  gem.add_dependency('watir-webdriver')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flights_gui_henry_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.3
4
+ version: 2.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - lgonzalez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-02 00:00:00.000000000 Z
11
+ date: 2014-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: henry-container
@@ -255,6 +255,7 @@ files:
255
255
  - features/support/lib/helpers/landing.rb
256
256
  - features/support/lib/helpers/render.rb
257
257
  - features/support/lib/price.rb
258
+ - features/support/lib/process_manager.rb
258
259
  - features/support/lib/services.rb
259
260
  - features/support/lib/services/fenix.rb
260
261
  - features/support/lib/services/landing.rb