File tree 22 files changed +397
-0
lines changed
22 files changed +397
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Created by .ignore support plugin (hsz.mobi)
2
+ # ## Ruby template
3
+ * .gem
4
+ * .rbc
5
+ /.config
6
+ /coverage /
7
+ /InstalledFiles
8
+ /pkg /
9
+ /spec /reports /
10
+ /test /tmp /
11
+ /test /version_tmp /
12
+ /tmp /
13
+
14
+ # # Specific to RubyMotion:
15
+ .dat *
16
+ .repl_history
17
+ build /
18
+
19
+ # # Documentation cache and generated files:
20
+ /.yardoc /
21
+ /_yardoc /
22
+ /doc /
23
+ /rdoc /
24
+
25
+ # # Environment normalisation:
26
+ /.bundle /
27
+ /vendor /bundle
28
+ /lib /bundler /man /
29
+
30
+ # for a library or gem, you might want to ignore these files since the code is
31
+ # intended to run in multiple environments; otherwise, check them in:
32
+ # Gemfile.lock
33
+ # .ruby-version
34
+ # .ruby-gemset
35
+
36
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
37
+ .rvmrc
38
+ .ruby-gemset
39
+ .ruby-version
40
+
41
+ .idea
42
+
43
+ .DS_Store
Original file line number Diff line number Diff line change
1
+ source "https://rubygems.org"
2
+
3
+ gem 'appium_lib'
4
+ gem 'appium_console'
5
+ gem 'rake'
6
+ gem 'rspec'
7
+ gem 'sauce_whisk'
Original file line number Diff line number Diff line change
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ appium_console (1.0.3 )
5
+ appium_lib (>= 1.0.0 )
6
+ bond (~> 0.5.0 )
7
+ pry (~> 0.9.12.5 )
8
+ spec (>= 5.3.3 )
9
+ appium_lib (6.0.0 )
10
+ awesome_print (~> 1.6 , >= 1.6.0 )
11
+ json (~> 1.8 , >= 1.8.1 )
12
+ nokogiri (~> 1.6.3.1 )
13
+ selenium-webdriver (~> 2.41 , >= 2.41.0 )
14
+ toml (~> 0.0 , >= 0.0.4 )
15
+ awesome_print (1.6.1 )
16
+ blankslate (2.1.2.4 )
17
+ bond (0.5.1 )
18
+ bond (0.5.1-java )
19
+ childprocess (0.5.5 )
20
+ ffi (~> 1.0 , >= 1.0.11 )
21
+ chronic_duration (0.10.6 )
22
+ numerizer (~> 0.1.1 )
23
+ coderay (1.1.0 )
24
+ diff-lcs (1.2.5 )
25
+ ffi (1.9.8-java )
26
+ json (1.8.2 )
27
+ json (1.8.2-java )
28
+ method_source (0.8.2 )
29
+ mime-types (2.4.3 )
30
+ mini_portile (0.6.0 )
31
+ multi_json (1.11.0 )
32
+ netrc (0.10.3 )
33
+ nokogiri (1.6.3.1 )
34
+ mini_portile (= 0.6.0 )
35
+ nokogiri (1.6.3.1-java )
36
+ numerizer (0.1.1 )
37
+ parslet (1.5.0 )
38
+ blankslate (~> 2.0 )
39
+ pry (0.9.12.6 )
40
+ coderay (~> 1.0 )
41
+ method_source (~> 0.8 )
42
+ slop (~> 3.4 )
43
+ pry (0.9.12.6-java )
44
+ coderay (~> 1.0 )
45
+ method_source (~> 0.8 )
46
+ slop (~> 3.4 )
47
+ spoon (~> 0.0 )
48
+ rake (10.4.2 )
49
+ rest-client (1.7.3 )
50
+ mime-types (>= 1.16 , < 3.0 )
51
+ netrc (~> 0.7 )
52
+ rspec (3.2.0 )
53
+ rspec-core (~> 3.2.0 )
54
+ rspec-expectations (~> 3.2.0 )
55
+ rspec-mocks (~> 3.2.0 )
56
+ rspec-core (3.2.2 )
57
+ rspec-support (~> 3.2.0 )
58
+ rspec-expectations (3.2.0 )
59
+ diff-lcs (>= 1.2.0 , < 2.0 )
60
+ rspec-support (~> 3.2.0 )
61
+ rspec-mocks (3.2.1 )
62
+ diff-lcs (>= 1.2.0 , < 2.0 )
63
+ rspec-support (~> 3.2.0 )
64
+ rspec-support (3.2.2 )
65
+ rubyzip (1.1.7 )
66
+ sauce_whisk (0.0.17 )
67
+ json (~> 1.8.1 )
68
+ rest-client (~> 1.7.1 )
69
+ selenium-webdriver (2.45.0 )
70
+ childprocess (~> 0.5 )
71
+ multi_json (~> 1.0 )
72
+ rubyzip (~> 1.0 )
73
+ websocket (~> 1.0 )
74
+ slop (3.6.0 )
75
+ spec (5.3.4 )
76
+ chronic_duration (~> 0.10.2 )
77
+ spoon (0.0.4 )
78
+ ffi
79
+ toml (0.1.2 )
80
+ parslet (~> 1.5.0 )
81
+ websocket (1.2.1 )
82
+
83
+ PLATFORMS
84
+ java
85
+ ruby
86
+
87
+ DEPENDENCIES
88
+ appium_console
89
+ appium_lib
90
+ rake
91
+ rspec
92
+ sauce_whisk
Original file line number Diff line number Diff line change
1
+ desc 'Run iOS tests'
2
+ task :ios , :location do |t , args |
3
+ location_helper args [ :location ]
4
+ Dir . chdir 'iOS'
5
+ exec 'rspec'
6
+ end
7
+
8
+ desc 'Run Android tests'
9
+ task :android , :location do |t , args |
10
+ location_helper args [ :location ]
11
+ Dir . chdir 'android'
12
+ exec 'rspec'
13
+ end
14
+
15
+ def location_helper ( location )
16
+ if location != 'sauce'
17
+ ENV [ 'SAUCE_USERNAME' ] , ENV [ 'SAUCE_ACCESS_KEY' ] = nil , nil
18
+ end
19
+ end
Original file line number Diff line number Diff line change
1
+ Pry . commands . alias_command 'c' , 'continue'
2
+ Pry . commands . alias_command 's' , 'step'
3
+ Pry . commands . alias_command 'n' , 'next'
Original file line number Diff line number Diff line change
1
+ --color
Original file line number Diff line number Diff line change
1
+ [caps]
2
+ appium-version = "1.3.7"
3
+ platformName = "Android"
4
+ platformVersion = "5.0"
5
+ app = "sample_apps/api.apk"
6
+ deviceName = "Android"
7
+ avd = "training"
8
+
9
+ [appium_lib]
10
+ require = ["./spec/requires.rb"]
Original file line number Diff line number Diff line change
1
+ module Pages
2
+ module Home
3
+ class << self
4
+
5
+ def first_cell
6
+ @found_cell = wait { text 2 }
7
+ self
8
+ end
9
+
10
+ def click
11
+ @found_cell . click
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ module Kernel
18
+ def home
19
+ Pages ::Home
20
+ end
21
+ end
Original file line number Diff line number Diff line change
1
+ module Pages
2
+ module InnerScreen
3
+ class << self
4
+
5
+ def has_text? ( text )
6
+ wait { find_exact text }
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ module Kernel
13
+ def inner_screen
14
+ Pages ::InnerScreen
15
+ end
16
+ end
Original file line number Diff line number Diff line change
1
+ require_relative 'requires'
2
+
3
+ describe 'Home Screen Navigation' do
4
+
5
+ it 'First cell' do
6
+ home . first_cell . click
7
+ inner_screen . has_text? 'Accessibility Node Provider'
8
+ end
9
+ end
Original file line number Diff line number Diff line change
1
+ require_relative 'spec_helper'
2
+ require_relative '../pages/home'
3
+ require_relative '../pages/inner_screen'
Original file line number Diff line number Diff line change
1
+ require 'rspec'
2
+ require 'appium_lib'
3
+ require 'sauce_whisk'
4
+ require 'pry'
5
+ require_relative '../pages/home'
6
+ require_relative '../pages/inner_screen'
7
+
8
+ def using_sauce?
9
+ user = ENV [ 'SAUCE_USERNAME' ]
10
+ key = ENV [ 'SAUCE_ACCESS_KEY' ]
11
+ user && !user . empty? && key && !key . empty?
12
+ end
13
+
14
+ def upload_app
15
+ storage = SauceWhisk ::Storage . new
16
+ app = @caps [ :caps ] [ :app ]
17
+ storage . upload app
18
+ @caps [ :caps ] [ :app ] = "sauce-storage:#{ File . basename ( app ) } "
19
+ end
20
+
21
+ def setup_driver
22
+ return if $driver
23
+ appium_txt = File . join ( Dir . pwd , 'appium.txt' )
24
+ @caps = Appium . load_appium_txt file : appium_txt
25
+ if using_sauce?
26
+ upload_app
27
+ @caps [ :caps ] . delete :avd
28
+ end
29
+ Appium ::Driver . new ( @caps )
30
+ end
31
+
32
+ def promote_methods
33
+ Appium . promote_singleton_appium_methods Pages
34
+ Appium . promote_appium_methods RSpec ::Core ::ExampleGroup
35
+ end
36
+
37
+ setup_driver
38
+ promote_methods
39
+
40
+ RSpec . configure do |config |
41
+
42
+ config . before ( :each ) do |example |
43
+ $driver. caps [ :name ] = example . metadata [ :full_description ] if using_sauce?
44
+ $driver. start_driver
45
+ end
46
+
47
+ config . after ( :each ) do |example |
48
+ if using_sauce?
49
+ SauceWhisk ::Jobs . change_status ( $driver. driver . session_id , example . exception . nil? )
50
+ end
51
+ driver_quit
52
+ end
53
+ end
Original file line number Diff line number Diff line change
1
+ Pry . commands . alias_command 'c' , 'continue'
2
+ Pry . commands . alias_command 's' , 'step'
3
+ Pry . commands . alias_command 'n' , 'next'
Original file line number Diff line number Diff line change
1
+ --color
Original file line number Diff line number Diff line change
1
+ [caps]
2
+ appium-version = "1.3.7"
3
+ platformName = "ios"
4
+ platformVersion = "8.2"
5
+ app = "sample_apps/UICatalog.app.zip"
6
+ deviceName = "iPhone 5s"
7
+
8
+ [appium_lib]
9
+ require = ["./spec/requires.rb"]
Original file line number Diff line number Diff line change
1
+ module Pages
2
+ module Home
3
+ class << self
4
+
5
+ def first_cell
6
+ @found_cell = wait { text 2 }
7
+ self
8
+ end
9
+
10
+ def title
11
+ @found_cell . name . split ( ',' ) . first
12
+ end
13
+
14
+ def click
15
+ @found_cell . click
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ module Kernel
22
+ def home
23
+ Pages ::Home
24
+ end
25
+ end
Original file line number Diff line number Diff line change
1
+ module Pages
2
+ module InnerScreen
3
+ class << self
4
+
5
+ def has_text? ( text )
6
+ wait { text_exact text }
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ module Kernel
13
+ def inner_screen
14
+ Pages ::InnerScreen
15
+ end
16
+ end
Original file line number Diff line number Diff line change
1
+ require_relative 'requires'
2
+
3
+ describe 'Home Screen Navigation' do
4
+
5
+ it 'First cell' do
6
+ cell_title = home . first_cell . title
7
+ home . first_cell . click
8
+ inner_screen . has_text? cell_title
9
+ end
10
+ end
Original file line number Diff line number Diff line change
1
+ require_relative 'spec_helper'
2
+ require_relative '../pages/home'
3
+ require_relative '../pages/inner_screen'
You can’t perform that action at this time.
0 commit comments