Ifd_Mobile 0.1.9 → 1.0.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5fe9232d619453c5d1d78e421a04fb8e26483ad4
4
+ data.tar.gz: 485f9bbada7d5fa4f2a8ecbc7761b6d89fa9aca2
5
+ SHA512:
6
+ metadata.gz: 3777b1e07bf32da2bbda0d16d3b2f70bcb0eafcc372dc49b4bd64a64cc3ab690cd45acdcf6a083b45955922aed6a5e71d259e5bbcde529531bf569861af05e75
7
+ data.tar.gz: e24c9ba7839916cedde1f4fefdd904f346fb968b44c98cd1d947ad82e104b59f0d94dd1847938f48bb2f7c741c82a5f704e050f046bd51eb44ea706b96ae3a23
data/bin/Ifd_Mobile CHANGED
@@ -1,25 +1,25 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative 'helper.rb'
4
- require_relative 'generate.rb'
5
- require 'Ifd_Mobile/version'
6
-
7
- @features_dir = File.join(FileUtils.pwd, "project")
8
- @source_dir = File.join(File.dirname(__FILE__), '..', 'project')
9
-
10
- if (ARGV.length == 0)
11
- print_usage
12
- else
13
- cmd = ARGV.shift
14
-
15
- if cmd == "help"
16
- print_help
17
- elsif cmd == "gen"
18
- ifd_mobile_scaffold
19
- elsif cmd == "version"
20
- puts Ifd::Mobile::VERSION
21
- else
22
- print_usage
23
- end
24
- end
25
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative 'helper.rb'
4
+ require_relative 'generate.rb'
5
+ require 'Ifd_Mobile/version'
6
+
7
+ @features_dir = File.join(FileUtils.pwd, "project")
8
+ @source_dir = File.join(File.dirname(__FILE__), '..', 'project')
9
+
10
+ if (ARGV.length == 0)
11
+ print_usage
12
+ else
13
+ cmd = ARGV.shift
14
+
15
+ if cmd == "help"
16
+ print_help
17
+ elsif cmd == "gen"
18
+ ifd_mobile_scaffold
19
+ elsif cmd == "version"
20
+ puts Ifd::Mobile::VERSION
21
+ else
22
+ print_usage
23
+ end
24
+ end
25
+
data/bin/generate.rb CHANGED
@@ -1,20 +1,20 @@
1
-
2
- def ifd_mobile_scaffold
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
1
+
2
+ def ifd_mobile_scaffold
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
data/bin/helper.rb CHANGED
@@ -1,51 +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: Ifd_Mobile <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: Ifd_Mobile <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 features dir. This is usually used once when
43
- setting up ifd-mobile 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
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: Ifd_Mobile <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: Ifd_Mobile <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 features dir. This is usually used once when
43
+ setting up ifd-mobile 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
51
  end
data/lib/Ifd_Mobile.rb CHANGED
@@ -1 +1 @@
1
- Dir[File.dirname(__FILE__) + '/Ifd_Mobile/*.rb'].each { |file| require file }
1
+ Dir[File.dirname(__FILE__) + '/Ifd_Mobile/*.rb'].each { |file| require file }
@@ -23,12 +23,6 @@ Then /^I verify property "(.*)" with "(.*)" has( | not)? value "(.*)"$/ do |obje
23
23
  execute_checkproperty(object, property, negate, value)
24
24
  end
25
25
 
26
- Then /^I verify property "(.*)" with "(.*)" contain( | not)? value "(.*)"$/ do |object, property, negate, value|
27
- sleep(0.5)
28
- value = var_collect(value)
29
- execute_checkpropertyrelative(object, property, negate, value)
30
- end
31
-
32
26
  Given /^I click on element with x: "(.*)", y: "(.*)"$/ do |x,y|
33
27
  click_by_coordinate x,y
34
28
  end
@@ -0,0 +1,28 @@
1
+ require 'mysql2'
2
+ require 'tiny_tds'
3
+
4
+ class IFD_Connections
5
+ # Open the MYSQL connection to specific schema
6
+ def self.get_mysql_db_connection(schema)
7
+ begin
8
+ # puts ("Connecting to database...");
9
+ data_source_schema = schema.downcase
10
+ return Mysql2::Client.new(host: $data_source_url, username: $data_source_username, password: $data_source_password,database:data_source_schema);
11
+ rescue Exception => e
12
+ raise "Cannot connect to database [username: %s; password: %s, dbUrl: %s, dbName: %s] with error %s" %
13
+ [$data_source_username, $data_source_password, $data_source_url,data_source_schema, e.message]
14
+ end
15
+ end
16
+
17
+ # Open the SQL Server connection to specific schema
18
+ def self.get_sql_server_db_connection(schema)
19
+ begin
20
+ # puts ("Connecting to database...");
21
+ data_source_schema = schema.downcase
22
+ return TinyTds::Client.new(dataserver: $data_source_url, username: $data_source_username, password: $data_source_password, database:data_source_schema);
23
+ rescue Exception => e
24
+ raise "Cannot connect to database [username: %s; password: %s, dbUrl: %s, dbName: %s] with error %s" %
25
+ [$data_source_username, $data_source_password, $data_source_url,data_source_schema, e.message]
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,3 @@
1
- $_RP_OBJECT = {}
2
-
3
1
  def call_step str_step
4
2
  put_log "\n-=> call step: #{str_step}"
