Skip to content

Commit

Permalink
[webui] Refactor test_create_patchinfo_with_issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Sep 9, 2015
1 parent beb136e commit 40218ea
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions src/api/test/functional/webui/patchinfo_create_test.rb
Expand Up @@ -191,6 +191,41 @@ def test_create_patchinfo_with_binaries
delete_patchinfo('home:Iggy')
end

def test_create_patchinfo_with_issues
login_Iggy
visit project_show_path(project: "home:Iggy")

click_link("Create patchinfo")
fill_in "summary", with: "This is a test for the patchinfo-editor"
fill_in "description", with: LONG_DESCRIPTION

issues = ["bnc#770555", "bnc#700500"]
fill_in "issue", with: issues.join(",")
find(:css, "img[alt=\"Add Bug\"]").click
find_link(issues.last)
click_button("Save Patchinfo")

issues.each do |issue|
page.must_have_text issue
end

# now add issues with wrong formats
click_link("Edit patchinfo")
# no issue should be added
fill_in "issue", with: "bgo#123456.bnc#700501"
find(:css, "img[alt=\"Add Bug\"]").click
page.evaluate_script('window.confirm = function() { return true; }')
# the last issue should be added
fill_in "issue", with: "121212,bnc#700501"
find(:css, "img[alt=\"Add Bug\"]").click
page.evaluate_script('window.confirm = function() { return true; }')
page.wont_have_content("121212")
find_link("bnc#700501")
click_button("Save Patchinfo") # FIXME: This doesn't have any effect here

delete_patchinfo('home:Iggy')
end

def open_new_patchinfo
click_link("Create patchinfo")
page.must_have_text "Patchinfo-Editor for "
Expand Down Expand Up @@ -295,35 +330,4 @@ def test_create_patchinfo_and_edit_it
:issue => "bnc#700500")
delete_patchinfo('home:Iggy')
end


def test_create_patchinfo_with_issues
login_Iggy
visit project_show_path(project: "home:Iggy")
open_new_patchinfo
create_patchinfo_for_test(
:summary => "This is a test for the patchinfoeditor",
:description => LONG_DESCRIPTION,
:category => "optional",
:rating => "critical",
:issue => "bnc#770555,bnc#700500")

# now add issues with wrong formats
click_link("Edit patchinfo")
# no issue should be added
fill_in "issue", with: "bgo#123456.bnc#700501"
find(:css, "img[alt=\"Add Bug\"]").click
page.evaluate_script('window.confirm = function() { return true; }')
# the last issue should be added
fill_in "issue", with: "121212,bnc#700501"
find(:css, "img[alt=\"Add Bug\"]").click
page.evaluate_script('window.confirm = function() { return true; }')
page.wont_have_content("121212")
find_link("bnc#700501")
issues = "123456,bnc#700501".gsub(/\s+/, "").split(",")
find_link(issues.last)
click_button("Save Patchinfo")

delete_patchinfo('home:Iggy')
end
end

0 comments on commit 40218ea

Please sign in to comment.