selenium-cucumber 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/Example/features/assertion_steps_Ex.feature +121 -0
  2. data/Example/features/click_steps_Ex.feature +28 -0
  3. data/Example/features/configuration_step_Ex.feature +9 -0
  4. data/Example/features/input_steps_Ex.feature +87 -0
  5. data/Example/features/javascript_steps_Ex.feature +19 -0
  6. data/Example/features/navigation_steps_Ex.feature +45 -0
  7. data/Example/features/new.feature +7 -0
  8. data/Example/features/progress_step_Ex.feature +18 -0
  9. data/Example/features/screenshot_step_Ex.feature +11 -0
  10. data/Example/features/step_definitions/custom_steps.rb +14 -0
  11. data/Example/features/support/env.rb +38 -0
  12. data/Example/features/support/hooks.rb +34 -0
  13. data/Example/run_features.rb +40 -0
  14. data/Example/test_page.html +206 -0
  15. data/bin/generate.rb +20 -20
  16. data/bin/helper.rb +50 -50
  17. data/bin/selenium-cucumber +26 -26
  18. data/doc/canned_steps.md +479 -463
  19. data/doc/installation.md +16 -16
  20. data/doc/selenium-cucumber-API.md +81 -81
  21. data/doc/selenium-cucumber-help.md +18 -18
  22. data/features-skeleton/my_first.feature +5 -5
  23. data/features-skeleton/step_definitions/custom_steps.rb +4 -4
  24. data/features-skeleton/support/env.rb +38 -38
  25. data/features-skeleton/support/hooks.rb +33 -33
  26. data/lib/selenium-cucumber.rb +2 -2
  27. data/lib/selenium-cucumber/assertion_steps.rb +7 -2
  28. data/lib/selenium-cucumber/click_elements_steps.rb +7 -0
  29. data/lib/selenium-cucumber/methods/assertion_methods.rb +74 -24
  30. data/lib/selenium-cucumber/methods/click_elements_methods.rb +7 -2
  31. data/lib/selenium-cucumber/methods/configuration_methods.rb +1 -0
  32. data/lib/selenium-cucumber/methods/navigate_methods.rb +22 -32
  33. data/lib/selenium-cucumber/methods/required_files.rb +2 -0
  34. data/lib/selenium-cucumber/navigation_steps.rb +8 -0
  35. data/lib/selenium-cucumber/progress_steps.rb +2 -2
  36. data/lib/selenium-cucumber/version.rb +1 -1
  37. metadata +27 -45
@@ -2,13 +2,18 @@ require_relative 'required_files'
2
2
 
3
3
 
4
4
  def click(access_type,access_name)
5
- element = WAIT.until {$driver.find_element(:"#{access_type}" => "#{access_name}")}.click
5
+ WAIT.until {$driver.find_element(:"#{access_type}" => "#{access_name}")}.click
6
6
  end
7
7
 
8
8
  def click_forcefully(access_type, access_name)
9
9
  $driver.execute_script('arguments[0].click();', WAIT.until {$driver.find_element(:"#{access_type}" => "#{access_name}")})
10
10
  end
11
11
 
12
+ def double_click(access_type,access_value)
13
+ element = WAIT.until {$driver.find_element(:"#{access_type}" => "#{access_value}")}
14
+ $driver.action.double_click(element).perform
15
+ end
16
+
12
17
  def submit(access_type,access_name)
13
- element = WAIT.until {$driver.find_element(:"#{access_type}" => "#{access_name}")}.submit
18
+ WAIT.until {$driver.find_element(:"#{access_type}" => "#{access_name}")}.submit
14
19
  end
@@ -3,6 +3,7 @@ require_relative 'required_files'
3
3
  #method to print configuration
4
4
 
5
5
  def print_congifugartion
6
+ puts "OS : "+Selenium::WebDriver::Platform.os.to_s
6
7
  puts "Configuration : "+$driver.execute_script("return navigator.userAgent;")
7
8
  puts "Date and Time : #{Time.now}"
8
9
  end
