Skip to content

Commit

Permalink
[webui-testsuite] find the project/package title by id not by random …
Browse files Browse the repository at this point in the history
…xpath
  • Loading branch information
coolo committed Mar 26, 2012
1 parent ce3547d commit 10fd5c5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def validate_page
assert @url.start_with? $data[:url] + "/package/show"
validate { @driver.page_source.include? "Information" }
validate { @driver.page_source.include? "Actions" }
validate { @driver.page_source.include? "Build Status" }
validate { @driver.page_source.include? "Build Results" }
end


Expand Down Expand Up @@ -74,14 +74,14 @@ def request_deletion description
# ============================================================================
#
def package_title
@driver[:xpath => "//div[@id='content']//p"].text
@driver[:id => "package_title"].text
end


# ============================================================================
#
def package_description
@driver[:xpath => "//div[@id='content']//p[2]"].text
@driver[:id => "description"].text
end


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def request_deletion description
# ============================================================================
#
def project_title
@driver[:xpath => "//div[@id='content']//h3"].text
@driver[:id => "project_title"].text
end


Expand All @@ -89,7 +89,7 @@ def project_title
# will probably get trimmed and stripped when displayed.
#
def project_description
@driver[:xpath => "//div[@id='content']//p"].text
@driver[:id => "description"].text
end


Expand Down
2 changes: 1 addition & 1 deletion src/webui-testsuite/lib/common/TestCase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def run
error.backtrace.each { |line| @message += line + "\n" }
@screenshot = $data[:report_path] + "#{@name}.png"
$page.save_screenshot @screenshot
File.open($data[:report_path] + "#{@name}.source.html", "w").write($page.page_source)
$page.save_source_html $data[:report_path] + "#{@name}.source.html"
else
@status = :pass
@message = "Cheers!"
Expand Down
8 changes: 7 additions & 1 deletion src/webui-testsuite/lib/common/WebPage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,11 @@ def save_screenshot path
@driver.save_screenshot path
end


# ============================================================================
# Saves the page source of the current web-page
# @param [String] path the resulting file
def save_source_html path
File.open(path, "w").write(@driver.page_source)
end

end
2 changes: 2 additions & 0 deletions src/webui-testsuite/run_acceptance_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ def distribute(*args)
"edit_project_user_remove_all_roles",
"delete_subproject",
"delete_project_attribute_at_remote_project_as_user",
"create_home_project_package_for_user",
"change_home_project_title",
"remove_user_real_name",
"real_name_stays_changed",
"edit_project_user_add_all_roles"]
Expand Down

0 comments on commit 10fd5c5

Please sign in to comment.