BigW Consortium Gitlab

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

6
  step 'change project settings' do
7
    fill_in 'project_name_edit', with: 'NewName'
8 9 10
    uncheck 'project_issues_enabled'
  end

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

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

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

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

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

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

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

  step 'I have an project avatar' do
    attach_file(
      :project_avatar,
50
      File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
51 52 53 54 55 56 57 58 59 60 61
    )
    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
62
    expect(@project.avatar?).to eq false
63 64 65
  end

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

  step 'I should see project "Shop" version' do
70
    page.within '.project-side' do
71
      expect(page).to have_content '6.7.0.pre'
72 73
    end
  end
74 75

  step 'change project default branch' do
76 77
    select 'fix', from: 'project_default_branch'
    click_button 'Save changes'
78 79 80
  end

  step 'I should see project default branch changed' do
81
    expect(find(:css, 'select#project_default_branch').value).to eq 'fix'
82
  end
83 84 85 86 87 88

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

  step 'I should see project "Forum" README' do
Douwe Maan committed
89
    page.within('.readme-holder') do
90 91
      expect(page).to have_content 'Sample repo for testing gitlab features'
    end
92 93 94
  end

  step 'I should see project "Shop" README' do
Douwe Maan committed
95
    page.within('.readme-holder') do
96 97
      expect(page).to have_content 'testme'
    end
98
  end
99 100 101 102 103 104 105 106

  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
107 108

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

  step 'I should not see "New Merge Request" button' do
113
    expect(page).not_to have_link 'New Merge Request'
114
  end
115 116

  step 'I should not see "Snippets" button' do
117
    expect(page).not_to have_link 'Snippets'
118
  end
119 120 121 122 123 124 125 126

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

  step 'I should see back to dashboard button' do
127
    expect(page).to have_content 'Go to dashboard'
128 129 130
  end

  step 'I should see back to group button' do
131
    expect(page).to have_content 'Go to group'
132
  end
133 134

  step 'I click notifications drop down button' do
135
    click_link 'notifications-button'
136 137 138
  end

  step 'I choose Mention setting' do
139
    click_link 'On mention'
140 141 142 143 144 145 146
  end

  step 'I should see Notification saved message' do
    page.within '.flash-container' do
      expect(page).to have_content 'Notification settings saved'
    end
  end
Nihad Abbasov committed
147
end