diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/features/projects/show/user_interacts_with_stars_spec.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/features/projects/show/user_interacts_with_stars_spec.rb')
-rw-r--r-- | spec/features/projects/show/user_interacts_with_stars_spec.rb | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/spec/features/projects/show/user_interacts_with_stars_spec.rb b/spec/features/projects/show/user_interacts_with_stars_spec.rb index aa61b629d92..e0dd4f65010 100644 --- a/spec/features/projects/show/user_interacts_with_stars_spec.rb +++ b/spec/features/projects/show/user_interacts_with_stars_spec.rb @@ -14,14 +14,36 @@ RSpec.describe 'Projects > Show > User interacts with project stars' do end it 'toggles the star' do - find('.star-btn').click + star_project expect(page).to have_css('.star-count', text: 1) - find('.star-btn').click + unstar_project expect(page).to have_css('.star-count', text: 0) end + + it 'validates starring a project' do + project.add_owner(user) + + star_project + + visit(dashboard_projects_path) + + expect(page).to have_css('.stars', text: 1) + end + + it 'validates un-starring a project' do + project.add_owner(user) + + star_project + + unstar_project + + visit(dashboard_projects_path) + + expect(page).to have_css('.stars', text: 0) + end end context 'when user is not signed in' do @@ -38,3 +60,15 @@ RSpec.describe 'Projects > Show > User interacts with project stars' do end end end + +private + +def star_project + click_button(_('Star')) + wait_for_requests +end + +def unstar_project + click_button(_('Unstar')) + wait_for_requests +end |