Commit 4a525497 authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'test-for-exporting-issues-as-csv' into 'master'

Test for exporting issues as CSV

Closes gitlab-org/quality/testcases#179

See merge request gitlab-org/gitlab!20482
parents ecf6f8b3 0370f421
- if (current_user && @project.feature_available?(:export_issues)) || show_promotions?
%button.csv_download_link.btn.has-tooltip{ title: _('Export as CSV'),
data: { toggle: 'modal', target: '.issues-export-modal' } }
data: { toggle: 'modal', target: '.issues-export-modal', qa_selector: 'export_as_csv_button' } }
= sprite_icon('export')
- if current_user && @project.feature_available?(:export_issues)
.issues-export-modal.modal
.modal-dialog
.modal-content
.modal-content{ data: { qa_selector: 'export_issues_modal' } }
.modal-header
%h3
= _('Export issues')
......@@ -17,6 +17,6 @@
.modal-text
= _('The CSV export will be created in the background. Once finished, it will be sent to <strong>%{email}</strong> in an attachment.').html_safe % { email: @current_user.notification_email }
.modal-footer
= link_to _('Export issues'), export_csv_project_issues_path(@project, request.query_parameters), method: :post, class: 'btn btn-success float-left', title: _('Export issues'), data: { track_label: "export_issues_csv", track_event: "click_button", track_value: "" }
= link_to _('Export issues'), export_csv_project_issues_path(@project, request.query_parameters), method: :post, class: 'btn btn-success float-left', title: _('Export issues'), data: { track_label: "export_issues_csv", track_event: "click_button", track_value: "", qa_selector: "export_issues_button" }
- elsif show_promotions?
= render 'shared/promotions/promote_csv_export'
......@@ -16,9 +16,30 @@ module QA
view 'ee/app/views/projects/issues/_issue_weight.html.haml' do
element :issuable_weight
end
view 'ee/app/views/projects/issues/export_csv/_button.html.haml' do
element :export_as_csv_button
end
view 'ee/app/views/projects/issues/export_csv/_modal.html.haml' do
element :export_issues_button
element :export_issues_modal
end
end
end
def click_export_as_csv_button
click_element(:export_as_csv_button)
end
def click_export_issues_button
click_element(:export_issues_button)
end
def export_issues_modal
find_element(:export_issues_modal)
end
def issuable_weight
find_element(:issuable_weight)
end
......
# frozen_string_literal: true
require 'securerandom'
module QA
context 'Plan' do
describe 'Issues list' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project-to-test-export-issues-as-csv'
end
end
before do
Flow::Login.sign_in
2.times do
Resource::Issue.fabricate_via_api! do |issue|
issue.project = project
issue.title = "Issue-#{SecureRandom.hex(4)}"
end
end
project.visit!
Page::Project::Menu.perform(&:click_issues)
end
it 'successfully exports issues list as CSV' do
Page::Project::Issue::Index.perform do |index|
index.click_export_as_csv_button
expect(index.export_issues_modal).to have_content('2 issues selected')
index.click_export_issues_button
expect(index).to have_content(/Your CSV export has started. It will be emailed to (\S+) when complete./)
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment