skeleton-ui 0.0.8 → 0.0.10

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
  SHA256:
3
- metadata.gz: c301b9d52687f3843031beda4cd608a18a2fcc06734ce862b3a014bc0f2d9d2f
4
- data.tar.gz: d3caaf041f46998c118ec1903cad5b9f62729a41cedddf68b3ebf32da076c7e8
3
+ metadata.gz: 9596dca337705a799dda4d6536bd2c35b9a218eec53feed0c003168da8d7a3b4
4
+ data.tar.gz: 44213fdd53bf4e2d4f7392036ebd43a99918654a1e2bba9c9687e958e8abf7d5
5
5
  SHA512:
6
- metadata.gz: 499d4a571d2e945b930d9e867a94467bbdf45f05cf319e5d1c0b94b26c79c3ade9d88ae60d5c2779e2fe20c6f9fec89e0cdc9f0202585d4fba581b385bce6b3b
7
- data.tar.gz: 9d46204ef237d3aab08e2c9fa7d54e8d393a7cb2de735a013f06df04c1dd07c82e189a5715fbc3f0068b175da8089f2fe71741f7d3074a385cb444e970bc5310
6
+ metadata.gz: 659f23915b0a111a20bf61b4c6ee406e068b88f0a3132a12478ca224b9fa4dae1e56a85559fcb83805747e81e3b709fb37623b8585370fa1bd83e6a0bb507a11
7
+ data.tar.gz: 26a20a7c75f94cb2d75e51d4c8a7a0bf7074a86bd965b19eee1205a1754c54e04bb20f9bccff4391e1bdd0dde86a265f7b6252e290c4dbd56a5004e262e7d176
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ commit_regex="(ISSUE-[0-9]+|merge)"
4
+ if ! grep -iqE "$commit_regex" "$1"; then
5
+ echo "You need to add github issue tag in your commit, example: 'ISSUE-33: my pretty commit'"
6
+ exit 1
7
+ fi
8
+
9
+ list=$(git diff --cached --name-only --diff-filter=ACRM)
10
+ for file in $list; do
11
+ if [[ $file == *"root.rb"* || $file == *"project.pbxproj"* ]]; then
12
+ echo "You can't commit file $file. Please reset it and try again."
13
+ exit 1
14
+ fi
15
+ done
data/.gitignore CHANGED
@@ -1,7 +1,6 @@
1
1
  .DS_Store
2
- *.xcodeproj
3
2
  *.lock
4
- *.xcworkspace
3
+ *.xcuserdatad
5
4
  /PageObjects/
6
5
  /attach/
7
6
  /Attachments/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/Makefile ADDED
@@ -0,0 +1,3 @@
1
+ init:
2
+ git config core.hooksPath .githooks
3
+ git config advice.ignoredHook false
data/README.md CHANGED
@@ -21,7 +21,55 @@ Installation:
21
21
 
22
22
  Usage:
23
23
  ------
