class TestCenter::Helper::HtmlTestReport::TestCase
Attributes
root[R]
Public Class Methods
new(testcase_element)
click to toggle source
# File lib/fastlane/plugin/test_center/helper/html_test_report.rb, line 246 def initialize(testcase_element) @root = testcase_element end
Public Instance Methods
failure_details()
click to toggle source
# File lib/fastlane/plugin/test_center/helper/html_test_report.rb, line 269 def failure_details return nil if @root.attribute('class').value.include?('passing') xpath_class_attributes = [ "contains(concat(' ', @class, ' '), ' details ')", "contains(concat(' ', @class, ' '), ' failing ')", "contains(concat(' ', @class, ' '), ' #{title} ')" ].join(' and ') REXML::XPath.first(@root.parent, ".//*[#{xpath_class_attributes}]") end
passing?()
click to toggle source
# File lib/fastlane/plugin/test_center/helper/html_test_report.rb, line 254 def passing? @root.attribute('class').value.include?('passing') end
remove_failure_details()
click to toggle source
# File lib/fastlane/plugin/test_center/helper/html_test_report.rb, line 280 def remove_failure_details details = failure_details return if details.nil? details.parent.delete_element(details) end
row_color()
click to toggle source
# File lib/fastlane/plugin/test_center/helper/html_test_report.rb, line 258 def row_color @root.attribute('class').value.include?('odd') ? 'odd' : '' end
set_row_color(row_color)
click to toggle source
# File lib/fastlane/plugin/test_center/helper/html_test_report.rb, line 262 def set_row_color(row_color) raise 'row_color must either be "odd" or ""' unless ['odd', ''].include?(row_color) current_class_attribute = @root.attribute('class').value.sub(/\bodd\b/, '') @root.add_attribute('class', current_class_attribute << ' ' << row_color) end
title()
click to toggle source
# File lib/fastlane/plugin/test_center/helper/html_test_report.rb, line 250 def title REXML::XPath.first(@root, ".//h3[contains(@class, 'title')]/text()").to_s.strip end
update_testcase(testcase)
click to toggle source
# File lib/fastlane/plugin/test_center/helper/html_test_report.rb, line 287 def update_testcase(testcase) color = row_color failure = failure_details if failure.nil? && !passing? HtmlTestReport.error("\t\t\t\tupdating failing test case that does not have failure_details") end parent = @root.parent failure.parent.delete(failure) unless failure.nil? new_failure = testcase.failure_details if new_failure && testcase.passing? HtmlTestReport.error("\t\t\t\tswapping passing failing test case that _does_have_ failure_details") end parent.replace_child(@root, testcase.root) @root = testcase.root unless new_failure.nil? parent.insert_after(@root, new_failure) end set_row_color(color) end