Skip to content

Commit

Permalink
Merge pull request #6536 from bgeuken/bugfix/bootstrap-spec
Browse files Browse the repository at this point in the history
Align the old UI with the new Bootstrap UI to pass the specs
  • Loading branch information
Dany Marcoux committed Dec 10, 2018
2 parents da89537 + c36bb35 commit 0228614
Show file tree
Hide file tree
Showing 18 changed files with 96 additions and 97 deletions.
4 changes: 2 additions & 2 deletions src/api/app/views/webui/project/_packages_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
<% if !@project.defines_remote_instance? && !(@is_incident_project && !@packages.blank? && @has_patchinfo && @open_release_requests.empty?) && !@is_maintenance_project %>
<ul class="horizontal-list">
<li>
<%= link_to(sprited_text('package_add', 'Create package'), controller: 'project', action: 'new_package', project: @project) %>
<%= link_to(sprited_text('package_add', 'Create Package'), controller: 'project', action: 'new_package', project: @project) %>
</li>
<li>
<%= link_to sprited_text('package_link', 'Branch existing package'), controller: :project, action: :new_package_branch, project: @project %>
<%= link_to sprited_text('package_link', 'Branch Existing Package'), controller: :project, action: :new_package_branch, project: @project %>
</li>
</ul>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/webui/project/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% @pagetitle = "Edit Project Information of #{@project}"
<% @pagetitle = "Edit Project #{@project}"
@metarobots = 'noindex'
project_bread_crumb 'Edit Project'
-%>
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/webui/project/new_package.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
<%= check_box_tag :disable_publishing %>
<label for="disable_publishing">Disable build results publishing.</label>
</p>
<p><%= submit_tag %></p>
<p><%= submit_tag 'Accept' %></p>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package.</p>
</p>
<%= hidden_field_tag 'target_project', @project %>
<%= render partial: 'shared/package_branch_form', locals: {show_project_field: false, target_project: @project} %>
<p><%= submit_tag "Create Branch" %></p>
<p><%= submit_tag 'Accept' %></p>
</div>
<% end %>
Expand Down
22 changes: 11 additions & 11 deletions src/api/app/views/webui/project/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -111,53 +111,53 @@
<ul class="horizontal-list">
<% if !@bugowners_mail.empty? && !CONFIG['bugzilla_host'].nil? %>
<li>
<%= link_to(sprited_text('tools-report-bug', 'Report bug'), bugzilla_url(@bugowners_mail, "#{@project.name}: Bug")) -%>
<%= link_to(sprited_text('tools-report-bug', 'Report Bug'), bugzilla_url(@bugowners_mail, "#{@project.name}: Bug")) -%>
</li>
<% end -%>
<% if @project.is_locked? && User.current.can_modify?(@project, true) %>
<li>
<%= link_to(sprited_text('lock_open', 'Unlock project'), { controller: 'project', action: 'unlock_dialog', project: @project.name }, remote: true) %>
<%= link_to(sprited_text('lock_open', 'Unlock Project'), { controller: 'project', action: 'unlock_dialog', project: @project.name }, remote: true) %>
</li>
<% elsif User.current.can_modify?(@project) %>
<% unless @project.defines_remote_instance? %>
<% if @is_incident_project && @packages.present? && @has_patchinfo && @open_release_requests.blank? %>
<li>
<%= link_to(sprited_text('brick_go', 'Request to release'), { controller: 'project', action: 'release_request_dialog', project: @project }, remote: true) %>
<%= link_to(sprited_text('brick_go', 'Request to Release'), { controller: 'project', action: 'release_request_dialog', project: @project }, remote: true) %>
</li>
<% elsif @is_maintenance_project %>
<li>
<%= link_to(sprited_text('brick_add', 'Create maintenance incident'), { controller: 'project', action: 'new_incident', ns: @project.name }, method: :post) %>
<%= link_to(sprited_text('brick_add', 'Create Maintenance Incident'), { controller: 'project', action: 'new_incident', ns: @project.name }, method: :post) %>
</li>
<% else %>
<% if @has_patchinfo %>
<li>
<%= link_to(sprited_text('information', 'Show patchinfo'), controller: 'patchinfo', action: 'show', project: @project, package: 'patchinfo') %>
<%= link_to(sprited_text('information', 'Show Patchinfo'), controller: 'patchinfo', action: 'show', project: @project, package: 'patchinfo') %>
</li>
<% else %>
<li>
<%= link_to(sprited_text('plugin_add', 'Create patchinfo'), { controller: 'patchinfo', action: :new_patchinfo, project: @project }, method: :post) %>
<%= link_to(sprited_text('plugin_add', 'Create Patchinfo'), { controller: 'patchinfo', action: :new_patchinfo, project: @project }, method: :post) %>
</li>
<% end %>
<% if !@is_incident_project && @releasetargets.length > 0 %>
<li>
<%= link_to(sprited_text('brick_go', 'Submit as update'), { controller: 'project', action: 'incident_request_dialog', project: @project }, remote: true) %>
<%= link_to(sprited_text('brick_go', 'Submit as Update'), { controller: 'project', action: 'incident_request_dialog', project: @project }, remote: true) %>
</li>
<% end %>
<%= render partial: 'webui/project/show/encryption_key_download_links' %>
<% end %>
<% end %>
<li>
<%= link_to(sprited_text('brick_edit', 'Edit description'), { action: 'edit', project: @project }, id: 'edit-description') %>
<%= link_to(sprited_text('brick_edit', 'Edit Project'), { action: 'edit', project: @project }, id: 'edit-project') %>
</li>
<li>
<%= link_to(sprited_text('brick_delete', 'Delete project'), { controller: 'project', action: 'delete_dialog', project: @project.name }, remote: true, id: 'delete-project') %>
<%= link_to(sprited_text('brick_delete', 'Delete Project'), { controller: 'project', action: 'delete_dialog', project: @project.name }, remote: true, id: 'delete-project') %>
</li>
<% elsif !@project.is_locked? %>
<li>
<%= link_to(sprited_text('user_add', 'Request role addition'), { controller: 'request', action: 'add_role_request_dialog', project: @project }, remote: true) %>
<%= link_to(sprited_text('user_add', 'Request Role Addition'), { controller: 'request', action: 'add_role_request_dialog', project: @project }, remote: true) %>
</li>
<li>
<%= link_to(sprited_text('package_delete', 'Request deletion'), { controller: 'request', action: 'delete_request_dialog', project: @project }, remote: true, id: 'request-deletion') %>
<%= link_to(sprited_text('package_delete', 'Request Deletion'), { controller: 'request', action: 'delete_request_dialog', project: @project }, remote: true, id: 'request-deletion') %>
</li>
<% end %>
</ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.dialog-buttons
= remove_dialog_tag('Cancel')
= submit_tag('Ok')
= submit_tag('Accept')
2 changes: 1 addition & 1 deletion src/api/app/views/webui2/webui/comment/_links.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%ul.list-inline
- unless User.current.is_nobody?
%li.list-inline-item.togglable_comment{ "data-toggle": "reply_form_of_#{comment.id}" }
%span.btn.btn-sm.btn-outline-secondary{ id: "reply_link_id_#{comment.id}" }
%button.btn.btn-sm.btn-outline-secondary{ id: "reply_link_id_#{comment.id}" }
Reply
- if policy(comment).destroy?
%li.list-inline-item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
.modal-content
.modal-header
%h5.modal-title#add-new-subproject-modal-label
Create subproject
Create Subproject
.modal-body
= render partial: 'form', locals: { project: Project.new, namespace: project.name, configuration: configuration }
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.modal-content
.modal-header
%h5.modal-title#new-package-branch-modal-label
Add new package branch to #{project.name}
Add New Package Branch to #{project.name}
%button.close{ type: 'button', data: { dismiss: 'modal' }, aria: { label: 'close' } }
%span{ aria: { hidden: true } }
&times
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.modal-content
.modal-header
%h5.modal-title#new-package-modal-label
Create new package for #{project.name}
Create New Package for #{project.name}
%button.close{ type: 'button', data: { dismiss: 'modal' }, aria: { label: 'close' } }
%span{ aria: { hidden: true } }
&times
Expand Down
20 changes: 9 additions & 11 deletions src/api/spec/bootstrap/features/webui/maintenance_workflow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
sleep 1 # Needed to avoid a flickering test.
expect(page).to have_text('Source')

