Ifd_Mobile 0.1.0 → 0.1.1

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: 75300afffa75f08d742347b89ebbe42b5e93a182
4
- data.tar.gz: 8c78f077195b76b79b36cf13de67679a3dcbfd10
3
+ metadata.gz: 009b7991650ac5b0e386e51630aba56986be115f
4
+ data.tar.gz: 2ae91e49afa3dcd7f59f8e848943a21b869d11b6
5
5
  SHA512:
6
- metadata.gz: d866778a69376b908f9c6c89a44ad7d02670f2f544a0a18df06d3fd6e1accb2f89c78f108feb1eb6bb57aab39f48ca36ba2e6b638787caea3b97846ce707fa7b
7
- data.tar.gz: 88f04e329e02a5077cabc8b2c247924282eb4e7e6734313bcd7b13d23e8731ebeb702feaae4cb5689fb25085bf5e8f06ec871f7cd629dde937518e922d17ec81
6
+ metadata.gz: cfe96a751128caed706923de5b7bbb92e72d5716f62dbc421596a7fbdf8c66348ae57b05cf3a40391a7dc9b7849202b43a07846472cf10e91468ea0fce15184a
7
+ data.tar.gz: a19d29115de18e8872d51395ab99856287da9c864635fe66589fbb5ee88b2295dd126825109e04583638480c078542708421f1d4334c96ace438b44b2bc513a1
@@ -0,0 +1,70 @@
1
+
2
+ Given(/^I have App running with appium$/) do
3
+ # Make sure you have started appium server
4
+ end
5
+
6
+ # Wait for the specific time
7
+ When /^I wait for (\d+) seconds$/ do |second|
8
+ sleep(second.to_i)
9
+ end
10
+
11
+ And /^I input text "(.*)" on "(.*)"$/ do |text,object|
12
+ execute_settext(object,text)
13
+ end
14
+
15
+ And /^I click on "(.*)"$/ do |object|
16
+ execute_click object
17
+ end
18
+
19
+ Then /^I verify property "(.*)" with "(.*)" has( | not)? value "(.*)"$/ do |object, property, negate, value|
20
+ sleep(0.5)
21
+ value = var_collect(value)
22
+ execute_checkproperty(object, property, negate, value)
23
+ end
24
+
25
+ Given /^I click on element with x: "(.*)", y: "(.*)"$/ do |x,y|
26
+ click_by_coordinate x,y
27
+ end
28
+
29
+ And /^I scroll the screen from startX (\d+) startY (\d+) to endX (\d+) endY (\d+) and millisecond timeout is (\d+)$/ do |startX, startY, endX, endY, timeout|
30
+ selenium.swipe(startX:startX, startY:startY, endX:endX,endY:endY, duration:timeout)
31
+ end
32
+
33
+ Given /^I get attribute of element "(.*)"$/ do |element|
34
+ found_element = find_object element
35
+ actual_value = found_element.attribute("name")
36
+ puts actual_value
37
+ end
38
+
39
+ And /^I rotate device to (landscape|portrait)$/ do |type|
40
+ case type.to_sym
41
+ when :landscape
42
+ $driver.rotate :landscape
43
+ when :portrait
44
+ $driver.rotate :portrait
45
+ else
46
+ raise "ERROR: *** unknown rotate type"
47
+ end
48
+ end
49
+
50
+ And /^I accept alert$/ do
51
+ selenium.alert_accept
52
+ end
53
+
54
+ And /^I dismiss alert$/ do
55
+ selenium.alert_dismiss
56
+ end
57
+
58
+ And /^I hide the keyboard$/ do
59
+ selenium.hide_keyboard
60
+ end
61
+
62
+ And /^I delete an character$/ do
63
+ system('adb shell input keyevent 67')
64
+ end
65
+
66
+ And /^I test "(.*)"$/ do |element|
67
+ found_element = find_object element
68
+ actual_value = found_element.attribute("value")
69
+ puts actual_value
70
+ end
@@ -10,7 +10,7 @@ def put_log str
10
10
  end
11
11
 
12
12
  def find_object string_object
13
- startTime = Time.new.to_i
13
+ # startTime = Time.new.to_i
14
14
  string_object = string_object.gsub(/"/, "'")
15
15
  # puts string_object
16
16
  locator_matching = /(.*?)(\{.*?\})/.match(string_object)
@@ -49,7 +49,7 @@ def find_object string_object
49
49
  }
50
50
  end
51
51
  # put_log string_object
52
- put_log "\nattribute: #{attribute}"
52
+ # put_log "\nattribute: #{attribute}"
53
53
 
