diff options
Diffstat (limited to 'spec/features/projects/show')
3 files changed, 49 insertions, 4 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 diff --git a/spec/features/projects/show/user_sees_collaboration_links_spec.rb b/spec/features/projects/show/user_sees_collaboration_links_spec.rb index fb2f0539558..1440db141a6 100644 --- a/spec/features/projects/show/user_sees_collaboration_links_spec.rb +++ b/spec/features/projects/show/user_sees_collaboration_links_spec.rb @@ -39,7 +39,7 @@ RSpec.describe 'Projects > Show > Collaboration links', :js do # The dropdown above the tree page.within('.repo-breadcrumb') do - find('.qa-add-to-tree').click # rubocop:disable QA/SelectorUsage + find('[data-testid="add-to-tree"]').click aggregate_failures 'dropdown links above the repo tree' do expect(page).to have_link('New file') @@ -71,7 +71,7 @@ RSpec.describe 'Projects > Show > Collaboration links', :js do find_new_menu_toggle.click end - expect(page).not_to have_selector('.qa-add-to-tree') # rubocop:disable QA/SelectorUsage + expect(page).not_to have_selector('[data-testid="add-to-tree"]') expect(page).not_to have_link('Web IDE') end diff --git a/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb b/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb index 89f6b4237a4..5056e245fed 100644 --- a/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb +++ b/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb @@ -288,6 +288,17 @@ RSpec.describe 'Projects > Show > User sees setup shortcut buttons' do end end + it 'no Auto DevOps button if builds feature is disabled' do + project.project_feature.update_attribute(:builds_access_level, ProjectFeature::DISABLED) + + visit project_path(project) + + page.within('.project-buttons') do + expect(page).not_to have_link('Enable Auto DevOps') + expect(page).not_to have_link('Auto DevOps enabled') + end + end + it 'no "Enable Auto DevOps" button when .gitlab-ci.yml already exists' do Files::CreateService.new( project, |