within('#branch-modal .modal-footer') do
click_button('Accept')
end
click_button('Accept')
expect(page).to have_text('Successfully branched package')

# change the package sources so we have a difference
Expand All @@ -44,12 +42,12 @@
#####################################
visit project_show_path(project: 'home:tom:branches:ProjectWithRepo:Update')

click_link('Submit as update')
click_link('Submit as Update')
# we need this find to wait for the dialog to appear
expect(find(:css, '.dialog h2')).to have_text('Submit as Update')
fill_in('description', with: 'I want the update')

click_button('Ok')
click_button('Accept')
expect(page).to have_css('#flash-messages', text: 'Created maintenance incident request')

# Check that sending maintenance updates adds the source revision
Expand Down Expand Up @@ -102,11 +100,11 @@
login(user)
visit project_show_path(project: 'home:tom:branches:ProjectWithRepo:Update')

click_link('Submit as update')
click_link('Submit as Update')

expect(find(:css, '.dialog h2')).to have_text('Submit as Update')
fill_in('description', with: 'I have a additional fix')
click_button('Ok')
click_button('Accept')

logout

Expand All @@ -121,7 +119,7 @@

fill_in('incident_project', with: 2)

click_button('Ok')
click_button('Accept')
expect(page).to have_css('#flash-messages', text: 'Incident MaintenanceProject:2 does not exist')