54
54
  attribute.each { |key, value|
55
55
  $element_tag = key
@@ -61,11 +61,13 @@ end
61
61
  def execute_click element
62
62
  found_element = find_object element
63
63
  if found_element != nil
64
+ startTime = Time.new.to_i
64
65
  begin
65
- found_element.click
66
- rescue StandardError => myStandardError
67
- put_log "\nERROR: *** #{myStandardError}"
68
- end
66
+ sleep(1)
67
+ currentTime= Time.new.to_i
68
+ end while (currentTime - startTime) < $_CONFIG['Wait Time']
69
+ # selenium.execute_script('mobile: scroll', found_element)
70
+ found_element.click
69
71
  else
70
72
  put_log "\nERROR: *** not found object: #{element}"
71
73
  end
@@ -75,6 +77,8 @@ def execute_settext element, text
75
77
  found_element = find_object element
76
78
  if found_element != nil
77
79
  begin
80
+ sleep(1)
81
+ # found_element.long_press_keycode(46)
78
82
  found_element.send_keys(text)
79
83
  rescue StandardError => myStandardError
80
84
  put_log "\nERROR: *** #{myStandardError}"
@@ -125,4 +129,8 @@ def execute_checkproperty element, property, negate, value
125
129
  elsif expect(check).to eq true
126
130
  end
127
131
  end
128
- end
132
+ end
133
+
134
+ def click_by_coordinate x, y
135
+ selenium.execute_script 'mobile: tap', :x => x, :y => y
136
+ end
@@ -1,5 +1,5 @@
1
1
  module Ifd
2
2
  module Mobile
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -0,0 +1,15 @@
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"
@@ -0,0 +1,14 @@
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,11 +1,15 @@
1
- Feature: Notes
1
+ Feature: Demo
2
2
 
3
3
  As a iPhone user
4
4
  I want to Demo app
5
5
  So that I can make the test for Demo section
6
-
6
+ @ios_demo
7
7
  Scenario: Navigate
8
8
  Given I have App running with appium
9
- * I input text "4" on "textbox1"
10
- * I click on "button_sum"
11
- * I verify property "result" with "name" has value "Answer"
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
@@ -0,0 +1,3 @@
1
+ And /^I click on Sign In button$/ do
2
+ step %{I click on element with x: "520", y: "1150"}
3
+ end
@@ -0,0 +1,4 @@
1
+ And /^I click on Login$/ do
2
+ step %{I hide the keyboard}
3
+ step %{I click on "poly_Login"}
4
+ end
@@ -1,2 +1,9 @@
1
- $_RP_OBJECT['display_text_view'] = {xpath: '//android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.LinearLayout[4]/android.widget.Button[1]'}
2
- $_RP_OBJECT['text_view'] = {xpath: '//android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.LinearLayout[4]/android.widget.TextView[1]'}
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,3 +1,6 @@
1
1
  $_RP_OBJECT['textbox1'] = {name: 'TextField1'}
2
+ $_RP_OBJECT['textbox2'] = {name: 'TextField2'}
2
3
  $_RP_OBJECT['button_sum'] = {name: 'ComputeSumButton'}
3
- $_RP_OBJECT['result'] = {name: 'Answer'}
4
+ $_RP_OBJECT['result'] = {name: 'Answer'}
5
+ $_RP_OBJECT['show_alert'] = {name: 'show alert'}
6
+ $_RP_OBJECT['alert title'] = {name: 'Cool title'}
@@ -4,4 +4,6 @@ $base_dir = File.expand_path(File.dirname(__FILE__) + '/../..')
4
4
 
5
5
  require 'rspec/expectations'
6
6
  require 'selenium-webdriver'
7
+ require 'appium_lib'
8
+ require 'cucumber/ast'
7
9
  require "#{$current_dir}/project_env.rb"
@@ -23,6 +23,9 @@ def capabilities_android
23
23
  {
24
24
  'platformName' => 'android',
25
25
  'deviceName' => 'emulator-5554',
26
+ 'fullReset' => 'fullReset',
27
+ 'noReset' => 'true',
28
+ 'platformVersion' => '4.4.2',
26
29
  'app' => ANDROID_APP_PATH
27
30
  }
28
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Ifd_Mobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anh Pham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -78,6 +78,7 @@ executables:
78
78
  extensions: []
79
79
  extra_rdoc_files: []
80
80
  files:
81
+ - lib/Ifd_Mobile/lib_web.rb
81
82
  - lib/Ifd_Mobile/methods/core.rb
82
83
  - lib/Ifd_Mobile/methods/IFD_Assertion.rb
83
84
  - lib/Ifd_Mobile/methods/lib_var.rb
@@ -119,8 +120,11 @@ files:
119
120
  - project/apps/TestApp/TestApp.xcodeproj/project.xcworkspace/xcuserdata/anhpham.xcuserdatad/UserInterfaceState.xcuserstate
120
121
  - project/apps/TestApp/TestApp.xcodeproj/xcuserdata/anhpham.xcuserdatad/xcschemes/TestApp.xcscheme
121
122
  - project/apps/TestApp/TestApp.xcodeproj/xcuserdata/anhpham.xcuserdatad/xcschemes/xcschememanagement.plist
122
- - project/features/android/Android_test.feature
123
+ - project/features/android/Android_test1.feature
124
+ - project/features/android/Android_test2.feature
123
125
  - project/features/iOS/iOS_test.feature
126
+ - project/features/step_definitions/lib_steps/PolyClaim_homepage.rb
127
+ - project/features/step_definitions/lib_steps/PolyClaim_loginpage.rb
124
128
  - project/features/step_definitions/repositories/android_ob_test.rb
125
129
  - project/features/step_definitions/repositories/ios_ob_test.rb
126
130
  - project/features/support/env.rb
@@ -1,10 +0,0 @@
1
- Feature: Notes
2
-
3
- As a Android user
4
- I want to Demo app
5
- So that I can make the test for Demo section
6
-
7
- Scenario: Navigate
8
- Given I have App running with appium
9
- * I click on "display_text_view"
10
- * I verify property "text_view" with "text" has value "Text is sometimes displayed"