24
- $ skeleton scan -h
24
+ $ skeleton --help
25
+
26
+ DESCRIPTION:
27
+
28
+ CLI for fast generating multi language page objects from iOS and Android screens.
29
+
30
+ COMMANDS:
31
+
32
+ clear Clear user cache
33
+ scan Make screen objects
34
+
35
+ GLOBAL OPTIONS:
36
+
37
+ -h, --help
38
+ Display help documentation
39
+
40
+ -v, --version
41
+ Display version information
42
+
43
+ -t, --trace
44
+ Display backtrace when an error occurs
45
+
46
+ $ skeleton scan --help
47
+
48
+ EXAMPLES:
49
+
50
+ skeleton scan -p (ios or android) -u 749575366595763538563 -b com.my.bundle
51
+
52
+ OPTIONS:
53
+
54
+ -p, --platform PLATFORM
55
+ Set device platform: android or ios
56
+
57
+ -u, --udid UDID
58
+ Set device UDID
59
+
60
+ -b, --bundle BUNDLE
61
+ Set Bundle ID for your app [required for iOS]
62
+
63
+ $ skeleton clear --help
64
+
65
+ EXAMPLES:
66
+
67
+ skeleton clear
68
+
69
+ Docs:
70
+ ------
71
+
72
+ - [Setting up Skeleton for working with iOS real devices](https://github.com/forqa/skeleton/blob/master/docs/real-ios-device-config.md)
25
73
 
26
74
  ## License
27
75
 
@@ -0,0 +1,15 @@
1
+ ## Setting up Skeleton for working with iOS real devices
2
+
3
+ ### First manipulation (sign .xcodeproj)
4
+ Open Skeleton.xcodeproj in Xcode ($GEMDIR/gems/skeleton-ui-XXX/xcodeproj/Skeleton.xcodeproj).
5
+ For both the Skeleton and SkeletonUI targets, select "Automatically manage signing" in the "General" tab, and then select your Development Team. This should also auto select Signing Ceritificate. The outcome should look as shown below:
6
+ ![Signing XCProject](sign_xcproj.png)
7
+
8
+
9
+ ### Second manipulation (trust the developer)
10
+ ![Untrusted developer](untrusted-dev.png)
11
+
12
+ If you see this pop-up, you can go to Settings => General => Device Management on the device to trust
13
+ the developer and allow the `SkeletonUI-Runner` app to be run (see [Apple
14
+ documentation for more information](https://support.apple.com/en-us/HT204460)).
15
+
Binary file
Binary file
@@ -17,7 +17,7 @@ class Android < Base
17
17
  log.info('We starting to skeleton your screen 🚀')
18
18
  create_page_objects
19
19
  save_screenshot
20
- save(page_source)
20
+ save(code: page_source)
21
21
  log.info('We successfully skeletoned your screen 👻')
22
22
  end
23
23
 
@@ -26,21 +26,27 @@ class Android < Base
26
26
  def create_locator_by_resouce_id(line)
27
27
  method_name = line[RESOURCE_ID]
28
28
  method_name.slice!(/.*id\//)
29
- code_generation(method_name, ID, line[RESOURCE_ID])
29
+ code_generation(method_name: method_name,
30
+ locator_type: ID,
31
+ value: line[RESOURCE_ID])
30
32
  end
31
33
 
32
34
  def create_locator_by_content_desc(line)
33
35
  method_name = "#{line[CLASS]}#{increment_locator_id}"
34
36
  method_name.slice!(/.*\./)
35
37
  locator = "//#{line[CLASS]}[@#{CONTENT_DESC}='#{line[CONTENT_DESC]}']"
36
- code_generation(method_name, XPATH, locator)
38
+ code_generation(method_name: method_name,
39
+ locator_type: XPATH,
40
+ value: locator)
37
41
  end
38
42
 
39
43
  def create_locator_by_text(line)
40
44
  method_name = "#{line[CLASS]}#{increment_locator_id}"
41
45
  method_name.slice!(/.*\./)
42
46
  locator = "//#{line[CLASS]}[@#{TEXT}='#{line[TEXT]}'"
43
- code_generation(method_name, XPATH, locator)
47
+ code_generation(method_name: method_name,
48
+ locator_type: XPATH,
49
+ value: locator)
44
50
  end
45
51
 
46
52
  def create_locator(line)
@@ -59,14 +65,9 @@ class Android < Base
59
65
  page_source_html.css('node').each { |line| create_locator(line) }
60
66
  end
61
67
 
62
- def code_generation(method_name, locator_type, value)
68
+ def code_generation(method_name:, locator_type:, value:)
63
69
  java = java(method_name, locator_type, value)
64
- save(java, format: Language::JAVA)
65
- end
66
-
67
- def save(code, format: 'xml')
68
- file_path = "#{PAGE_OBJECTS_FOLDER}/#{@platform}_#{TIMESTAMP}.#{format}"
69
- File.open(file_path, 'a') { |f| f.write(code) }
70
+ save(code: java, format: Language::JAVA)
70
71
  end
71
72
 
72
73
  def page_source
@@ -75,7 +76,7 @@ class Android < Base
75
76
  dump = `adb -s #{@udid} shell uiautomator dump | egrep -o '/.*?xml'`
76
77
  @page_source = `adb -s #{@udid} shell cat #{dump}`
77
78
  if @page_source.empty?
78
- log.fatal('Something went wrong.') # FIXME
79
+ log.fatal('Something went wrong. Check your device')
79
80
  Process.exit(1)
80
81
  end
81
82
  log.info('Successfully getting Screen Source Tree 🔥')
data/lib/skeleton/base.rb CHANGED
@@ -1,11 +1,9 @@
1
1
  require_relative 'languages.rb'
2
+ require_relative 'root.rb'
2
3
 
3
4
  class Base
4
5
  include Language
5
6
 
6
- # ROOT_DIR_FOR_DEBUG = File.expand_path('..', Dir.pwd)
7
- ROOT_DIR = "#{`gem environment gemdir`.strip}" \
8
- "/gems/skeleton-ui-#{Skeleton::VERSION}"
9
7
  PAGE_OBJECTS_FOLDER = "#{ROOT_DIR}/PageObjects"
10
8
  ATTACHMENTS_FOLDER = "#{ROOT_DIR}/Attachments"
11
9
  TIMESTAMP = (Time.now.to_f * 1000).to_i
@@ -28,6 +26,11 @@ class Base
28
26
 
29
27
  protected
30
28
 
29
+ def save(code:, format: 'xml')
30
+ file_path = "#{PAGE_OBJECTS_FOLDER}/#{@platform}_#{TIMESTAMP}.#{format}"
31
+ File.open(file_path, 'a') { |f| f.write(code) }
32
+ end
33
+
31
34
  def create_logger
32
35
  @log = Logger.new(STDOUT)
33
36
  @log.level = Logger::INFO
@@ -58,7 +61,7 @@ class Base
58
61
  space_i = 0
59
62
  method_name[0] = method_name[0].downcase
60
63
  method_name.each_char.with_index do |char, char_i|
61
- if /[ -!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]/.match(char)
64
+ if /[ -!@#$%^&*()_+|~=`{}\[\]:";'<>?,.\/]/.match(char)
62
65
  method_name[char_i - space_i] = ''
63
66
  method_name[char_i - space_i] = method_name[char_i - space_i].capitalize
64
67
  space_i += 1
@@ -78,5 +81,4 @@ class Base
78
81
 
79
82
  def code_generation
80
83
  end
81
-
82
- end
84
+ end
data/lib/skeleton/ios.rb CHANGED
@@ -26,7 +26,7 @@ class IOS < Base
26
26
  page_source
27
27
  create_page_objects
28
28
  save_screenshot
29
- save(page_source)
29
+ save(code: page_source)
30
30
  log.info('We successfully skeletoned your screen 👻')
31
31
  end
32
32
 
@@ -45,13 +45,17 @@ class IOS < Base
45
45
 
46
46
  def create_locator_by_id(locator)
47
47
  method_name = locator.strip
48
- code_generation(method_name, ACC_ID, locator)
48
+ code_generation(method_name: method_name,
49
+ locator_type: ACC_ID,
50
+ value: locator)
49
51
  end
50
52
 
51
53
  def create_locator_by_label(text, type)
52
54
  method_name = "#{type}#{increment_locator_id}"
53
55
  locator = "#{LABEL} like '#{text}'"
54
- code_generation(method_name, NSPREDICATE, locator)
56
+ code_generation(method_name: method_name,
57
+ locator_type: NSPREDICATE,
58
+ value: locator)
55
59
  end
56
60
 
57
61
  def create_page_objects
@@ -78,12 +82,12 @@ class IOS < Base
78
82
  locator.nil? ? '' : locator[1]
79
83
  end
80
84
 
81
- def code_generation(method_name, locator_type, value)
85
+ def code_generation(method_name:, locator_type:, value:)
82
86
  java = java(method_name, locator_type, value)
83
- ruby = ruby(method_name, locator_type, value)
87
+ save(code: java, format: Language::JAVA)
84
88
 
85
- save(java, format: Language::JAVA)
86
- save(ruby, format: Language::RUBY)
89
+ ruby = ruby(method_name, locator_type, value)
90
+ save(code: ruby, format: Language::RUBY)
87
91
  end
88
92
 
89
93
  def page_source
@@ -104,7 +108,7 @@ class IOS < Base
104
108
  if @page_source.empty?
105
109
  log.fatal('Something went wrong. Try to sign Skeleton ' \
106
110
  'and to trust it in the iOS settings.')
107
- Process.exit(1)
111
+ raise
108
112
  end
109
113
  log.info('Successfully getting Screen Source Tree 🔥')
110
114
  end
@@ -116,18 +120,13 @@ class IOS < Base
116
120
  log.info('Checking iOS UDID 👨‍💻')
117
121
  simulators = `xcrun simctl list`
118
122
  @simulator = simulators.include?(@udid)
119
- if !@simulator && !`instruments -s devices`.include?("[#{@udid}]")
123
+ if !@simulator && !`instruments -s devices`.include?(@udid)
120
124
  log.fatal("No such devices with UDID: #{@udid}")
121
- Process.exit(1)
125
+ raise
122
126
  end
123
127
  end
124
128
  end
125
129
 
126
- def save(code, format: 'xml')
127
- file_path = "#{PAGE_OBJECTS_FOLDER}/#{@platform}_#{TIMESTAMP}.#{format}"
128
- File.open(file_path, 'a') { |f| f.write(code) }
129
- end
130
-
131
130
  def save_screenshot
132
131
  log.info('Saving screenshot 📷')
133
132
  png_path = "#{XCRESULTS_FOLDER}/Attachments/*.png"
@@ -0,0 +1,5 @@
1
+ class Base
2
+ # ROOT_DIR_FOR_DEBUG = File.expand_path('..', Dir.pwd)
3
+ ROOT_DIR = "#{`gem environment gemdir`.strip}" \
4
+ "/gems/#{Skeleton::GEM_NAME}-#{Skeleton::VERSION}"
5
+ end
@@ -1,4 +1,4 @@
1
1
  module Skeleton
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.10'
3
3
  GEM_NAME = 'skeleton-ui'
4
4
  end
data/skeleton.gemspec CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.16"
28
28
  spec.add_development_dependency "rake", "~> 12.3.0"
29
+ spec.add_development_dependency "rspec", "~> 3.7"
29
30
  spec.add_dependency "colorize", "~> 0.8.1"
30
31
  spec.add_dependency "nokogiri", "~> 1.8.2"
31
32
  spec.add_dependency "fileutils"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skeleton-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - a.alterpesotskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2018-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 12.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.7'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: colorize
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -102,20 +116,27 @@ executables:
102
116
  extensions: []
103
117
  extra_rdoc_files: []
104
118
  files:
119
+ - ".githooks/commit-msg"
105
120
  - ".gitignore"
121
+ - ".rspec"
106
122
  - CODE_OF_CONDUCT.md
107
123
  - Gemfile
108
124
  - LICENSE.txt
125
+ - Makefile
109
126
  - README.md
110
127
  - Rakefile
111
128
  - bin/console
112
129
  - bin/setup
113
130
  - bin/skeleton
131
+ - docs/real-ios-device-config.md
132
+ - docs/sign_xcproj.png
133
+ - docs/untrusted-dev.png
114
134
  - lib/skeleton.rb
115
135
  - lib/skeleton/android.rb
116
136
  - lib/skeleton/base.rb
117
137
  - lib/skeleton/ios.rb
118
138
  - lib/skeleton/languages.rb
139
+ - lib/skeleton/root.rb
119
140
  - lib/skeleton/version.rb
120
141
  - skeleton.gemspec
121
142
  - xcodeproj/Skeleton.xcodeproj/project.pbxproj