2017-02-28 15:50:57 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 06:30:33 -04:00
|
|
|
feature 'Dashboard Projects' do
|
2017-03-13 08:24:06 -04:00
|
|
|
let(:user) { create(:user) }
|
2017-08-01 14:51:52 -04:00
|
|
|
let(:project) { create(:project, :repository, name: 'awesome stuff') }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project2) { create(:project, :public, name: 'Community project') }
|
2017-03-13 08:24:06 -04:00
|
|
|
|
2017-02-28 15:50:57 -05:00
|
|
|
before do
|
2017-03-13 08:24:06 -04:00
|
|
|
project.team << [user, :developer]
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token" do
|
|
|
|
before do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
end
|
2017-02-28 15:50:57 -05:00
|
|
|
end
|
2017-03-13 08:24:06 -04:00
|
|
|
|
|
|
|
it 'shows the project the user in a member of in the list' do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
expect(page).to have_content('awesome stuff')
|
|
|
|
end
|
|
|
|
|
2017-06-29 06:30:33 -04:00
|
|
|
it 'shows "New project" button' do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
page.within '#content-body' do
|
|
|
|
expect(page).to have_link('New project')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-06-26 01:42:44 -04:00
|
|
|
context 'when last_repository_updated_at, last_activity_at and update_at are present' do
|
|
|
|
it 'shows the last_repository_updated_at attribute as the update date' do
|
|
|
|
project.update_attributes!(last_repository_updated_at: Time.now, last_activity_at: 1.hour.ago)
|
2017-06-03 22:40:59 -04:00
|
|
|
|
2017-06-26 01:42:44 -04:00
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
expect(page).to have_xpath("//time[@datetime='#{project.last_repository_updated_at.getutc.iso8601}']")
|
|
|
|
end
|
|
|
|
end
|
2017-06-03 22:40:59 -04:00
|
|
|
|
2017-06-26 01:42:44 -04:00
|
|
|
context 'when last_repository_updated_at and last_activity_at are missing' do
|
|
|
|
it 'shows the updated_at attribute as the update date' do
|
|
|
|
project.update_attributes!(last_repository_updated_at: nil, last_activity_at: nil)
|
|
|
|
project.touch
|
|
|
|
|
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
expect(page).to have_xpath("//time[@datetime='#{project.updated_at.getutc.iso8601}']")
|
|
|
|
end
|
2017-06-03 22:40:59 -04:00
|
|
|
end
|
|
|
|
|
2017-09-19 08:43:04 -04:00
|
|
|
context 'when on Your projects tab' do
|
|
|
|
it 'shows all projects by default' do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
expect(page).to have_content(project.name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows personal projects on personal projects tab', :js do
|
|
|
|
project3 = create(:project, namespace: user.namespace)
|
|
|
|
|
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
click_link 'Personal'
|
|
|
|
|
|
|
|
expect(page).not_to have_content(project.name)
|
|
|
|
expect(page).to have_content(project3.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-05-28 04:29:52 -04:00
|
|
|
context 'when on Starred projects tab' do
|
|
|
|
it 'shows only starred projects' do
|
|
|
|
user.toggle_star(project2)
|
|
|
|
|
|
|
|
visit(starred_dashboard_projects_path)
|
|
|
|
|
|
|
|
expect(page).not_to have_content(project.name)
|
|
|
|
expect(page).to have_content(project2.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
describe 'with a pipeline', :clean_gitlab_redis_shared_state do
|
2017-06-29 06:30:33 -04:00
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha) }
|
2017-03-13 08:24:06 -04:00
|
|
|
|
|
|
|
before do
|
2017-03-30 03:15:42 -04:00
|
|
|
# Since the cache isn't updated when a new pipeline is created
|
|
|
|
# we need the pipeline to advance in the pipeline since the cache was created
|
|
|
|
# by visiting the login page.
|
|
|
|
pipeline.succeed
|
2017-03-13 08:24:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows that the last pipeline passed' do
|
|
|
|
visit dashboard_projects_path
|
2017-03-30 03:15:42 -04:00
|
|
|
|
2017-07-14 09:36:37 -04:00
|
|
|
page.within('.controls') do
|
|
|
|
expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit)}']")
|
|
|
|
expect(page).to have_css('.ci-status-link')
|
|
|
|
expect(page).to have_css('.ci-status-icon-success')
|
|
|
|
expect(page).to have_link('Commit: passed')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-09-01 06:50:14 -04:00
|
|
|
context 'last push widget', :use_clean_rails_memory_store_caching do
|
2017-07-14 09:36:37 -04:00
|
|
|
before do
|
2017-08-30 09:38:16 -04:00
|
|
|
event = create(:push_event, project: project, author: user)
|
|
|
|
|
|
|
|
create(:push_event_payload, event: event, ref: 'feature', action: :created)
|
|
|
|
|
2017-09-01 06:50:14 -04:00
|
|
|
Users::LastPushEventService.new(user).cache_last_push_event(event)
|
|
|
|
|
2017-07-14 09:36:37 -04:00
|
|
|
visit dashboard_projects_path
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'shows "Create merge request" button' do
|
|
|
|
expect(page).to have_content 'You pushed to feature'
|
|
|
|
|
|
|
|
within('#content-body') do
|
|
|
|
find_link('Create merge request', visible: false).click
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_selector('.merge-request-form')
|
|
|
|
expect(current_path).to eq project_new_merge_request_path(project)
|
2017-09-01 15:50:42 -04:00
|
|
|
expect(find('#merge_request_target_project_id', visible: false).value).to eq project.id.to_s
|
|
|
|
expect(find('input#merge_request_source_branch', visible: false).value).to eq 'feature'
|
|
|
|
expect(find('input#merge_request_target_branch', visible: false).value).to eq 'master'
|
2017-03-13 08:24:06 -04:00
|
|
|
end
|
|
|
|
end
|
2017-02-28 15:50:57 -05:00
|
|
|
end
|