@@ -19,32 +19,30 @@ def close_driver
19
19
  $driver.close
20
20
  end
21
21
 
22
- #Method to zoom in/out page
23
- def zoom_in_out(in_out)
24
- if get_os=="windows"
25
- key="control"
26
- elsif get_os=="mac"
27
- key="command"
22
+ #method to return key by os wise
23
+ def get_key
24
+ os=Selenium::WebDriver::Platform.os
25
+ if os.to_s=="windows"
26
+ return "control"
27
+ elsif os.to_s=="mac"
28
+ return "command"
28
29
  end
30
+ end
29
31
 
30
- $driver.action.key_down(:"#{key}").send_keys(:"#{in_out}").key_up(:"#{key}").perform
32
+ #Method to zoom in/out page
33
+ def zoom_in_out(in_out)
34
+ $driver.action.key_down(:"#{get_key}").send_keys(:"#{in_out}").key_up(:"#{get_key}").perform
31
35
  end
32
36
 
33
37
  #Method to zoom in/out web page until web element displyas
34
38
  def zoom_in_out_till_element_display(access_type, in_out, access_name)
35
39
 
36
- if get_os=="windows"
37
- key="control"
38
- elsif get_os=="mac"
39
- key="command"
40
- end
41
-
42
40
  while true
43
41
 
44
42
  if WAIT.until {$driver.find_element(:"#{access_type}" => "#{access_name}")}.displayed?
45
43
  break
46
44
  else
47
- $driver.action.key_down(:"#{key}").send_keys(:"#{in_out}").key_up(:"#{key}").perform
45
+ $driver.action.key_down(:"#{get_key}").send_keys(:"#{in_out}").key_up(:"#{get_key}").perform
48
46
  end
49
47
  end
50
48
 
@@ -83,24 +81,16 @@ def scroll_page(to)
83
81
  end
84
82
  end
85
83
 
86
- def get_os
87
- case CONFIG['host_os']
88
- when /mingw32|windows/i
89
- # Windows
90
- return "windows"
91
- when /linux|arch/i
92
- # Linux
93
- return "linux"
94
- when /sunos|solaris/i
95
- # Solaris
96
- return "solaris"
97
- when /darwin/i
98
- #MAC OS X
99
- return "mac"
100
- else
101
- # whatever
102
- return "Other"
103
- end
84
+ $old_win=nil
85
+
86
+ # Method to switch to new window
87
+ def switch_to_new_window
88
+ $old_win = $driver.window_handle
89
+ $driver.switch_to.window($driver.window_handles[1])
104
90
  end
105
91
 
92
+ # Method to switch to old window
106
93
 
94
+ def switch_to_old_window
95
+ $driver.switch_to.window($old_win)
96
+ end
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
2
  require "selenium-webdriver"
3
+ require 'chunky_png'
4
+ require 'open-uri'
3
5
  require 'rbconfig'
4
6
  include RbConfig
5
7
 
@@ -31,6 +31,14 @@ Then(/^I refresh page$/) do
31
31
  $driver.navigate.refresh
32
32
  end
33
33
 
34
+ Then(/^I switch to new window$/) do
35
+ switch_to_new_window
36
+ end
37
+
38
+ Then(/^I switch to previous window$/) do
39
+ switch_to_old_window
40
+ end
41
+
34
42
  #steps to scroll to element
35
43
  Then(/^I scroll to element having (.+) "(.*?)"$/) do |type, access_name|
36
44
  validate_locator type
@@ -7,14 +7,14 @@ end
7
7
 
8
8
  # wait for specific element to display for specific period of time
9
9
 
10
- Then(/^I wait (\d+) seconds for element to display having (.+) "(.*?)"$/) do |duration, type, access_name|
10
+ Then(/^I wait (\d+) seconds for element having (.+) "(.*?)" to display$/) do |duration, type, access_name|
11
11
  validate_locator type
12
12
  wait_for_element_to_display(type,access_name,duration)
13
13
  end
14
14
 
15
15
  # wait for specific element to enable for specific period of time
16
16
 
