Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions calabash-cucumber/lib/calabash-cucumber/console_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ def text
# List the visible element with all marks.
def marks
opts = {:print => false, :return => true }
res = accessibility_marks(:id, opts).each { |elm|elm << :id }
res = accessibility_marks(:id, opts).each { |elm| elm << :id }
res.concat(accessibility_marks(:label, opts).each { |elm| elm << :label })
res.concat(text_marks(opts).each { |elm| elm << :text })
res.concat(text_marks(opts).each { |elm| elm.map! {|e| e ? e : ''} && elm << :text })
max_width = 0
res.each { |elm|
len = elm[0].length
max_width = len if len > max_width
}

counter = -1
res.sort_by.each { |elm|
res.sort.each { |elm|
printf("%4s %-6s => %#{max_width}s => %s\n",
"[#{counter = counter + 1}]",
elm[2], elm[0], elm[1])
Expand Down Expand Up @@ -155,6 +155,10 @@ def puts_console_details
# @param {Integer} max_width
def print_marks(marks, max_width)
counter = -1
# Replace nil elements with empty string to avoid "ArgumentError: comparison of Array with Array failed" error
marks.each { |elm|
elm.map! {|e| e ? e : ''}
}
marks.sort_by.each { |elm|

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you replace at this line sort_by with 'sort'?
I think this is the root cause for failing tests ;)

printf("%4s %#{max_width + 2}s => %s\n", "[#{counter = counter + 1}]", elm[0], elm[1])
}
Expand Down