5
3
  step %{#{str_step}}
@@ -10,7 +8,7 @@ def put_log str
10
8
  end
11
9
 
12
10
  def find_object string_object
13
- # startTime = Time.new.to_i
11
+ object = YAML.load_file("#{File.expand_path(File.dirname(__FILE__) + '/..')}/step_definitions/repositories/project_object.yml")
14
12
  string_object = string_object.gsub(/"/, "'")
15
13
  # puts string_object
16
14
  locator_matching = /(.*?)(\{.*?\})/.match(string_object)
@@ -22,39 +20,18 @@ def find_object string_object
22
20
  dyn_pros[k.to_s.upcase] = v
23
21
  }
24
22
  end
25
- hash_object = $_RP_OBJECT[string_object]
23
+ hash_object = object[string_object]
26
24
  puts hash_object
27
25
  if hash_object == nil
28
26
  put_log ">>> OBJECT NAME MAYBE NOT FOUND!!!"
29
27
  true.should eq false
30
- end
31
- attribute = {}
32
- if hash_object != nil
33
- hash_object.each { |k, v|
34
- k = k.to_s
35
- if k =~ /ph_/i
36
- if dyn_pros[k] != nil
37
- # Assign place holder value to place holder property, also remove prefix ph_ from property key,
38
- # also remove this pl from dyn_pros <= should be consider to continue transfer into inner object in relation
39
- if v =~ /<ph_value>/i
40
- attribute[k[3..k.size-1]] = v.gsub(/<ph_value>/i, dyn_pros[k])
41
- else
42
- attribute[k[3..k.size-1]] = dyn_pros[k]
43
- end
44
- dyn_pros.delete(k)
45
- end
46
- else
47
- attribute[k.to_s] = v
48
- end
28
+ else
29
+ hash_object.each { |key, value|
30
+ $element_tag = key
31
+ $element_value = value
49
32
  }
50
33
  end
51
- # put_log string_object
52
- # put_log "\nattribute: #{attribute}"
53
34
 
54
- attribute.each { |key, value|
55
- $element_tag = key
56
- $element_value = value
57
- }
58
35
  return selenium.find_element($element_tag, $element_value)
59
36
  end
60
37
 
@@ -131,48 +108,6 @@ def execute_checkproperty element, property, negate, value
131
108
  end
132
109
  end
133
110
 
134
- def execute_checkpropertyrelative element, property, negate, value
135
- found_element = find_object element
136
- check = false
137
- if found_element == nil and value == ""
138
- check = true
139
- expect(check).to eq true
140
- else
141
- put_log "\n*** Execute_CheckProperty: finish to found element"
142
- if found_element != nil
143
- if property.upcase == 'VALUE'
144
- actual_value = found_element.attribute("value")
145
- elsif property.upcase == 'NAME'
146
- actual_value = found_element.attribute("name")
147
- elsif property.upcase == 'LABEL'
148
- actual_value = found_element.attribute("label")
149
- elsif property.upcase == 'TYPE'
150
- actual_value = found_element.attribute("type")
151
- elsif property.upcase == 'ENABLE'
152
- actual_value = found_element.attribute("enable")
153
- else
154
- actual_value = found_element.attribute("#{property}")
155
- end
156
- if actual_value == nil
157
- actual_value = ''
158
- end
159
- else
160
- put_log "ERROR: *** Not found object: #{element}"
161
- end
162
-
163
- if IFD_Assertion.assert_string_contain(actual_value, value)
164
- check = true
165
- end
166
-
167
- put_log "\n#{property} :: Actual Result Is '#{actual_value}' -- Expected Result Is '#{value}'"
168
-
169
- if negate == " not"
170
- expect(check).not_to eql true
171
- elsif expect(check).to eq true
172
- end
173
- end
174
- end
175
-
176
111
  def click_by_coordinate x, y
177
112
  selenium.execute_script 'mobile: tap', :x => x, :y => y
178
113
  end
@@ -0,0 +1,25 @@
1
+ class DatabaseMethods
2
+ def self.execute_select (schema,sql)
3
+ case $db_type.to_sym
4
+ when :sql_server then
5
+ conn = IFD_Connections.get_sql_server_db_connection(schema)
6
+ conn.execute sql
7
+ when :mysql then
8
+ conn = IFD_Connections.get_mysql_db_connection(schema)
9
+ conn.query sql
10
+ else
11
+ raise "*** ERROR: schema type (#{$db_type}) is not supported (SQL SERVER, MY SQL)."
12
+ end
13
+ end
14
+
15
+ def self.close_connection (schema)
16
+ case $db_type.to_sym
17
+ when :sql_server then
18
+ conn = IFD_Connections.get_sql_server_db_connection(schema)
19
+ conn.close
20
+ when :mysql then
21
+ conn = IFD_Connections.get_mysql_db_connection(schema)
22
+ conn.close
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,53 @@
1
+ require_relative 'methods/required_files'
2
+ #====================================
3
+ # INTERACTION STEPS
4
+ #====================================
5
+ # Step used to execute a SQL script on a specific schema
6
+ And /^I run sql script "([^\"]*)" on "([^\"]*)" schema$/ do |script, schema|
7
+ begin
8
+ sql = "#{script}"
9
+ DatabaseMethods.execute_select(schema, sql)
10
+ DatabaseMethods.close_connection(schema)
11
+ ensure
12
+ end
13
+ end
14
+ # Step used to execute SQL script from SQL file on specific schema
15
+ Given /^I run sql script from file "([^\"]*)" on "([^\"]*)" schema$/ do |sql_script, schema|
16
+ if sql_script != nil and sql_script != ""
17
+ begin
18
+ File.readlines($sql_dir + sql_script).each do |line|
19
+ if line.nil? || line =~ /^\s*\n*--/
20
+ # puts "\nSQL: " + line;
21
+ next;
22
+ end
23
+ line = line.strip();
24
+ line = line[0..-2];
25
+ #puts "\nSQL: " + line;
26
+ DatabaseMethods.execute_select(schema, line)
27
+ sleep(1);
28
+ end
29
+ DatabaseMethods.close_connection(schema)
30
+ end
31
+ end
32
+ end
33
+
34
+ # Step used to check if data exists in database or not with condition in file
35
+ Then /^I should ( not)? see data in schema "(.*)" database with SQL query in file "(.*)"$/ do |negative, schema, file|
36
+ sql = File.read($sql_dir + file)
37
+ filepath = ($sql_dir + file)
38
+ if File.exist?(filepath)
39
+ begin
40
+ rs = DatabaseMethods.execute_select(schema, sql)
41
+ obj_array = Array.new
42
+ rs.each { |row|
43
+ row.each_pair { |col, value|
44
+ assert(false) if negative.nil? && value == 0 || !negative.nil? && value == 1
45
+ }
46
+ }
47
+ ensure
48
+ DatabaseMethods.close_connection(schema)
49
+ end
50
+ else
51
+ raise "*** ERROR: Please check #{filepath} exists."
52
+ end
53
+ end
@@ -1,18 +1,21 @@
1
- require 'rubygems'
2
- require 'selenium-webdriver'
3
- require 'open-uri'
4
- require 'rbconfig'
5
- require 'appium_lib'
6
- require 'rubygems'
7
- require 'yaml'
8
- require 'cucumber'
9
- require 'rack/utf8_sanitizer'
10
- require 'net/https'
11
- require 'rspec/expectations'
12
- include RbConfig
13
-
14
- require_relative 'core'
15
- require_relative 'IFD_Assertion'
16
- require_relative 'lib_var'
17
-
18
-
1
+ require 'rubygems'
2
+ require 'selenium-webdriver'
3
+ require 'open-uri'
4
+ require 'rbconfig'
5
+ require 'appium_lib'
6
+ require 'rubygems'
7
+ require 'yaml'
8
+ require 'cucumber'
9
+ require 'rack/utf8_sanitizer'
10
+ require 'net/https'
11
+ require 'rspec/expectations'
12
+ include RbConfig
13
+
14
+ require_relative 'core'
15
+ require_relative 'IFD_Assertion'
16
+ require_relative 'lib_var'
17
+ require_relative 'IFD_Assertion'
18
+ require_relative 'IFD_Connection'
19
+ require_relative 'lib_schema_data_steps'
20
+
21
+
@@ -1,5 +1,5 @@
1
1
  module Ifd
2
2
  module Mobile
3
- VERSION = '0.1.9'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
data/lib/LICENSE CHANGED
@@ -1,3 +1,3 @@
1
- Infodation Automation
2
- Copyright (c) Anh Pham. All rights reserved.
1
+ Infodation Automation
2
+ Copyright (c) Anh Pham. All rights reserved.
3
3
  You must not remove this notice, or any other, from this software.
data/project/Gemfile CHANGED
@@ -7,4 +7,6 @@ gem "cucumber"
7
7
  gem "rspec-expectations"
8
8
  gem "appium_lib"
9
9
  gem "rack-utf8_sanitizer"
10
+ gem "mysql2","> 0.3.18"
11
+ gem "tiny_tds", ">0.6.3.rc2"
10
12
  gem "Ifd_Mobile"
data/project/Gemfile.lock CHANGED
@@ -1,182 +1,182 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- actionmailer (4.2.4)
5
- actionpack (= 4.2.4)
6
- actionview (= 4.2.4)
7
- activejob (= 4.2.4)
8
- mail (~> 2.5, >= 2.5.4)
9
- rails-dom-testing (~> 1.0, >= 1.0.5)
10
- actionpack (4.2.4)
11
- actionview (= 4.2.4)
12
- activesupport (= 4.2.4)
13
- rack (~> 1.6)
14
- rack-test (~> 0.6.2)
15
- rails-dom-testing (~> 1.0, >= 1.0.5)
16
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
- actionview (4.2.4)
18
- activesupport (= 4.2.4)
19
- builder (~> 3.1)
20
- erubis (~> 2.7.0)
21
- rails-dom-testing (~> 1.0, >= 1.0.5)
22
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- activejob (4.2.4)
24
- activesupport (= 4.2.4)
25
- globalid (>= 0.3.0)
26
- activemodel (4.2.4)
27
- activesupport (= 4.2.4)
28
- builder (~> 3.1)
29
- activerecord (4.2.4)
30
- activemodel (= 4.2.4)
31
- activesupport (= 4.2.4)
32
- arel (~> 6.0)
33
- activesupport (4.2.4)
34
- i18n (~> 0.7)
35
- json (~> 1.7, >= 1.7.7)
36
- minitest (~> 5.1)
37
- thread_safe (~> 0.3, >= 0.3.4)
38
- tzinfo (~> 1.1)
39
- addressable (2.3.8)
40
- arel (6.0.3)
41
- builder (3.2.2)
42
- capybara (2.4.4)
43
- mime-types (>= 1.16)
44
- nokogiri (>= 1.3.3)
45
- rack (>= 1.0.0)
46
- rack-test (>= 0.5.4)
47
- xpath (~> 2.0)
48
- chromedriver2-helper (0.0.8)
49
- nokogiri
50
- csv-diff (0.3.0)
51
- diff-lcs (1.2.5)
52
- domain_name (0.5.25)
53
- unf (>= 0.0.5, < 1.0.0)
54
- email_spec (1.6.0)
55
- launchy (~> 2.1)
56
- mail (~> 2.2)
57
- erubis (2.7.0)
58
- ffi (1.9.10-x64-mingw32)
59
- gherkin (2.12.2)
60
- multi_json (~> 1.3)
61
- globalid (0.3.6)
62
- activesupport (>= 4.1.0)
63
- http-cookie (1.0.2)
64
- domain_name (~> 0.5)
65
- httparty (0.13.7)
66
- json (~> 1.8)
67
- multi_xml (>= 0.5.2)
68
- i18n (0.7.0)
69
- json (1.8.3)
70
- launchy (2.4.3)
71
- addressable (~> 2.3)
72
- loofah (2.0.3)
73
- nokogiri (>= 1.5.9)
74
- mail (2.6.3)
75
- mime-types (>= 1.16, < 3)
76
- mime-types (2.6.2)
77
- mini_portile (0.6.2)
78
- minitest (5.8.1)
79
- multi_json (1.11.2)
80
- multi_xml (0.5.5)
81
- mysql2 (0.3.18-x64-mingw32)
82
- netrc (0.10.3)
83
- nokogiri (1.6.6.2-x64-mingw32)
84
- mini_portile (~> 0.6.0)
85
- parallel (1.6.1)
86
- parallel_tests (1.9.0)
87
- parallel
88
- power_assert (0.2.4)
89
- rack (1.6.4)
90
- rack-test (0.6.3)
91
- rack (>= 1.0)
92
- rack-utf8_sanitizer (1.3.1)
93
- rack (~> 1.0)
94
- rails (4.2.4)
95
- actionmailer (= 4.2.4)
96
- actionpack (= 4.2.4)
97
- actionview (= 4.2.4)
98
- activejob (= 4.2.4)
99
- activemodel (= 4.2.4)
100
- activerecord (= 4.2.4)
101
- activesupport (= 4.2.4)
102
- bundler (>= 1.3.0, < 2.0)
103
- railties (= 4.2.4)
104
- sprockets-rails
105
- rails-deprecated_sanitizer (1.0.3)
106
- activesupport (>= 4.2.0.alpha)
107
- rails-dom-testing (1.0.7)
108
- activesupport (>= 4.2.0.beta, < 5.0)
109
- nokogiri (~> 1.6.0)
110
- rails-deprecated_sanitizer (>= 1.0.1)
111
- rails-html-sanitizer (1.0.2)
112
- loofah (~> 2.0)
113
- railties (4.2.4)
114
- actionpack (= 4.2.4)
115
- activesupport (= 4.2.4)
116
- rake (>= 0.8.7)
117
- thor (>= 0.18.1, < 2.0)
118
- rake (10.4.2)
119
- rautomation (0.17.0)
120
- ffi (~> 1.9.0)
121
- rest-client (1.8.0-x64-mingw32)
122
- ffi (~> 1.9)
123
- http-cookie (>= 1.0.2, < 2.0)
124
- mime-types (>= 1.16, < 3.0)
125
- netrc (~> 0.7)
126
- rspec (3.3.0)
127
- rspec-core (~> 3.3.0)
128
- rspec-expectations (~> 3.3.0)
129
- rspec-mocks (~> 3.3.0)
130
- rspec-core (3.3.2)
131
- rspec-support (~> 3.3.0)
132
- rspec-expectations (3.3.1)
133
- diff-lcs (>= 1.2.0, < 2.0)
134
- rspec-support (~> 3.3.0)
135
- rspec-mocks (3.3.2)
136
- diff-lcs (>= 1.2.0, < 2.0)
137
- rspec-support (~> 3.3.0)
138
- rspec-support (3.3.0)
139
- sprockets (3.4.0)
140
- rack (> 1, < 3)
141
- sprockets-rails (2.3.3)
142
- actionpack (>= 3.0)
143
- activesupport (>= 3.0)
144
- sprockets (>= 2.8, < 4.0)
145
- test-unit (3.1.5)
146
- power_assert
147
- thor (0.19.1)
148
- thread_safe (0.3.5)
149
- tiny_tds (0.6.2-x64-mingw32)
150
- tzinfo (1.2.2)
151
- thread_safe (~> 0.1)
152
- unf (0.1.4)
153
- unf_ext
154
- unf_ext (0.0.7.1-x64-mingw32)
155
- xpath (2.0.0)
156
- nokogiri (~> 1.3)
157
-
158
- PLATFORMS
159
- x64-mingw32
160
-
161
- DEPENDENCIES
162
- actionmailer (~> 4.2.3)
163
- capybara (~> 2.4.4)
164
- chromedriver2-helper
165
- csv-diff (~> 0.3.0)
166
- email_spec
167
- gherkin (~> 2.12.2)
168
- httparty (~> 0.13.5)
169
- json (= 1.8.3)
170
- mail
171
- mysql2 (= 0.3.18)
172
- parallel_tests
173
- rack-utf8_sanitizer
174
- rails
175
- rautomation (~> 0.17.0)
176
- rest-client (~> 1.8.0)
177
- rspec (~> 3.3.0)
178
- test-unit (~> 3.1.2)
179
- tiny_tds (~> 0.6.2)
180
-
181
- BUNDLED WITH
182
- 1.10.6
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (4.2.4)
5
+ actionpack (= 4.2.4)
6
+ actionview (= 4.2.4)
7
+ activejob (= 4.2.4)
8
+ mail (~> 2.5, >= 2.5.4)
9
+ rails-dom-testing (~> 1.0, >= 1.0.5)
10
+ actionpack (4.2.4)
11
+ actionview (= 4.2.4)
12
+ activesupport (= 4.2.4)
13
+ rack (~> 1.6)
14
+ rack-test (~> 0.6.2)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
+ actionview (4.2.4)
18
+ activesupport (= 4.2.4)
19
+ builder (~> 3.1)
20
+ erubis (~> 2.7.0)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ activejob (4.2.4)
24
+ activesupport (= 4.2.4)
25
+ globalid (>= 0.3.0)
26
+ activemodel (4.2.4)
27
+ activesupport (= 4.2.4)
28
+ builder (~> 3.1)
29
+ activerecord (4.2.4)
30
+ activemodel (= 4.2.4)
31
+ activesupport (= 4.2.4)
32
+ arel (~> 6.0)
33
+ activesupport (4.2.4)
34
+ i18n (~> 0.7)
35
+ json (~> 1.7, >= 1.7.7)
36
+ minitest (~> 5.1)
37
+ thread_safe (~> 0.3, >= 0.3.4)
38
+ tzinfo (~> 1.1)
39
+ addressable (2.3.8)
40
+ arel (6.0.3)
41
+ builder (3.2.2)
42
+ capybara (2.4.4)
43
+ mime-types (>= 1.16)
44
+ nokogiri (>= 1.3.3)
45
+ rack (>= 1.0.0)
46
+ rack-test (>= 0.5.4)
47
+ xpath (~> 2.0)
48
+ chromedriver2-helper (0.0.8)
49
+ nokogiri
50
+ csv-diff (0.3.0)
51
+ diff-lcs (1.2.5)
52
+ domain_name (0.5.25)
53
+ unf (>= 0.0.5, < 1.0.0)
54
+ email_spec (1.6.0)
55
+ launchy (~> 2.1)
56
+ mail (~> 2.2)
57
+ erubis (2.7.0)
58
+ ffi (1.9.10-x64-mingw32)
59
+ gherkin (2.12.2)
60
+ multi_json (~> 1.3)
61
+ globalid (0.3.6)
62
+ activesupport (>= 4.1.0)
63
+ http-cookie (1.0.2)
64
+ domain_name (~> 0.5)
65
+ httparty (0.13.7)
66
+ json (~> 1.8)
67
+ multi_xml (>= 0.5.2)
68
+ i18n (0.7.0)
69
+ json (1.8.3)
70
+ launchy (2.4.3)
71
+ addressable (~> 2.3)
72
+ loofah (2.0.3)
73
+ nokogiri (>= 1.5.9)
74
+ mail (2.6.3)
75
+ mime-types (>= 1.16, < 3)
76
+ mime-types (2.6.2)
77
+ mini_portile (0.6.2)
78
+ minitest (5.8.1)
79
+ multi_json (1.11.2)
80
+ multi_xml (0.5.5)
81
+ mysql2 (0.3.18-x64-mingw32)
82
+ netrc (0.10.3)
83
+ nokogiri (1.6.6.2-x64-mingw32)
84
+ mini_portile (~> 0.6.0)
85
+ parallel (1.6.1)
86
+ parallel_tests (1.9.0)
87
+ parallel
88
+ power_assert (0.2.4)
89
+ rack (1.6.4)
90
+ rack-test (0.6.3)
91
+ rack (>= 1.0)
92
+ rack-utf8_sanitizer (1.3.1)
93
+ rack (~> 1.0)
94
+ rails (4.2.4)
95
+ actionmailer (= 4.2.4)
96
+ actionpack (= 4.2.4)
97
+ actionview (= 4.2.4)
98
+ activejob (= 4.2.4)
99
+ activemodel (= 4.2.4)
100
+ activerecord (= 4.2.4)
101
+ activesupport (= 4.2.4)
102
+ bundler (>= 1.3.0, < 2.0)
103
+ railties (= 4.2.4)
104
+ sprockets-rails
105
+ rails-deprecated_sanitizer (1.0.3)
106
+ activesupport (>= 4.2.0.alpha)
107
+ rails-dom-testing (1.0.7)
108
+ activesupport (>= 4.2.0.beta, < 5.0)
109
+ nokogiri (~> 1.6.0)
110
+ rails-deprecated_sanitizer (>= 1.0.1)
111
+ rails-html-sanitizer (1.0.2)
112
+ loofah (~> 2.0)
113
+ railties (4.2.4)
114
+ actionpack (= 4.2.4)
115
+ activesupport (= 4.2.4)
116
+ rake (>= 0.8.7)
117
+ thor (>= 0.18.1, < 2.0)
118
+ rake (10.4.2)
119
+ rautomation (0.17.0)
120
+ ffi (~> 1.9.0)
121
+ rest-client (1.8.0-x64-mingw32)
122
+ ffi (~> 1.9)
123
+ http-cookie (>= 1.0.2, < 2.0)
124
+ mime-types (>= 1.16, < 3.0)
125
+ netrc (~> 0.7)
126
+ rspec (3.3.0)
127
+ rspec-core (~> 3.3.0)
128
+ rspec-expectations (~> 3.3.0)
129
+ rspec-mocks (~> 3.3.0)
130
+ rspec-core (3.3.2)
131
+ rspec-support (~> 3.3.0)
132
+ rspec-expectations (3.3.1)
133
+ diff-lcs (>= 1.2.0, < 2.0)
134
+ rspec-support (~> 3.3.0)
135
+ rspec-mocks (3.3.2)
136
+ diff-lcs (>= 1.2.0, < 2.0)
137
+ rspec-support (~> 3.3.0)
138
+ rspec-support (3.3.0)
139
+ sprockets (3.4.0)
140
+ rack (> 1, < 3)
141
+ sprockets-rails (2.3.3)
142
+ actionpack (>= 3.0)
143
+ activesupport (>= 3.0)
144
+ sprockets (>= 2.8, < 4.0)
145
+ test-unit (3.1.5)
146
+ power_assert
147
+ thor (0.19.1)
148
+ thread_safe (0.3.5)
149
+ tiny_tds (0.6.2-x64-mingw32)
150
+ tzinfo (1.2.2)
151
+ thread_safe (~> 0.1)
152
+ unf (0.1.4)
153
+ unf_ext
154
+ unf_ext (0.0.7.1-x64-mingw32)
155
+ xpath (2.0.0)
156
+ nokogiri (~> 1.3)
157
+
158
+ PLATFORMS
159
+ x64-mingw32
160
+
161
+ DEPENDENCIES
162
+ actionmailer (~> 4.2.3)
163
+ capybara (~> 2.4.4)
164
+ chromedriver2-helper
165
+ csv-diff (~> 0.3.0)
166
+ email_spec
167
+ gherkin (~> 2.12.2)
168
+ httparty (~> 0.13.5)
169
+ json (= 1.8.3)
170
+ mail
171
+ mysql2 (= 0.3.18)
172
+ parallel_tests
173
+ rack-utf8_sanitizer
174
+ rails
175
+ rautomation (~> 0.17.0)
176
+ rest-client (~> 1.8.0)
177
+ rspec (~> 3.3.0)
178
+ test-unit (~> 3.1.2)
179
+ tiny_tds (~> 0.6.2)
180
+
181
+ BUNDLED WITH
182
+ 1.10.6
@@ -0,0 +1,5 @@
1
+ Feature: Demo
2
+
3
+ Scenario: Demo
4
+ Given I have App running with Appium
5
+ * I click on Sign In button
@@ -1,3 +1,3 @@
1
- And /^I click on Sign In button$/ do
1
+ And /I click on Sign In button/ do
2
2
  step %{I click on element with x: "520", y: "1150"}
3
3
  end
@@ -0,0 +1,3 @@
1
+ Bedder_SignIn_username: {xpath: '//android.widget.EditText[1]'}
2
+ Bedder_SignIn_password: {xpath: '//android.widget.EditText[2]'}
3
+ Bedder_SignIn_Login_button: {xpath: '//android.view.View[@content-desc="Login"]'}
@@ -2,23 +2,20 @@ require 'rspec/expectations'
2
2
  require 'appium_lib'
3
3
  require 'cucumber/ast'
4
4
  require 'Ifd_Mobile'
5
- # Define global variables
6
5
  $current_dir = File.expand_path(File.dirname(__FILE__))
7
6
  $base_dir = File.expand_path(File.dirname(__FILE__) + '/../..')
8
- require "#{$current_dir}/project_env.rb"
9
7
 
10
- # Create a custom World class so we don't pollute `Object` with Appium methods
8
+ $_CONFIG = Hash.new
9
+ PROJECT_CONFIG = YAML.load_file("#{$current_dir}/project_config.yml")
10
+ $_CONFIG['Print Log'] = true
11
+ $_CONFIG['Wait Time'] = PROJECT_CONFIG["wait_time"]
12
+
13
+
11
14
  class AppiumWorld
12
15
  end
13
16
 
14
- case $_CONFIG['DeviceName'].upcase.to_sym
15
- when :IOS
16
- Appium::Driver.new({caps: capabilities_ios, appium_lib: {server_url: server_url}}).start_driver
17
- when :ANDROID
18
- Appium::Driver.new({caps: capabilities_android, appium_lib: {server_url: server_url}}).start_driver
19
- else
20
- raise "\nERROR: *** Invalid Device Name!. Please check the config from $_CONFIG['DeviceName'] = #{$_CONFIG['DeviceName']}"
21
- end
17
+ Appium::Driver.new({caps: PROJECT_CONFIG['capabilities'], appium_lib: {server_url: PROJECT_CONFIG["server_url"]}}).start_driver
18
+
22
19
 
23
20
  Appium.promote_appium_methods AppiumWorld
24
21
 
@@ -28,10 +25,4 @@ end
28
25
 
29
26
  def selenium
30
27
  return $driver
31
- end
32
-
33
- # Before { $driver.start_driver }
34
- #
35
- # After do
36
- # $driver.driver_quit
37
- # end
28
+ end
@@ -0,0 +1,8 @@
1
+ capabilities:
2
+ platformName: android
3
+ deviceName: 192.168.56.101:5555
4
+ platformVersion: 4.4.4
5
+ app: C:/Users/anhpham2710/Desktop/project/project/apps/android-2016.apk
6
+
7
+ server_url: http://192.168.2.158:1234/wd/hub
8
+ wait_time: 2
metadata CHANGED
@@ -1,74 +1,67 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Ifd_Mobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Anh Pham
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-01-13 00:00:00.000000000 Z
11
+ date: 2016-04-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: cucumber
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>'
17
+ - - '>'
20
18
  - !ruby/object:Gem::Version
21
19
  version: 2.0.0
22
- - - ! '>='
20
+ - - '>='
23
21
  - !ruby/object:Gem::Version
24
22
  version: 1.3.18
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>'
27
+ - - '>'
31
28
  - !ruby/object:Gem::Version
32
29
  version: 2.0.0
33
- - - ! '>='
30
+ - - '>='
34
31
  - !ruby/object:Gem::Version
35
32
  version: 1.3.18
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: selenium-webdriver
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
- - - ! '>'
37
+ - - '>'
42
38
  - !ruby/object:Gem::Version
43
39
  version: 2.46.2
44
40
  type: :runtime
45
41
  prerelease: false
46
42
  version_requirements: !ruby/object:Gem::Requirement
47
- none: false
48
43
  requirements:
49
- - - ! '>'
44
+ - - '>'
50
45
  - !ruby/object:Gem::Version
51
46
  version: 2.46.2
52
47
  - !ruby/object:Gem::Dependency
53
48
  name: appium_lib
54
49
  requirement: !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
- - - ! '>'
51
+ - - '>'
58
52
  - !ruby/object:Gem::Version
59
53
  version: 7.0.0
60
- - - ! '>='
54
+ - - '>='
61
55
  - !ruby/object:Gem::Version
62
56
  version: 7.0.0
63
57
  type: :runtime
64
58
  prerelease: false
65
59
  version_requirements: !ruby/object:Gem::Requirement
66
- none: false
67
60
  requirements:
68
- - - ! '>'
61
+ - - '>'
69
62
  - !ruby/object:Gem::Version
70
63
  version: 7.0.0
71
- - - ! '>='
64
+ - - '>='
72
65
  - !ruby/object:Gem::Version
73
66
  version: 7.0.0
74
67
  description: Behavior driven development (BDD) approach to write automation test script
@@ -81,7 +74,10 @@ extra_rdoc_files: []
81
74
  files:
82
75
  - lib/Ifd_Mobile/lib_steps.rb
83
76
  - lib/Ifd_Mobile/methods/core.rb
77
+ - lib/Ifd_Mobile/methods/database_methods.rb
84
78
  - lib/Ifd_Mobile/methods/IFD_Assertion.rb
79
+ - lib/Ifd_Mobile/methods/IFD_Connection.rb
80
+ - lib/Ifd_Mobile/methods/lib_schema_data_steps.rb
85
81
  - lib/Ifd_Mobile/methods/lib_var.rb
86
82
  - lib/Ifd_Mobile/methods/required_files.rb
87
83
  - lib/Ifd_Mobile/version.rb
@@ -122,41 +118,37 @@ files:
122
118
  - project/apps/TestApp/TestApp.xcodeproj/project.xcworkspace/xcuserdata/anhpham.xcuserdatad/UserInterfaceState.xcuserstate
123
119
  - project/apps/TestApp/TestApp.xcodeproj/xcuserdata/anhpham.xcuserdatad/xcschemes/TestApp.xcscheme
124
120
  - project/apps/TestApp/TestApp.xcodeproj/xcuserdata/anhpham.xcuserdatad/xcschemes/xcschememanagement.plist
125
- - project/features/android/Android_test1.feature
126
- - project/features/android/Android_test2.feature
127
- - project/features/iOS/iOS_test.feature
128
- - project/features/step_definitions/lib_steps/PolyClaim_homepage.rb
129
- - project/features/step_definitions/lib_steps/PolyClaim_loginpage.rb
130
- - project/features/step_definitions/repositories/android_ob_test.rb
131
- - project/features/step_definitions/repositories/ios_ob_test.rb
121
+ - project/features/step_definitions/lib_steps/step_demo.rb
122
+ - project/features/step_definitions/repositories/project_object.yml
132
123
  - project/features/support/env.rb
133
124
  - project/features/support/hooks.rb
134
- - project/features/support/project_env.rb
125
+ - project/features/support/project_config.yml
126
+ - project/features/TestSuite/login.feature
135
127
  - project/Gemfile
136
128
  - project/Gemfile.lock
137
129
  homepage: https://rubygems.org/gems/ifd_mobile
138
130
  licenses:
139
131
  - MIT
132
+ metadata: {}
140
133
  post_install_message: Thank you for installing Infodation Mobile gem.
141
134
  rdoc_options: []
142
135
  require_paths:
143
136
  - lib
144
137
  required_ruby_version: !ruby/object:Gem::Requirement
145
- none: false
146
138
  requirements:
147
- - - ! '>='
139
+ - - '>='
148
140
  - !ruby/object:Gem::Version
149
141
  version: 1.9.3
150
142
  required_rubygems_version: !ruby/object:Gem::Requirement
151
- none: false
152
143
  requirements:
153
- - - ! '>='
144
+ - - '>='
154
145
  - !ruby/object:Gem::Version
155
146
  version: '0'
156
147
  requirements: []
157
148
  rubyforge_project:
158
- rubygems_version: 1.8.29
149
+ rubygems_version: 2.0.14.1
159
150
  signing_key:
160
- specification_version: 3
151
+ specification_version: 4
161
152
  summary: SELENIUM WEBDRIVER WITH RUBY & CUCUMBER
162
153
  test_files: []
154
+ has_rdoc:
@@ -1,15 +0,0 @@
1
- @android_demo1
2
- Feature: Demo
3
-
4
- As a Android user
5
- I want to PolyClaim app
6
- So that I can make the test for Demo section
7
-
8
- Scenario: Navigate
9
- Given I have App running with appium
10
- When I click on Sign In button
11
- # And I input text "11122233" on "poly_DigiD"
12
- # And I input text "12345" on "poly_Password"
13
- # And I click on Login
14
- # Then I verify property "poly_ErrorMessage" with "name" has value "Invalid credentials."
15
- # * I test "poly_DigiD"
@@ -1,14 +0,0 @@
1
- @android_demo2
2
- Feature: Demo
3
-
4
- As a Android user
5
- I want to PolyClaim app
6
- So that I can make the test for Demo section
7
-
8
- Scenario: Navigate
9
- Given I have App running with appium
10
- When I click on Sign In button
11
- And I input text "111222333" on "poly_DigiD"
12
- And I input text "12345" on "poly_Password"
13
- And I click on Login
14
- Then I verify property "poly_Overview_header" with "name" has value "Declaration overview"
@@ -1,15 +0,0 @@
1
- Feature: Demo
2
-
3
- As a iPhone user
4
- I want to Demo app
5
- So that I can make the test for Demo section
6
- @ios_demo
7
- Scenario: Navigate
8
- Given I have App running with appium
9
- When I input text "4" on "textbox1"
10
- And I input text "4" on "textbox2"
11
- And I click on "button_sum"
12
- Then I verify property "result" with "value" has value "8"
13
- When I click on "show_alert"
14
- Then I verify property "alert title" with "name" has value "Cool title"
15
- And I accept alert
@@ -1,4 +0,0 @@
1
- And /^I click on Login$/ do
2
- step %{I hide the keyboard}
3
- step %{I click on "poly_Login"}
4
- end
@@ -1,9 +0,0 @@
1
- # All elements on Welcome page
2
- $_RP_OBJECT['poly_SignIn_home'] = {xpath: '//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.view.View[1]/android.view.View[5]'}
3
- #All elements on Login page
4
- $_RP_OBJECT['poly_DigiD'] = {xpath: '//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.view.View[1]/android.view.View[6]/android.view.View[2]/android.widget.EditText[1]'}
5
- $_RP_OBJECT['poly_Password'] = {xpath: '//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.view.View[1]/android.view.View[7]/android.view.View[2]/android.widget.EditText[1]'}
6
- $_RP_OBJECT['poly_Login'] = {xpath: '//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.view.View[1]/android.widget.Button[1]'}
7
- $_RP_OBJECT['poly_ErrorMessage'] = {xpath: '//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.view.View[1]/android.view.View[10]'}
8
- #All elements on Declaration Overview page
9
- $_RP_OBJECT['poly_Overview_header'] = {xpath: '//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.view.View[1]/android.view.View[5]'}
@@ -1,6 +0,0 @@
1
- $_RP_OBJECT['textbox1'] = {name: 'TextField1'}
2
- $_RP_OBJECT['textbox2'] = {name: 'TextField2'}
3
- $_RP_OBJECT['button_sum'] = {name: 'ComputeSumButton'}
4
- $_RP_OBJECT['result'] = {name: 'Answer'}
5
- $_RP_OBJECT['show_alert'] = {name: 'show alert'}
6
- $_RP_OBJECT['alert title'] = {name: 'Cool title'}
@@ -1,42 +0,0 @@
1
- $_CONFIG = Hash.new
2
- ###################################################################
3
- # SYSTEM CONFIGURATION #
4
- ###################################################################
5
- $_CONFIG['Print Log'] = true
6
- $_CONFIG['Wait Time'] = 30
7
- $_CONFIG['DeviceName'] = 'ios'
8
-
9
- ###################################################################
10
- # DEVICE CONFIGURATION #
11
- ###################################################################
12
- IOS_APP_PATH = File.join(File.dirname(__FILE__), '../../apps/TestApp/build/release-iphonesimulator/TestApp.app')
13
- ANDROID_APP_PATH = File.join(File.dirname(__FILE__), '../../apps/selendroid-test-app.apk')
14
- def capabilities_ios
15
- {
16
- 'platformName' => 'ios',
17
- 'deviceName' => 'iPad Air',
18
- 'platformVersion' => '8.3',
19
- 'app' => IOS_APP_PATH
20
- }
21
- end
22
-
23
- def capabilities_android
24
- {
25
- 'platformName' => 'android',
26
- 'deviceName' => 'emulator-5554',
27
- 'fullReset' => 'fullReset',
28
- 'noReset' => 'true',
29
- 'platformVersion' => '4.4.2',
30
- 'app' => ANDROID_APP_PATH
31
- }
32
- end
33
- ###################################################################
34
- # SERVER CONFIGURATION #
35
- ###################################################################
36
- def server_url
37
- "http://127.0.0.1:4723/wd/hub"
38
- end
39
-
40
-
41
-
42
-