click_link('Merge with existing incident')
Expand All @@ -130,18 +128,18 @@

fill_in('incident_project', with: 0)

click_button('Ok')
click_button('Accept')
expect(page).to have_css('#flash-messages', text: 'Set target of request 2 to incident 0')

click_button('accept_request_button')

# Step 7: The maintenance coordinator releases the request
##########################################################
visit project_show_path('MaintenanceProject:0')
click_link('Request to release')
click_link('Request to Release')

fill_in('description', with: 'RELEASE!')
click_button('Ok')
click_button('Accept')

# As we can't release without build results this should fail
expect(page).to have_css('#flash-messages',
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/bootstrap/features/webui/projects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
before do
login user
visit project_show_path(project: user.home_project)
click_link('Create package')
click_link('Create Package')
end

scenario 'with valid data' do
Expand All @@ -19,7 +19,7 @@
fill_in 'name', with: 'coolstuff'
fill_in 'title', with: 'cool stuff everyone needs'
fill_in 'description', with: very_long_description
click_button 'Save changes'
click_button 'Accept'

expect(page).to have_text("Package 'coolstuff' was created successfully")
expect(page).to have_current_path(package_show_path(project: user.home_project_name, package: 'coolstuff'))
Expand Down
1 change: 1 addition & 0 deletions src/api/spec/features/webui/comments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
end

scenario 'can be answered' do
skip_if_bootstrap
login user
comment = create(:comment_project, commentable: Project.first, user: user)
visit project_show_path(user.home_project)
Expand Down
16 changes: 8 additions & 8 deletions src/api/spec/features/webui/maintenance_workflow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
#####################################
visit project_show_path(project: 'home:tom:branches:ProjectWithRepo:Update')

click_link('Submit as update')
click_link('Submit as Update')
# we need this find to wait for the dialog to appear
expect(find(:css, '.dialog h2')).to have_text('Submit as Update')
fill_in('description', with: 'I want the update')

click_button('Ok')
click_button('Accept')
expect(page).to have_css('#flash-messages', text: 'Created maintenance incident request')

# Check that sending maintenance updates adds the source revision
Expand Down Expand Up @@ -101,11 +101,11 @@
login(user)
visit project_show_path(project: 'home:tom:branches:ProjectWithRepo:Update')

click_link('Submit as update')
click_link('Submit as Update')

expect(find(:css, '.dialog h2')).to have_text('Submit as Update')
fill_in('description', with: 'I have a additional fix')
click_button('Ok')
click_button('Accept')

logout

Expand All @@ -120,7 +120,7 @@

fill_in('incident_project', with: 2)

click_button('Ok')
click_button('Accept')
expect(page).to have_css('#flash-messages', text: 'Incident MaintenanceProject:2 does not exist')

click_link('Merge with existing incident')
Expand All @@ -129,18 +129,18 @@

fill_in('incident_project', with: 0)

click_button('Ok')
click_button('Accept')
expect(page).to have_css('#flash-messages', text: 'Set target of request 2 to incident 0')

click_button('accept_request_button')

# Step 7: The maintenance coordinator releases the request
##########################################################
visit project_show_path('MaintenanceProject:0')
click_link('Request to release')
click_link('Request to Release')

fill_in('description', with: 'RELEASE!')
click_button('Ok')
click_button('Accept')

# As we can't release without build results this should fail
expect(page).to have_css('#flash-messages',
Expand Down
6 changes: 3 additions & 3 deletions src/api/spec/features/webui/packages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
visit package_show_path(package: package, project: user.home_project)
click_link('delete-package')
expect(find('#del_dialog')).to have_text('Do you really want to delete this package?')
click_button('Ok')
click_button('Accept')
expect(find('#flash-messages')).to have_text('Package was successfully removed.')
end

Expand Down Expand Up @@ -155,7 +155,7 @@
click_link('Request deletion')
expect(page).to have_text('Do you really want to request the deletion of package ')
fill_in 'description', with: 'Hey, why not?'
click_button('Ok')
click_button('Accept')
expect(page).to have_text('Created delete request')
find('a', text: /delete request \d+/).click
expect(page.current_path).to match('/request/show/\\d+')
Expand All @@ -169,7 +169,7 @@
click_link('Request devel project change')
fill_in 'description', with: 'Hey, why not?'
fill_in 'devel_project', with: third_project.name
click_button 'Ok'
click_button('Accept')

expect(find('#flash-messages', visible: false)).not_to be_visible
request = BsRequest.where(description: 'Hey, why not?', creator: user.login, state: 'review')
Expand Down
10 changes: 5 additions & 5 deletions src/api/spec/features/webui/patchinfo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
scenario 'form incomplete' do
login user
visit project_show_path(user.home_project)
expect(page).to have_link('Create patchinfo')
click_link('Create patchinfo')
expect(page).to have_link('Create Patchinfo')
click_link('Create Patchinfo')
expect(page).to have_current_path(patchinfo_new_patchinfo_path(project: project))
expect(page).to have_text("Patchinfo-Editor for #{project.name}")
fill_in 'summary', with: 'A' * 9
Expand All @@ -24,8 +24,8 @@
scenario 'form complete' do
login user
visit project_show_path(user.home_project)
expect(page).to have_link('Create patchinfo')
click_link('Create patchinfo')
expect(page).to have_link('Create Patchinfo')
click_link('Create Patchinfo')
expect(page).to have_current_path(patchinfo_new_patchinfo_path(project: project))
expect(page).to have_text("Patchinfo-Editor for #{project.name}")
fill_in 'summary', with: 'A' * 15
Expand All @@ -49,7 +49,7 @@
expect(page).to have_link('Delete patchinfo')
click_link('Delete patchinfo')
expect(page).to have_text('Do you really want')
click_button('Ok')
click_button('Accept')
expect(page).to have_text('Patchinfo was successfully removed.')
end
end
Expand Down

0 comments on commit 0228614

Please sign in to comment.