SurfCustomCalabash 0.2.0 → 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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +68 -4
  4. data/SurfCustomCalabash.gemspec +3 -3
  5. data/bin/SurfCustomCalabash +54 -0
  6. data/bin/surf-calabash-console.rb +62 -0
  7. data/bin/surf-calabash-gen.rb +17 -0
  8. data/bin/surf-calabash-helpers.rb +34 -0
  9. data/lib/SurfCustomCalabash/CommonMethods.rb +3 -3
  10. data/lib/SurfCustomCalabash/DroidMethods.rb +2 -1
  11. data/lib/SurfCustomCalabash/IosMethods.rb +2 -2
  12. data/lib/SurfCustomCalabash/version.rb +1 -1
  13. data/sources/Backdoors list b/data/sources/Backdoors → list +0 -0
  14. data/sources/Gemfile +27 -0
  15. data/sources/Scripts/and.sh +5 -0
  16. data/sources/Scripts/ca.sh +5 -0
  17. data/sources/Scripts/ci.sh +5 -0
  18. data/sources/Scripts/data +7 -0
  19. data/sources/Scripts/fa.sh +6 -0
  20. data/sources/Scripts/fi.sh +5 -0
  21. data/sources/Scripts/get_apk.rb +68 -0
  22. data/sources/Scripts/get_scenarios.rb +193 -0
  23. data/sources/Scripts/import_scenarios.rb +172 -0
  24. data/sources/Scripts/ios.sh +5 -0
  25. data/sources/Scripts/parallel_android_smoke.sh +4 -0
  26. data/sources/Scripts/parallel_android_test.sh +4 -0
  27. data/sources/Scripts/ra.sh +12 -0
  28. data/sources/Scripts/ri.sh +9 -0
  29. data/sources/Scripts/smoke_and.sh +5 -0
  30. data/sources/Scripts/smoke_ios.sh +5 -0
  31. data/sources/Scripts/ta.sh +5 -0
  32. data/sources/Scripts/ti.sh +5 -0
  33. data/sources/Scripts/to_exec.sh +19 -0
  34. data/sources/Scripts/update.sh +24 -0
  35. data/sources/Scripts/update_exec.rb +96 -0
  36. data/sources/TestFolder/small.gif +0 -0
  37. data/sources/ci/JenkinsfileUiTestAndroid.groovy +22 -0
  38. data/sources/ci/JenkinsfileUiTestIos.groovy +23 -0
  39. data/sources/config/cucumber.yml +24 -0
  40. data/sources/features/android/pages/standard/DroidCommon.rb +33 -0
  41. data/sources/features/android/pages/standard/Init_android.rb +8 -0
  42. data/sources/features/android/pages/test.rb +43 -0
  43. data/sources/features/android/support/app_life_cycle_hooks.rb +147 -0
  44. data/sources/features/android/support/log_hooks_and.rb +40 -0
  45. data/sources/features/android/support/video_hooks_and.rb +110 -0
  46. data/sources/features/ios/pages/standard/Init_ios.rb +5 -0
  47. data/sources/features/ios/pages/standard/IosCommon.rb +30 -0
  48. data/sources/features/ios/pages/test.rb +37 -0
  49. data/sources/features/ios/support/01_launch.rb +194 -0
  50. data/sources/features/ios/support/log_hooks_ios.rb +40 -0
  51. data/sources/features/ios/support/video_hooks_ios.rb +58 -0
  52. data/sources/features/net/net.rb +28 -0
  53. data/sources/features/net/screentest_api.rb +186 -0
  54. data/sources/features/scenarios/eng.feature +8 -0
  55. data/sources/features/scenarios/rus.feature +8 -0
  56. data/sources/features/step_definitions/test.rb +43 -0
  57. data/sources/features/support/credentials.rb +11 -0
  58. data/sources/features/support/env.rb +8 -0
  59. data/sources/features/support/hooks.rb +21 -0
  60. data/sources/features/support/localization.rb +8 -0
  61. data/sources/find_id.rb +95 -0
  62. data/sources/group_steps.rb +39 -0
  63. data/sources/irbrcs/android/irbrc +105 -0
  64. data/sources/irbrcs/ios/irbrc +132 -0
  65. data/sources/start.sh +134 -0
  66. metadata +63 -6
  67. data/bin/console +0 -14
  68. data/bin/setup +0 -8
