testcentricity_web 0.3.0 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf5dcf5a8e30b15a98ba7721e6807e712ece93cc
4
- data.tar.gz: b3f5847cc2c1361cd173d6e07f8067ce73a27512
3
+ metadata.gz: d5c975046093d3f1df905a8eccdaa96d489f2e3a
4
+ data.tar.gz: 48048165acc5ddde21fe93fd351c064a70bc464e
5
5
  SHA512:
6
- metadata.gz: 3ba3c62f7df7ab34d716122a5d4525eda934a79744bb3f12f52457d13cfb1933c7219f66e10dd9dcc4cbe512f60a94de2ac7afacfec9ed4d5aa20bddc8e6c7f8
7
- data.tar.gz: b641077348a2ba86aaad168945e86c1a5071b61a57f56040941b85f72377aaff6bcf771fd464de8c3985b24a93cfc9fa2206e938689423ded6eb229678d3b4f0
6
+ metadata.gz: 5b05177cdae2a2e9ab69bd445cf78a4748285281e08d9dae574d9484877de4a5532e76cf9c0104ec2caff7cd89202b75aead2c20b11ad3d7270df0c070025168
7
+ data.tar.gz: 5ea51dd85b38b6400f8e7a56a7ff264873e70affeea6d6434c834a45215a2f6d1b4ef17d4b839407bf07d91c73c3065c4c6c729b3f16194657823a4c8efbeffb
@@ -1,5 +1,5 @@
1
1
  module TestCentricity
2
- class Browsers
2
+ module Browsers
3
3
  include Capybara::DSL
4
4
 
5
5
  # Resize selenium browser window to avoid Selenium::WebDriver::Error::MoveTargetOutOfBoundsError errors
@@ -21,35 +21,35 @@ module TestCentricity
21
21
  end
22
22
 
23
23
  def self.refresh_browser
24
- page.driver.browser.navigate.refresh
24
+ Capybara.page.driver.browser.navigate.refresh
25
25
  end
26
26
 
27
27
  def self.switch_to_new_browser_instance
28
- page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
28
+ Capybara.page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
29
29
  end
30
30
 
31
31
  def self.close_all_browser_instances
32
- page.driver.browser.window_handles.each do |handle|
32
+ Capybara.page.driver.browser.window_handles.each do |handle|
33
33
  page.driver.browser.switch_to.window(handle)
34
34
  page.driver.browser.close
35
35
  end
36
36
  end
37
37
 
38
38
  def self.close_current_browser_window
39
- page.driver.browser.close
40
- page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
39
+ Capybara.page.driver.browser.close
40
+ Capybara.page.driver.browser.switch_to.window(Capybara.page.driver.browser.window_handles.last)
41
41
  end
42
42
 
43
43
  def self.close_old_browser_instance
44
- page.driver.browser.switch_to.window(page.driver.browser.window_handles.first)
45
- page.driver.browser.close
46
- page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
44
+ Capybara.page.driver.browser.switch_to.window(Capybara.page.driver.browser.window_handles.first)
45
+ Capybara.page.driver.browser.close
46
+ Capybara.page.driver.browser.switch_to.window(Capybara.page.driver.browser.window_handles.last)
47
47
  end
48
48
 
49
49
  def self.close_named_browser_instance(name)
50
- page.driver.browser.switch_to.window(page.driver.find_window(name))
51
- page.driver.browser.close
52
- page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
50
+ Capybara.page.driver.browser.switch_to.window(Capybara.page.driver.find_window(name))
51
+ Capybara.page.driver.browser.close
52
+ Capybara.page.driver.browser.switch_to.window(Capybara.page.driver.browser.window_handles.last)
53
53
  end
54
54
 
55
55
  def self.delete_all_cookies
@@ -228,7 +228,7 @@ module TestCentricity
228
228
  test_value = value.split('!', 2)
229
229
  parameter = test_value[1].split('.', 2)
230
230
  case parameter[0]
231
- when 'Address', 'Business', 'Code', 'Company', 'PhoneNumber', 'Number', 'Name', 'Internet', 'Lorem', 'Commerce', 'Hacker'
231
+ when 'Address', 'Business', 'Code', 'Color', 'Commerce', 'Company', 'Hacker', 'Internet', 'Lorem', 'Name', 'Number', 'PhoneNumber'
232
232
  result = eval("Faker::#{parameter[0]}.#{parameter[1]}")
233
233
  when 'Date'
234
234
  result = eval("Chronic.parse('#{parameter[1]}')")
@@ -5,14 +5,14 @@ module TestCentricity
5
5
  def self.enqueue_assert_equal(expected, actual, error_message)
6
6
  unless expected == actual
7
7
  @error_queue = "#{@error_queue}#{error_message} to be\n #{expected}\nbut found\n #{actual}\n\n"
8
- screen_shot_and_save_page(nil)
8
+ screen_shot_and_save_page
9
9
  end
10
10
  end
11
11
 
12
12
  def self.enqueue_assert_not_equal(expected, actual, error_message)
13
13
  unless expected != actual
14
14
  @error_queue = "#{@error_queue}#{error_message} to not be equal to #{expected}\n\n"
15
- screen_shot_and_save_page(nil)
15
+ screen_shot_and_save_page
16
16
  end
17
17
  end
18
18
 
@@ -26,4 +26,17 @@ module TestCentricity
26
26
  @error_queue = nil
27
27
  end
28
28
  end
29
+
30
+ private
31
+
32
+
33
+ def self.screen_shot_and_save_page
34
+ timestamp = Time.now.strftime('%Y%m%d%H%M%S')
35
+ filename = "Screenshot-#{timestamp}"
36
+ path = File.join Dir.pwd, "reports/screenshots/", filename
37
+ save_screenshot "#{path}.png"
38
+ puts "Screenshot saved at #{path}.png"
39
+ screen_shot = { :path => path, :filename => filename }
40
+ Environ.save_screen_shot(screen_shot)
41
+ end
29
42
  end
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler