zucchini-ios 0.7.2 → 0.7.3
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.
- data/CHANGELOG.md +9 -0
- data/lib/zucchini/feature.rb +5 -3
- data/lib/zucchini/log.rb +9 -5
- data/lib/zucchini/screenshot.rb +4 -0
- data/lib/zucchini/uia/lib/mechanic.js +2 -2
- data/lib/zucchini/uia/lib/util.coffee +4 -3
- data/lib/zucchini/uia/screen.coffee +1 -2
- data/lib/zucchini/version.rb +1 -1
- metadata +3 -3
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,9 @@ | |
| 1 | 
            +
            ## 0.7.3 / 2013-08-20
         | 
| 2 | 
            +
            * Fix timing problems due to mechanic.js changing timeout to 0 - [@phatmann][]
         | 
| 3 | 
            +
            * Fix: When using run -p, the orientation-specific masks are not used - [@phatmann][], [#36][]
         | 
| 4 | 
            +
            * Fix: Tapping an element shows "(null).tap()" in the log - [@phatmann][], [#37][]
         | 
| 5 | 
            +
            * Ignore error-based UIAutomation screenshots - [@phatmann], [#38][]
         | 
| 6 | 
            +
             | 
| 1 7 | 
             
            ## 0.7.2 / 2013-08-19
         | 
| 2 8 | 
             
            * Implement orientation specific masks - [@phatmann][], [#34][]
         | 
| 3 9 | 
             
            * Archivable HTML reports - [@vaskas][], [#33][]
         | 
| @@ -72,6 +78,9 @@ | |
| 72 78 | 
             
            [#32]: https://github.com/zucchini-src/zucchini/issues/32
         | 
| 73 79 | 
             
            [#33]: https://github.com/zucchini-src/zucchini/issues/33
         | 
| 74 80 | 
             
            [#34]: https://github.com/zucchini-src/zucchini/issues/34
         | 
| 81 | 
            +
            [#36]: https://github.com/zucchini-src/zucchini/issues/36
         | 
| 82 | 
            +
            [#37]: https://github.com/zucchini-src/zucchini/issues/37
         | 
| 83 | 
            +
            [#38]: https://github.com/zucchini-src/zucchini/issues/38
         | 
| 75 84 |  | 
| 76 85 | 
             
            [@Jaco-Pretorius]: https://github.com/Jaco-Pretorius
         | 
| 77 86 | 
             
            [@NathanSudell]: https://github.com/NathanSudell
         | 
    
        data/lib/zucchini/feature.rb
    CHANGED
    
    | @@ -36,16 +36,18 @@ class Zucchini::Feature | |
| 36 36 | 
             
              end
         | 
| 37 37 |  | 
| 38 38 | 
             
              def screenshots(process = true)
         | 
| 39 | 
            -
                log = Zucchini::Log.new(run_path) if process &&  | 
| 39 | 
            +
                log = Zucchini::Log.new(run_path) if process && Zucchini::Log.exists?(run_path)
         | 
| 40 40 |  | 
| 41 41 | 
             
                @screenshots ||= Dir.glob("#{run_path}/*.png").sort.map do |file|
         | 
| 42 | 
            +
                  next unless Zucchini::Screenshot.valid?(file)
         | 
| 43 | 
            +
             | 
| 42 44 | 
             
                  screenshot = Zucchini::Screenshot.new(file, @device, log)
         | 
| 43 45 | 
             
                  if process
         | 
| 44 46 | 
             
                    screenshot.mask
         | 
| 45 47 | 
             
                    screenshot.compare
         | 
| 46 48 | 
             
                  end
         | 
| 47 49 | 
             
                  screenshot
         | 
| 48 | 
            -
                end + unmatched_pending_screenshots
         | 
| 50 | 
            +
                end.compact + unmatched_pending_screenshots
         | 
| 49 51 | 
             
              end
         | 
| 50 52 |  | 
| 51 53 | 
             
              def stats
         | 
| @@ -69,7 +71,7 @@ class Zucchini::Feature | |
| 69 71 | 
             
                    @js_exception = true if (out.match /JavaScript error/) || (out.match /Instruments\ .{0,5}\ Error\ :/ )
         | 
| 70 72 | 
             
                  ensure
         | 
| 71 73 | 
             
                    `rm -rf instrumentscli*.trace`
         | 
| 72 | 
            -
                     | 
| 74 | 
            +
                    Zucchini::Log.parse_automation_log(run_path)
         | 
| 73 75 | 
             
                  end
         | 
| 74 76 | 
             
                end
         | 
| 75 77 | 
             
              end
         | 
    
        data/lib/zucchini/log.rb
    CHANGED
    
    | @@ -6,15 +6,11 @@ class Zucchini::Log | |
| 6 6 | 
             
              attr_reader :screenshot_log_path
         | 
| 7 7 |  | 
| 8 8 | 
             
              def initialize(path)
         | 
| 9 | 
            -
                @screenshot_log_path =  | 
| 9 | 
            +
                @screenshot_log_path = Zucchini::Log.screenshot_log_path(path)
         | 
| 10 10 | 
             
                raise "Screenshot log not found at #{@screenshot_log_path}" unless File.exists?(@screenshot_log_path)
         | 
| 11 11 | 
             
                @screenshots = File.open(@screenshot_log_path, 'r') { |f| YAML.load(f) }
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 | 
            -
              def exists?
         | 
| 15 | 
            -
                @screenshots != nil
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
             | 
| 18 14 | 
             
              def screenshot_metadata(sequence_number)
         | 
| 19 15 | 
             
                raise "Invalid screenshot sequence number #{sequence_number}" if sequence_number > @screenshots.size
         | 
| 20 16 | 
             
                @screenshots[sequence_number - 1]
         | 
| @@ -54,6 +50,14 @@ class Zucchini::Log | |
| 54 50 | 
             
                  false
         | 
| 55 51 | 
             
                end
         | 
| 56 52 | 
             
              end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              def self.exists?(path)
         | 
| 55 | 
            +
                File.exists?(screenshot_log_path(path))
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
              def self.screenshot_log_path(path)
         | 
| 59 | 
            +
                 File.join(path, YAML_FILE)
         | 
| 60 | 
            +
              end
         | 
| 57 61 | 
             
            end
         | 
| 58 62 |  | 
| 59 63 |  | 
    
        data/lib/zucchini/screenshot.rb
    CHANGED
    
    
| @@ -148,7 +148,7 @@ var mechanic = (function() { | |
| 148 148 | 
             
                };
         | 
| 149 149 |  | 
| 150 150 | 
             
                UIAElement.prototype.getElementsByAttr = function(attr, value) {
         | 
| 151 | 
            -
                    return $.map(this.elements() | 
| 151 | 
            +
                    return $.map(this.elements(), function(el) {
         | 
| 152 152 | 
             
                        var matches = el.getElementsByAttr(attr, value),
         | 
| 153 153 | 
             
                            val = el[attr]
         | 
| 154 154 | 
             
                        if (typeof val == 'function') val = val.apply(el)
         | 
| @@ -158,7 +158,7 @@ var mechanic = (function() { | |
| 158 158 | 
             
                    })
         | 
| 159 159 | 
             
                }
         | 
| 160 160 | 
             
                UIAElement.prototype.getElementsByType = function(type) {
         | 
| 161 | 
            -
                    return $.map(this.elements() | 
| 161 | 
            +
                    return $.map(this.elements(), function(el) {
         | 
| 162 162 | 
             
                        var matches = el.getElementsByType(type);
         | 
| 163 163 | 
             
                        if (el.isType(type)) matches.unshift(el);
         | 
| 164 164 | 
             
                        return matches;
         | 
| @@ -15,7 +15,7 @@ raise = (message) -> throw new Error(message) | |
| 15 15 | 
             
            # Handle both cases
         | 
| 16 16 | 
             
            _elementFrom = (finder) ->
         | 
| 17 17 | 
             
              res = finder()
         | 
| 18 | 
            -
              res = res[0] if  | 
| 18 | 
            +
              res = res[0] if res and typeof res.length is 'number'
         | 
| 19 19 | 
             
              res
         | 
| 20 20 |  | 
| 21 21 | 
             
            # Execute a finder function until the element appears
         | 
| @@ -24,14 +24,15 @@ wait = (finder) -> | |
| 24 24 | 
             
              counter = 0
         | 
| 25 25 | 
             
              element = null
         | 
| 26 26 |  | 
| 27 | 
            -
              while not found and  | 
| 27 | 
            +
              while not found and counter < 10
         | 
| 28 28 | 
             
                element = _elementFrom finder
         | 
| 29 29 |  | 
| 30 | 
            -
                if element? and element. | 
| 30 | 
            +
                if element? and element.checkIsValid() and element.isVisible()
         | 
| 31 31 | 
             
                  found = true
         | 
| 32 32 | 
             
                else
         | 
| 33 33 | 
             
                  target.delay 0.5
         | 
| 34 34 | 
             
                  counter++
         | 
| 35 | 
            +
             | 
| 35 36 | 
             
              if found then element else false
         | 
| 36 37 |  | 
| 37 38 | 
             
            rotateTo = (orientation) ->
         | 
| @@ -38,8 +38,7 @@ class Screen | |
| 38 38 | 
             
                'Wait for "([^"]*)" second[s]*$': (seconds) -> target.delay(seconds)
         | 
| 39 39 |  | 
| 40 40 | 
             
                'Type "([^"]*)" in the "([^"]*)" field$': (text, name) ->
         | 
| 41 | 
            -
                  @element(name). | 
| 42 | 
            -
                  app.keyboard().typeString text
         | 
| 41 | 
            +
                  $(@element(name)).input(text)
         | 
| 43 42 |  | 
| 44 43 | 
             
                'Clear the "([^"]*)" field$': (name) -> @element(name).setValue ''
         | 
| 45 44 |  | 
    
        data/lib/zucchini/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: zucchini-ios
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.7. | 
| 4 | 
            +
              version: 0.7.3
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013-08- | 
| 12 | 
            +
            date: 2013-08-19 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: clamp
         | 
| @@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 170 170 | 
             
                  version: '0'
         | 
| 171 171 | 
             
                  segments:
         | 
| 172 172 | 
             
                  - 0
         | 
| 173 | 
            -
                  hash:  | 
| 173 | 
            +
                  hash: 2982676141383125946
         | 
| 174 174 | 
             
            requirements: []
         | 
| 175 175 | 
             
            rubyforge_project: 
         | 
| 176 176 | 
             
            rubygems_version: 1.8.23
         |