@@ -0,0 +1,105 @@
1
+ begin
2
+ require 'rubygems'
3
+ require 'irb/completion'
4
+ require 'irb/ext/save-history'
5
+
6
+ begin
7
+ require 'awesome_print'
8
+ rescue LoadError => e
9
+ msg = ["Caught a LoadError: could not load 'awesome_print'",
10
+ "#{e}",
11
+ '',
12
+ 'Use bundler (recommended) or uninstall awesome_print.',
13
+ '',
14
+ '# Use bundler (recommended)',
15
+ '$ bundle update',
16
+ '$ bundle exec calabash-android console <path to apk>',
17
+ '',
18
+ '# Uninstall',
19
+ '$ gem update --system',
20
+ '$ gem uninstall -Vax --force --no-abort-on-dependent awesome_print']
21
+ Kernel.puts msg
22
+ exit(1)
23
+ end
24
+
25
+ def reload!(print = true)
26
+ Kernel.puts 'Reloading ...'
27
+ # Main project directory.
28
+ root_dir = Dir.pwd
29
+ Kernel.puts(root_dir)
30
+ # Directories within the project that should be reloaded.
31
+ reload_dirs = root_dir+'/features/android/pages'
32
+ # Loop through and reload every file in all relevant project directories.
33
+ Dir.glob(reload_dirs).each do |dir|
34
+ Dir.glob(Dir.pwd+'/features/android/pages/*.rb').each { |f| load(f) }
35
+ Kernel.puts(dir)
36
+ init_android
37
+ end
38
+ # Return true when complete.
39
+ true
40
+ end
41
+
42
+
43
+ AwesomePrint.irb!
44
+
45
+ ARGV.concat [ "--readline",
46
+ "--prompt-mode",
47
+ "simple" ]
48
+
49
+ # 50 entries in the list
50
+ IRB.conf[:SAVE_HISTORY] = 50
51
+
52
+ # Store results in home directory with specified file name
53
+ IRB.conf[:HISTORY_FILE] = ".irb-history"
54
+
55
+
56
+ #These code loads all user's page description and step definitions for calabash-android
57
+ require 'calabash-android/defaults'
58
+ require 'calabash-android/operations'
59
+ ENV['PLATFORM'] = 'android'
60
+ Kernel.puts(ENV['PLATFORM'])
61
+ require 'require_all'
62
+ require_all Dir.pwd+'/features/android/pages'
63
+ init_android
64
+ #End of custom code
65
+
66
+ rescue Exception => e
67
+ Kernel.puts "Error loading Calabash irbrc: #{e}"
68
+ exit(1)
69
+ end
70
+
71
+ module Calabash
72
+ module Android
73
+ module Operations
74
+ def embed(*args)
75
+ Kernel.puts "Embed is a Cucumber method and is not available in this console."
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ module Cucumber
82
+ class << self
83
+ wants_to_quit = false
84
+ end
85
+ end
86
+
87
+ extend Calabash::Android::Operations
88
+
89
+
90
+ def preferences
91
+ Calabash::Android::Preferences.new
92
+ end
93
+
94
+ def disable_usage_tracking
95
+ preferences.usage_tracking = "none"
96
+ Kernel.puts "Calabash will not collect usage information."
97
+ "none"
98
+ end
99
+
100
+ def enable_usage_tracking(level="system_info")
101
+ preferences.usage_tracking = level
102
+ Kernel.puts "Calabash will collect statistics using the '#{level}' rule."
103
+ level
104
+ end
105
+
@@ -0,0 +1,132 @@
1
+ begin
2
+ require "irb/completion"
3
+ require "irb/ext/save-history"
4
+ rescue LoadError => e
5
+ Kernel.puts %Q[
6
+ Caught a LoadError while requiring an irb module.
7
+
8
+ #{e}
9
+
10
+ An error like this usually means your ruby installation is corrupt.
11
+
12
+ ]
13
+ exit(1)
14
+ end
15
+
16
+ begin
17
+ require "awesome_print"
18
+ rescue LoadError => e
19
+ Kernel.puts %Q[
20
+ Caught a LoadError: could not load 'awesome_print'",
21
+
22
+ #{e}
23
+
24
+ Use bundler (recommended) or uninstall awesome_print.
25
+
26
+ # Use bundler (recommended)
27
+ $ bundle update
28
+ $ bundle exec calabash-ios console
29
+
30
+ # Uninstall awesome_print and reinstall calabash-cucumber
31
+ $ gem update --system
32
+ $ gem uninstall -Vax --force --no-abort-on-dependent awesome_print
33
+ $ gem install calabash-cucumber
34
+
35
+ ]
36
+ exit(1)
37
+ end
38
+
39
+ require "benchmark"
40
+
41
+ AwesomePrint.irb!
42
+
43
+ ARGV.concat ["--readline", "--prompt-mode", "simple"]
44
+
45
+ IRB.conf[:SAVE_HISTORY] = 100
46
+ IRB.conf[:HISTORY_FILE] = ".irb-history"
47
+
48
+ #begin
49
+ # require "pry"
50
+ # Pry.config.history.should_save = true
51
+ # Pry.config.history.should_load = true
52
+ # Pry.config.history.file = ".pry-history"
53
+ # require "pry-nav"
54
+ #rescue LoadError => _
55
+
56
+ #end
57
+
58
+ def embed(x,y=nil,z=nil)
59
+ Kernel.puts "Screenshot at #{x}"
60
+ end
61
+
62
+ require "calabash-cucumber"
63
+
64
+ IRB.conf[:AUTO_INDENT] = true
65
+
66
+ IRB.conf[:PROMPT][:CALABASH_IOS] = {
67
+ :PROMPT_I => "calabash-ios #{Calabash::Cucumber::VERSION}> ",
68
+ :PROMPT_N => "calabash-ios #{Calabash::Cucumber::VERSION}> ",
69
+ :PROMPT_S => nil,
70
+ :PROMPT_C => "> ",
71
+ :AUTO_INDENT => false,
72
+ :RETURN => "%s\n"
73
+ }
74
+
75
+ IRB.conf[:PROMPT_MODE] = :CALABASH_IOS
76
+
77
+ require "calabash-cucumber/operations"
78
+ extend Calabash::Cucumber::Operations
79
+
80
+ require "calabash-cucumber/console_helpers"
81
+ include Calabash::Cucumber::ConsoleHelpers
82
+ Calabash::Cucumber::ConsoleHelpers.start_readline_history!
83
+
84
+ ENV['PLATFORM'] = 'ios'
85
+ Kernel.puts(ENV['PLATFORM'])
86
+ Path = Dir.pwd
87
+ require 'require_all'
88
+ require_all Dir.pwd+'/features/ios/pages'
89
+ init_ios
90
+
91
+
92
+
93
+ def reload!(print = true)
94
+ Kernel.puts 'Reloading ...'
95
+ # Main project directory.
96
+ root_dir = Dir.pwd
97
+ Kernel.puts(root_dir)
98
+ # Directories within the project that should be reloaded.
99
+ reload_dirs = root_dir+'/features/ios/pages'
100
+ # Loop through and reload every file in all relevant project directories.
101
+ Dir.glob(reload_dirs).each do |dir|
102
+ Dir.glob(Dir.pwd+'/features/ios/pages/*.rb').each { |f| load(f) }
103
+ Kernel.puts(dir)
104
+ init_ios
105
+ end
106
+ # Return true when complete.
107
+ true
108
+ end
109
+
110
+
111
+ def preferences
112
+ Calabash::Cucumber::Preferences.new
113
+ end
114
+
115
+ def disable_usage_tracking
116
+ preferences.usage_tracking = "none"
117
+ Kernel.puts "Calabash will not collect usage information."
118
+ "none"
119
+ end
120
+
121
+ def enable_usage_tracking(level="system_info")
122
+ preferences.usage_tracking = level
123
+ Kernel.puts "Calabash will collect statistics using the '#{level}' rule."
124
+ level
125
+ end
126
+
127
+ xcode = RunLoop::Xcode.new
128
+ Calabash::Cucumber::UIA.redefine_instance_methods_if_necessary(xcode)
129
+
130
+ Kernel.puts_console_details
131
+ Kernel.puts_message_of_the_day
132
+ _try_to_attach
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env bash
2
+
3
+ index=0
4
+ while read line; do
5
+ array[$index]="$line"
6
+ index=$(($index+1))
7
+ done < ./Scripts/data
8
+
9
+ first_string="${array[0]}"
10
+ user_name=${first_string/login /}
11
+
12
+ echo "Привет, ${user_name}"
13
+ echo "
14
+ Введите:
15
+
16
+ 0 - если хотите скачать последнюю версию апк из дженкинса
17
+
18
+ 1 - если хотите обновить/добавить тесты из выбранного фича-файла в TEST REPOSITORY
19
+ 2 - если хотите обновить/добавить все тесты в TEST REPOSITORY
20
+ 3 - если хотите обновить андроид смоук прогон в TEST REPOSITORY
21
+ 4 - если хотите обновить ios смоук прогон в TEST REPOSITORY
22
+
23
+ 5 - если хотите запустить консоль калабаш-андроид
24
+ 6 - если хотите запустить дефолтный прогон калабаш-андроид
25
+ 7 - если хотите запустить прогон определенной фичи калабаш-андроид
26
+ 8 - если хотите запустить прогон по тэгу калабаш-андроид
27
+
28
+ 9 - если хотите запустить консоль калабаш-айос
29
+ 10 - если хотите запустить дефолтный прогон калабаш-айос
30
+ 11 - если хотите запустить прогон определенной фичи калабаш-айос
31
+ 12 - если хотите запустить прогон по тэгу калабаш-айос
32
+
33
+ 13 - если хотите сгруппировать все упавшие шаги из json отчета
34
+ 14 - если хотите посмотреть различия между сценариями в jira и репозитории
35
+ 15 - если хотите удалить все сценарии из jira, которых нет в репозитории
36
+ 16 - если хотите найти сценарии с одинаковыми названиями в репозитории
37
+ "
38
+
39
+ file_path= echo $PWD
40
+ read p
41
+
42
+ if [ $p = 0 ]; then
43
+ ruby -r "./scripts/get_apk.rb" -e "GetApk.new('$file_path').download_apk"
44
+
45
+ elif [ $p = 1 ]; then
46
+ sh ./Scripts/update.sh
47
+
48
+ elif [ $p = 2 ]; then
49
+ ruby -r "./scripts/import_scenarios.rb" -e "Scenarios.new('$file_path').import_scenarios"
50
+
51
+ elif [ $p = 3 ]; then
52
+ five_string="${array[5]}"
53
+ exec_key=${five_string/key_execution_and /}
54
+
55
+ while true; do
56
+ read -p "Хотите обновить андроид прогон ${exec_key}? (yes or no)" yn
57
+ case $yn in
58
+ [Nn]* ) exit;;
59
+ * ) ruby -r "./scripts/update_exec.rb" -e "Execution.new('$file_path').update_test_execution('${exec_key}')";
60
+ break;;
61
+ esac
62
+ done
63
+
64
+ elif [ $p = 4 ]; then
65
+ six_string="${array[6]}"
66
+ exec_key=${six_string/key_execution_ios /}
67
+
68
+ while true; do
69
+ read -p "Хотите обновить ios прогон ${exec_key}? (yes or no)" yn
70
+ case $yn in
71
+ [Nn]* ) exit;;
72
+ * ) ruby -r "./scripts/update_exec.rb" -e "Execution.new('$file_path').update_test_execution('${exec_key}')";
73
+ break;;
74
+ esac
75
+ done
76
+
77
+ elif [ $p = 5 ]; then
78
+ sh ./Scripts/ca.sh
79
+
80
+ elif [ $p = 6 ]; then
81
+ sh ./Scripts/and.sh
82
+
83
+ elif [ $p = 7 ]; then
84
+ echo "Введите название фичи для прогона из папки features/scenarios/name.feature в формате <name>"
85
+ read name
86
+ sh ./Scripts/fa.sh $name
87
+
88
+ elif [ $p = 8 ]; then
89
+ echo "Введите тэг для прогона из папки в формате <tag>"
90
+ read tag
91
+ sh ./Scripts/ta.sh $tag
92
+
93
+ elif [ $p = 9 ]; then
94
+ sh ./Scripts/ci.sh
95
+
96
+ elif [ $p = 10 ]; then
97
+ sh ./Scripts/ios.sh
98
+
99
+ elif [ $p = 11 ]; then
100
+ echo "Введите название фичи для прогона из папки features/scenarios/name.feature в формате <name>"
101
+ read name
102
+ sh ./Scripts/fi.sh $name
103
+
104
+ elif [ $p = 12 ]; then
105
+ echo "Введите тэг для прогона из папки в формате <tag>"
106
+ read tag
107
+ sh ./Scripts/ti.sh $tag
108
+
109
+ elif [ $p = 13 ]; then
110
+ echo "Введите путь до json с результатами прогона"
111
+ read tag
112
+ ruby -r "./group_steps.rb" -e "GroupScenarios.new('$tag', 'group_steps.txt').group_failed_scenarios"
113
+
114
+ elif [ $p = 14 ]; then
115
+ ruby -r "./Scripts/get_scenarios.rb" -e "GetScenarios.new.show_difference_tests"
116
+
117
+ elif [ $p = 15 ]; then
118
+ arr_test=$(ruby -r "./Scripts/get_scenarios.rb" -e "GetScenarios.new.show_all_scenarios_not_exists_in_repo")
119
+ if !([ -z "$arr_test" ]); then
120
+ echo "Сценарии которые есть в jira, но нет в репозитории:"
121
+ ruby -r "./Scripts/get_scenarios.rb" -e "GetScenarios.new.show_all_scenarios_not_exists_in_repo"
122
+ echo "\n"
123
+ read -p "Удалить эти сценарии из Jira (y/n)?" yn
124
+ case $yn in
125
+ [Nn]* ) exit;;
126
+ [Yy]* ) ruby -r "./Scripts/get_scenarios.rb" -e "GetScenarios.new.delete_all_waste_tests";
127
+ break;;
128
+ esac
129
+ else
130
+ echo "В jira нет лишних сценариев"
131
+ fi
132
+ elif [ $p = 16 ]; then
133
+ ruby -r "./Scripts/get_scenarios.rb" -e "GetScenarios.new.show_all_duplicate_scenarios"
134
+ fi
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SurfCustomCalabash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Hripunov
8
8
  - Igor Tolubaev