17
- Then(/^I wait (\d+) seconds for element to enable having (.+) "(.*?)"$/) do |duration, type, access_name|
17
+ Then(/^I wait (\d+) seconds for element having (.+) "(.*?)" to enable$/) do |duration, type, access_name|
18
18
  validate_locator type
19
19
  wait_for_element_to_enable(type,access_name,duration)
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module Selenium
2
2
  module Cucumber
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,40 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-24 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: cucumber
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: selenium-webdriver
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
12
+ date: 2014-08-10 00:00:00.000000000 Z
13
+ dependencies: []
46
14
  description: ! "Selenium-cucumber is a behavior driven development (BDD) approach
47
15
  to write automation test script to test web applications.\n It
48
16
  enables you to write and execute automated acceptance tests of web apps."
@@ -52,16 +20,11 @@ executables:
52
20
  extensions: []
53
21
  extra_rdoc_files: []
54
22
  files:
55
- - lib/selenium-cucumber.rb
56
23
  - lib/selenium-cucumber/assertion_steps.rb
57
24
  - lib/selenium-cucumber/click_elements_steps.rb
58
25
  - lib/selenium-cucumber/configuration_steps.rb
59
26
  - lib/selenium-cucumber/input_steps.rb
60
27
  - lib/selenium-cucumber/javascript_handling_steps.rb
61
- - lib/selenium-cucumber/navigation_steps.rb
62
- - lib/selenium-cucumber/progress_steps.rb
63
- - lib/selenium-cucumber/screenshot_steps.rb
64
- - lib/selenium-cucumber/version.rb
65
28
  - lib/selenium-cucumber/methods/assertion_methods.rb
66
29
  - lib/selenium-cucumber/methods/click_elements_methods.rb
67
30
  - lib/selenium-cucumber/methods/configuration_methods.rb
@@ -72,17 +35,36 @@ files:
72
35
  - lib/selenium-cucumber/methods/progress_methods.rb
73
36
  - lib/selenium-cucumber/methods/required_files.rb
74
37
  - lib/selenium-cucumber/methods/screenshot_methods.rb
38
+ - lib/selenium-cucumber/navigation_steps.rb
39
+ - lib/selenium-cucumber/progress_steps.rb
40
+ - lib/selenium-cucumber/screenshot_steps.rb
41
+ - lib/selenium-cucumber/version.rb
42
+ - lib/selenium-cucumber.rb
75
43
  - bin/generate.rb
76
44
  - bin/helper.rb
77
- - features-skeleton/my_first.feature
78
- - features-skeleton/step_definitions/custom_steps.rb
79
- - features-skeleton/support/env.rb
80
- - features-skeleton/support/hooks.rb
45
+ - bin/selenium-cucumber
81
46
  - doc/canned_steps.md
82
47
  - doc/installation.md
83
48
  - doc/selenium-cucumber-API.md
84
49
  - doc/selenium-cucumber-help.md
85
- - bin/selenium-cucumber
50
+ - features-skeleton/my_first.feature
51
+ - features-skeleton/step_definitions/custom_steps.rb
52
+ - features-skeleton/support/env.rb
53
+ - features-skeleton/support/hooks.rb
54
+ - Example/features/assertion_steps_Ex.feature
55
+ - Example/features/click_steps_Ex.feature
56
+ - Example/features/configuration_step_Ex.feature
57
+ - Example/features/input_steps_Ex.feature
58
+ - Example/features/javascript_steps_Ex.feature
59
+ - Example/features/navigation_steps_Ex.feature
60
+ - Example/features/new.feature
61
+ - Example/features/progress_step_Ex.feature
62
+ - Example/features/screenshot_step_Ex.feature
63
+ - Example/features/step_definitions/custom_steps.rb
64
+ - Example/features/support/env.rb
65
+ - Example/features/support/hooks.rb
66
+ - Example/run_features.rb
67
+ - Example/test_page.html
86
68
  homepage: http://seleniumcucumber.wordpress.com/
87
69
  licenses:
88
70
  - MIT