kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.6 KiB
58 lines
1.6 KiB
7 years ago
|
require 'spec_helper'
|
||
|
require_relative 'support/pages/cost_report_page'
|
||
|
|
||
|
describe 'Cost report saving', type: :feature, js: true do
|
||
7 years ago
|
let(:project) { FactoryBot.create :project }
|
||
|
let(:user) { FactoryBot.create :admin }
|
||
7 years ago
|
|
||
7 years ago
|
let(:report_page) { ::Pages::CostReportPage.new project }
|
||
7 years ago
|
|
||
|
before do
|
||
|
login_as(user)
|
||
|
visit cost_reports_path(project)
|
||
|
end
|
||
|
|
||
|
it 'can save reports privately' do
|
||
|
report_page.clear
|
||
|
|
||
|
report_page.add_to_columns 'Work package'
|
||
|
report_page.add_to_rows 'Project'
|
||
|
|
||
|
report_page.save as: 'Testreport'
|
||
|
|
||
|
expect(page).to have_selector('#ur_caption', text: 'Testreport')
|
||
|
expect(page).to have_selector('#private_sidebar_report_list', text: 'Testreport')
|
||
|
|
||
|
report_page.expect_column_element 'Work package'
|
||
|
report_page.expect_row_element 'Project'
|
||
|
end
|
||
|
|
||
|
it 'can save reports publicly' do
|
||
|
report_page.clear
|
||
|
|
||
|
report_page.add_to_columns 'Work package'
|
||
|
report_page.add_to_rows 'Project'
|
||
|
|
||
|
report_page.save as: 'Public report', public: true
|
||
|
|
||
|
expect(page).to have_selector('#ur_caption', text: 'Public report')
|
||
|
expect(page).to have_selector('#public_sidebar_report_list', text: 'Public report')
|
||
|
|
||
|
report_page.expect_column_element 'Work package'
|
||
|
report_page.expect_row_element 'Project'
|
||
|
end
|
||
|
|
||
|
context 'as user without permissions' do
|
||
7 years ago
|
let(:role) { FactoryBot.create :role, permissions: %i(view_time_entries) }
|
||
7 years ago
|
let!(:user) do
|
||
7 years ago
|
FactoryBot.create :user,
|
||
7 years ago
|
member_in_project: project,
|
||
|
member_through_role: role
|
||
|
end
|
||
|
|
||
|
it 'cannot save reports' do
|
||
|
expect(page).to have_no_selector('.buttons', text: 'Save')
|
||
|
end
|
||
|
end
|
||
|
end
|