9
9
  autorequire:
10
- bindir: exe
10
+ bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-29 00:00:00.000000000 Z
12
+ date: 2020-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -56,25 +56,82 @@ dependencies:
56
56
  description: Custom methods for calabash ios and android
57
57
  email:
58
58
  - hripunov@surfstudio.ru
59
- executables: []
59
+ executables:
60
+ - SurfCustomCalabash
60
61
  extensions: []
61
62
  extra_rdoc_files: []
62
63
  files:
63
64
  - ".gitignore"
64
65
  - ".travis.yml"
66
+ - CHANGELOG.md
65
67
  - CODE_OF_CONDUCT.md
66
68
  - Gemfile
67
69
  - LICENSE.txt
68
70
  - README.md
69
71
  - Rakefile
70
72
  - SurfCustomCalabash.gemspec
71
- - bin/console
72
- - bin/setup
73
+ - bin/SurfCustomCalabash
74
+ - bin/surf-calabash-console.rb
75
+ - bin/surf-calabash-gen.rb
76
+ - bin/surf-calabash-helpers.rb
73
77
  - lib/SurfCustomCalabash.rb
74
78
  - lib/SurfCustomCalabash/CommonMethods.rb
75
79
  - lib/SurfCustomCalabash/DroidMethods.rb
76
80
  - lib/SurfCustomCalabash/IosMethods.rb
