OpenProject is the leading open source project management software.
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.
openproject/spec/features/work_packages/details/details_toolbar_spec.rb

30 lines
1.1 KiB

9 years ago
require 'spec_helper'
require 'features/work_packages/work_packages_page'
describe 'Work package details toolbar', js: true, selenium: true do
let(:project) { FactoryBot.create :project_with_types, is_public: true }
let!(:work_package) { FactoryBot.create :work_package, project: project }
9 years ago
let(:work_packages_page) { WorkPackagesPage.new(project) }
describe 'toggle watch state' do
let(:user) { FactoryBot.create :admin }
9 years ago
before do
login_as(user)
work_packages_page.visit_index(work_package)
end
it 'toggles the watch state' do
expect(work_package.watcher_users).not_to include(user)
expect(page).to have_selector('.work-packages--details-toolbar button', text: 'Watch')
within '.work-packages--details-toolbar' do
click_button 'Watch'
end
expect(page).to have_selector('.work-packages--details-toolbar button', text: 'Unwatch')
9 years ago
expect(work_package.reload.watcher_users).to include(user)
expect(page).to have_selector('.work-packages--details-toolbar button', text: 'Unwatch')
end
end
end