applenium 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d3dc4e8df54956afc6d658fbe776f95cf9381c5a
4
+ data.tar.gz: 549a3bc49b447216271d104fcd7a5232b410f82f
5
+ SHA512:
6
+ metadata.gz: 0407036870e8e5f653284c6683424462bd54ef5ae4246ede006b7e020a86e36f89af673cb8d3c58b0cc16812663a272da7faee373a0c95a6f0bafeb1f8f2b8a8
7
+ data.tar.gz: 50cb4661cd9058e37b526bd54d069310f34a700cda8faf4e41c5d435bbcd26c7830cb705cd6aec1781903e2907ea7c44785ecf60c8e5da7b498ef00bd91efcec
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative 'helper.rb'
4
+ require_relative 'generate.rb'
5
+ require 'applenium/version'
6
+
7
+ @features_dir = File.join(FileUtils.pwd, "features")
8
+ @support_dir = File.join(@features_dir, "support")
9
+ @support_dir = File.join(@features_dir, "expected_images")
10
+ @support_dir = File.join(@features_dir, "actual_images")
11
+ @support_dir = File.join(@features_dir, "image_difference")
12
+ @support_dir = File.join(@features_dir, "screenshots")
13
+ @source_dir = File.join(File.dirname(__FILE__), '..', 'template')
14
+
15
+ if (ARGV.length == 0)
16
+ print_usage
17
+ else
18
+ cmd = ARGV.shift
19
+
20
+ if cmd == "help"
21
+ print_help
22
+ elsif cmd == "gen"
23
+ applenium_template
24
+ elsif cmd == "version"
25
+ puts Applenium::VERSION
26
+ else
27
+ print_usage
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+
2
+ def applenium_template
3
+ if File.exists?(@features_dir)
4
+ puts "A features directory already exists. Stopping..."
5
+ exit 1
6
+ end
7
+ msg("Question") do
8
+ puts "I'm about to create a subdirectory called features."
9
+ puts "features will contain all your project tests."
10
+ puts "Please hit return to confirm that's what you want."
11
+ end
12
+ exit 2 unless STDIN.gets.chomp == ''
13
+
14
+ FileUtils.cp_r(@source_dir, @features_dir)
15
+
16
+ msg("Info") do
17
+ puts "features subdirectory created. \n"
18
+ end
19
+
20
+ end
@@ -0,0 +1,51 @@
1
+ require 'tempfile'
2
+ require 'json'
3
+ require "rubygems"
4
+
5
+ def msg(title, &block)
6
+ puts "\n" + "-"*10 + title + "-"*10
7
+ block.call
8
+ puts "-"*10 + "-------" + "-"*10 + "\n"
9
+ end
10
+
11
+ def print_usage
12
+ puts <<EOF
13
+
14
+ Usage: applenium <command-name> [parameters] [options]
15
+
16
+ <command-name> can be one of
17
+ help
18
+ prints more detailed help information.
19
+ gen
20
+ generate a features folder structure.
21
+ version
22
+ prints the gem version
23
+
24
+ <options> can be
25
+ -v, --verbose Turns on verbose logging
26
+ EOF
27
+ end
28
+
29
+ def print_help
30
+ puts <<EOF
31
+
32
+ Usage: applenium <command-name> [parameters] [options]
33
+
34
+ <command-name> can be one of
35
+ help
36
+ gen
37
+ version
38
+
39
+ Commands:
40
+ help : prints more detailed help information.
41
+
42
+ gen : creates a skeleton features dir. This is usually used once when
43
+ setting up selnium-cucumber to ensure that the features folder contains
44
+ the right step definitions and environment to run with cucumber.
45
+
46
+ version : prints the gem version
47
+
48
+ <Options>
49
+ -v, --verbose Turns on verbose logging
50
+ EOF
51
+ end
@@ -0,0 +1 @@
1
+ Dir[File.dirname(__FILE__) + '/applenium/*.rb'].each { |file| require file }
@@ -0,0 +1,14 @@
1
+ require_relative 'methods/web_methods'
2
+
3
+ Given(/^I am on "([^\"]*)"$/)do |link|
4
+ visit(link)
5
+ end
6
+
7
+ When(/^I click on element having (.+) "(.*?)"$/) do |type, access_name|
8
+ validate_locator type
9
+ click(type, access_name)
10
+ end
11
+
12
+ Then(/^link having text "(.*?)" should\s*((?:not)?)\s+be present$/) do |access_name, present|
13
+ check_element_on_page('link', access_name, present.empty?)
14
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'selenium-webdriver'
3
+ require 'chunky_png'
4
+ require 'open-uri'
5
+ require 'rbconfig'
6
+ require 'appium_lib'
7
+ include RbConfig
8
+
9
+ require_relative 'misc_methods'
10
+ require_relative 'error_handling_methods'
File without changes
@@ -0,0 +1,3 @@
1
+ module Applenium
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,7 @@
1
+ Feature: Test feature
2
+
3
+ Scenario: Test Lazycuke
4
+
5
+ Given I am on "www.google.com"
6
+ When I fill in "q" with "shashi"
7
+ Then I should see "Sign in"
@@ -0,0 +1 @@
1
+ require 'applenium'
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'applenium'
3
+
4
+ $browser_type = ENV['BROWSER'] || 'ff'
5
+ $platform = ENV['PLATFORM'] || 'desktop'
6
+ $os_version = ENV['OS_VERSION']
7
+ $device_name = ENV['DEVICE_NAME']
8
+ $udid = ENV['UDID']
9
+ $app_path = ENV['APP_PATH']
10
+
11
+ validate_parameters $platform, $browser_type, $app_path
12
+
13
+ if $platform == 'android' or $platform == 'iOS'
14
+
15
+ if $browser_type == 'native'
16
+ $browser_type = "Browser"
17
+ end
18
+
19
+ if $platform == 'android'
20
+ $device_name, $os_version = get_device_info
21
+ end
22
+
23
+ desired_caps = {
24
+ caps: {
25
+ platformName: $platform,
26
+ browserName: $browser_type,
27
+ versionNumber: $os_version,
28
+ deviceName: $device_name,
29
+ udid: $udid,
30
+ app: ".//#{$app_path}"
31
+ },
32
+ }
33
+
34
+ begin
35
+ $driver = Appium::Driver.new(desired_caps).start_driver
36
+ rescue Exception => e
37
+ puts e.message
38
+ Process.exit(0)
39
+ end
40
+ else
41
+ begin
42
+ $driver = Selenium::WebDriver.for(:"#{$browser_type}")
43
+ $driver.manage().window().maximize()
44
+ rescue Exception => e
45
+ puts e.message
46
+ Process.exit(0)
47
+ end
48
+ end
@@ -0,0 +1,38 @@
1
+ #Cucumber provides a number of hooks which allow us to run blocks at various points in the Cucumber test cycle
2
+
3
+ Before do
4
+ # Do something before each scenario.
5
+ end
6
+
7
+ Before do |scenario|
8
+ # The +scenario+ argument is optional, but if you use it, you can get the title,
9
+ # description, or name (title + description) of the scenario that is about to be
10
+ # executed.
11
+ end
12
+
13
+ After do
14
+ # Do something after each scenario.
15
+ end
16
+
17
+ After do |scenario|
18
+ # Do something after each scenario.
19
+ # The +scenario+ argument is optional, but
20
+ # if you use it, you can inspect status with
21
+ # the #failed?, #passed? and #exception methods.
22
+
23
+ if(scenario.failed?)
24
+ #Do something if scenario fails.
25
+ end
26
+ end
27
+
28
+ #Tagged hooks
29
+
30
+ Before('@Ex_tag1, @Ex_tag2') do
31
+ # This will only run before scenarios tagged
32
+ # with @cucumis OR @sativus.
33
+ end
34
+
35
+ AfterStep('@Ex_tag1, @Ex_tag2') do
36
+ # This will only run after steps within scenarios tagged
37
+ # with @cucumis AND @sativus.
38
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: applenium
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Shashikant86
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cucumber
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 1.3.18
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 1.3.18
33
+ - !ruby/object:Gem::Dependency
34
+ name: selenium-webdriver
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: 2.44.0
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: 2.41.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: 2.44.0
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: 2.41.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: appium_lib
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: 4.1.0
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 4.0.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 4.1.0
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: 4.0.0
73
+ description: Mobile and Web apps automation framework using Appium, Selenium and Cucumber
74
+ email: shashikant.jagtap@aol.co.uk
75
+ executables:
76
+ - applenium
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - bin/applenium
81
+ - bin/generate.rb
82
+ - bin/helper.rb
83
+ - lib/applenium.rb
84
+ - lib/applenium/applenium_steps.rb
85
+ - lib/applenium/methods/required_files.rb
86
+ - lib/applenium/methods/web_methods.rb
87
+ - lib/applenium/version.rb
88
+ - template/my_first.feature
89
+ - template/step_definitions/custom_steps.rb
90
+ - template/support/env.rb
91
+ - template/support/hooks.rb
92
+ homepage: ''
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message: Thank you for installing applenium gem.
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: 1.9.3
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.4.6
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Appium and Selenium used with Ruby Cucumber
116
+ test_files: []