77
81
  - lib/SurfCustomCalabash/version.rb
82
+ - sources/Backdoors list
83
+ - sources/Gemfile
84
+ - sources/Scripts/and.sh
85
+ - sources/Scripts/ca.sh
86
+ - sources/Scripts/ci.sh
87
+ - sources/Scripts/data
88
+ - sources/Scripts/fa.sh
89
+ - sources/Scripts/fi.sh
90
+ - sources/Scripts/get_apk.rb
91
+ - sources/Scripts/get_scenarios.rb
92
+ - sources/Scripts/import_scenarios.rb
93
+ - sources/Scripts/ios.sh
94
+ - sources/Scripts/parallel_android_smoke.sh
95
+ - sources/Scripts/parallel_android_test.sh
96
+ - sources/Scripts/ra.sh
97
+ - sources/Scripts/ri.sh
98
+ - sources/Scripts/smoke_and.sh
99
+ - sources/Scripts/smoke_ios.sh
100
+ - sources/Scripts/ta.sh
101
+ - sources/Scripts/ti.sh
102
+ - sources/Scripts/to_exec.sh
103
+ - sources/Scripts/update.sh
104
+ - sources/Scripts/update_exec.rb
105
+ - sources/TestFolder/small.gif
106
+ - sources/ci/JenkinsfileUiTestAndroid.groovy
107
+ - sources/ci/JenkinsfileUiTestIos.groovy
108
+ - sources/config/cucumber.yml
109
+ - sources/features/android/pages/standard/DroidCommon.rb
110
+ - sources/features/android/pages/standard/Init_android.rb
111
+ - sources/features/android/pages/test.rb
112
+ - sources/features/android/support/app_life_cycle_hooks.rb
113
+ - sources/features/android/support/log_hooks_and.rb
114
+ - sources/features/android/support/video_hooks_and.rb
115
+ - sources/features/ios/pages/standard/Init_ios.rb
116
+ - sources/features/ios/pages/standard/IosCommon.rb
117
+ - sources/features/ios/pages/test.rb
118
+ - sources/features/ios/support/01_launch.rb
119
+ - sources/features/ios/support/log_hooks_ios.rb
120
+ - sources/features/ios/support/video_hooks_ios.rb
121
+ - sources/features/net/net.rb
122
+ - sources/features/net/screentest_api.rb
123
+ - sources/features/scenarios/eng.feature
124
+ - sources/features/scenarios/rus.feature
125
+ - sources/features/step_definitions/test.rb
126
+ - sources/features/support/credentials.rb
127
+ - sources/features/support/env.rb
128
+ - sources/features/support/hooks.rb
129
+ - sources/features/support/localization.rb
130
+ - sources/find_id.rb
131
+ - sources/group_steps.rb
132
+ - sources/irbrcs/android/irbrc
133
+ - sources/irbrcs/ios/irbrc
134
+ - sources/start.sh
78
135
  homepage: https://github.com/alexeyhripunov/SurfCustomCalabash
79
136
  licenses:
80
137
  - MIT