BigW Consortium Gitlab

project.rb 3.65 KB
Newer Older
1
class Spinach::Features::Project < Spinach::FeatureSteps
Nihad Abbasov committed
2 3 4
  include SharedAuthentication
  include SharedProject
  include SharedPaths
5
  include WaitForAjax
6

7
  step 'change project settings' do
8
    fill_in 'project_name_edit', with: 'NewName'
9
    select 'Disabled', from: 'project_project_feature_attributes_issues_access_level'
10 11
  end

12
  step 'I save project' do
13
    click_button 'Save changes'
14 15
  end

16
  step 'I should see project with new settings' do
17
    expect(find_field('project_name').value).to eq 'NewName'
18
  end
19 20

  step 'change project path settings' do
21 22
    fill_in 'project_path', with: 'new-path'
    click_button 'Rename'
23 24 25
  end

  step 'I should see project with new path settings' do
26
    expect(project.path).to eq 'new-path'
27 28 29 30 31
  end

  step 'I change the project avatar' do
    attach_file(
      :project_avatar,
32
      File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
33 34 35 36 37 38
    )
    click_button 'Save changes'
    @project.reload
  end

  step 'I should see new project avatar' do
39
    expect(@project.avatar).to be_instance_of AvatarUploader
40
    url = @project.avatar.url
41
    expect(url).to eq "/uploads/project/avatar/#{@project.id}/banana_sample.gif"
42 43 44
  end

  step 'I should see the "Remove avatar" button' do
45
    expect(page).to have_link('Remove avatar')
46 47 48 49 50
  end

  step 'I have an project avatar' do
    attach_file(
      :project_avatar,
51
      File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
52 53 54 55 56 57 58 59 60 61 62
    )
    click_button 'Save changes'
    @project.reload
  end

  step 'I remove my project avatar' do
    click_link 'Remove avatar'
    @project.reload
  end

  step 'I should see the default project avatar' do
Robert Speicher committed
63
    expect(@project.avatar?).to eq false
64 65 66
  end

  step 'I should not see the "Remove avatar" button' do
67
    expect(page).not_to have_link('Remove avatar')
68
  end
69

70
  step 'change project default branch' do
71 72
    select 'fix', from: 'project_default_branch'
    click_button 'Save changes'
73 74 75
  end

  step 'I should see project default branch changed' do
76
    expect(find(:css, 'select#project_default_branch').value).to eq 'fix'
77
  end
78 79 80 81 82 83

  step 'I select project "Forum" README tab' do
    click_link 'Readme'
  end

  step 'I should see project "Forum" README' do
Douwe Maan committed
84
    page.within('.readme-holder') do
85 86
      expect(page).to have_content 'Sample repo for testing gitlab features'
    end
87 88 89
  end

  step 'I should see project "Shop" README' do
90
    wait_for_ajax
Douwe Maan committed
91
    page.within('.readme-holder') do
92 93
      expect(page).to have_content 'testme'
    end
94
  end
95 96 97 98 99 100 101 102

  step 'I add project tags' do
    fill_in 'Tags', with: 'tag1, tag2'
  end

  step 'I should see project tags' do
    expect(find_field('Tags').value).to eq 'tag1, tag2'
  end
103 104

  step 'I should not see "New Issue" button' do
105
    expect(page).not_to have_link 'New Issue'
106 107 108
  end

  step 'I should not see "New Merge Request" button' do
109
    expect(page).not_to have_link 'New Merge Request'
110
  end
111 112

  step 'I should not see "Snippets" button' do
113 114 115
    page.within '.content' do
      expect(page).not_to have_link 'Snippets'
    end
116
  end
117 118 119 120 121 122 123

  step 'project "Shop" belongs to group' do
    group = create(:group)
    @project.namespace = group
    @project.save!
  end

124
  step 'I click notifications drop down button' do
125
    first('.notifications-btn').click
126 127 128
  end

  step 'I choose Mention setting' do
129
    click_link 'On mention'
130 131 132
  end

  step 'I should see Notification saved message' do
Phil Hughes committed
133 134
    page.within '#notifications-button' do
      expect(page).to have_content 'On mention'
135 136
    end
  end
137 138 139 140 141 142 143 144 145 146

  step 'I create bare repo' do
    click_link 'Create empty bare repository'
  end

  step 'I should see command line instructions' do
    page.within ".empty_wrapper" do
      expect(page).to have_content("Command line instructions")
    end
  end
Nihad Abbasov committed
147
end