Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug on Request bugowner change link
In the Search Owner page there is a link to request a new bugowner for the package. The new bugowner can be a user or a group, not both. However, the action was always requiring both fields by mistake. Now only one is required and sent. Fixed in both old and new UI. Reuses the same JavaScript function used to add a reviewer to a requet, which has been slightly improved. Co-authored-by: David Kang <dkang@suse.com>
- Loading branch information
Showing
7 changed files
with
85 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/api/spec/bootstrap/features/webui/change_bugowner_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
require 'browser_helper' | ||
|
||
RSpec.feature 'Bootstrap_ChangeBugowner', type: :feature, js: true do | ||
let!(:bugowner) { create(:confirmed_user, :with_home, login: 'Iggy') } | ||
let!(:package) { create(:package, name: 'TestPack', project: project) } | ||
let(:project) { Project.find_by(name: 'home:Iggy') } | ||
let!(:new_bugowner) { create(:confirmed_user, :with_home, login: 'Milo') } | ||
let!(:group) { create(:group, title: 'Heroes') } | ||
|
||
let!(:collection) do | ||
file_fixture('owner_search_collection.xml').read | ||
end | ||
let!(:bug_collection) do | ||
file_fixture('owner_search_bugownership_collection.xml').read | ||
end | ||
|
||
before do | ||
login bugowner | ||
create(:attrib, attrib_type: AttribType.where(name: 'OwnerRootProject').first, project: Project.find_by(name: 'home:Iggy')) | ||
create(:relationship_package_user, package: package, user: bugowner, role: Role.find_by_title('bugowner')) | ||
allow(Backend::Api::Search).to receive(:binary).and_return(collection) | ||
|
||
visit search_owner_path | ||
fill_in :search_input, with: package.name | ||
click_button 'Search' | ||
click_link 'Request bugowner change' | ||
end | ||
|
||
context 'with a user as new bugowner' do | ||
scenario 'the bugowner is changed' do | ||
fill_in :user, with: 'Milo' | ||
fill_in :description, with: 'Replace current bugowner by Milo' | ||
click_button 'Submit' | ||
expect(page).to have_text("#{bugowner.name} (#{bugowner.login}) wants the user #{new_bugowner.name} (#{new_bugowner.login}) to become bugowner (previous bugowners will be deleted)") | ||
end | ||
end | ||
|
||
context 'with a group as new bugowner' do | ||
scenario 'the bugowner is changed by a group' do | ||
find(:id, 'review_type').select('Group') | ||
fill_in :group, with: 'Heroes' | ||
fill_in :description, with: 'Replace current bugowner by group Heroes' | ||
click_button 'Submit' | ||
expect(page).to have_text("#{bugowner.name} (#{bugowner.login}) wants the group #{group.title} to become bugowner (previous bugowners will be deleted)") | ||
end | ||
end | ||
|
||
context 'forcing to add both user and group as bugowner' do | ||
scenario 'only the visible one before submitting is added' do | ||
find(:id, 'review_type').select('Group') | ||
fill_in :group, with: 'Heroes' | ||
find(:id, 'review_type').select('User') | ||
fill_in :user, with: 'Milo' | ||
fill_in :description, with: 'Replace current bugowner by something else' | ||
click_button 'Submit' | ||
expect(page).to have_text("#{bugowner.name} (#{bugowner.login}) wants the user #{new_bugowner.name} (#{new_bugowner.login}) to become bugowner (previous bugowners will be deleted)") | ||
expect(page).not_to have_text('Heroes') | ||
end | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
src/api/spec/fixtures/files/owner_search_bugownership_collection.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<collection matches="3"> | ||
<binary name="package" project="home:Iggy" package="package" repository="10.2" version="1.0" release="1" arch="i586" filename="package-1.0-1.i586.rpm" filepath="home:/Iggy/10.2/i586/package-1.0-1.i586.rpm" baseproject="BaseDistro" type="rpm" /> | ||
<binary name="package" project="home:Iggy" package="package.42" repository="10.2" version="1.0" release="1" arch="i586" filename="package-1.0-1.i586.rpm" filepath="home:/Iggy/10.2/i586/package-1.0-1.i586.rpm" baseproject="BaseDistro" type="rpm" /> | ||
<binary name="package" project="home:Iggy" package="patchinfo.42" repository="10.2" version="1.0" release="1" arch="i586" filename="package-1.0-1.i586.rpm" filepath="home:/Iggy/10.2/i586/package-1.0-1.i586.rpm" baseproject="BaseDistro" type="rpm" /> | ||
</collection> |