BigW Consortium Gitlab

dashboard.rb 2.51 KB
Newer Older
1
class Spinach::Features::Dashboard < Spinach::FeatureSteps
Nihad Abbasov committed
2 3
  include SharedAuthentication
  include SharedPaths
4
  include SharedProject
5
  include SharedIssuable
Nihad Abbasov committed
6

7
  step 'I should see "New Project" link' do
8
    expect(page).to have_link "New project"
9 10
  end

11
  step 'I should see "Shop" project link' do
12
    expect(page).to have_link "Shop"
13 14
  end

15
  step 'I should see "Shop" project CI status' do
Kamil Trzcinski committed
16
    expect(page).to have_link "Commit: skipped"
17 18
  end

19
  step 'I should see last push widget' do
20
    expect(page).to have_content "You pushed to fix"
21
    expect(page).to have_link "Create merge request"
22 23
  end

24
  step 'I click "Create merge request" link' do
Douwe Maan committed
25
    find_link("Create merge request", visible: false).trigger('click')
26 27
  end

28
  step 'I see prefilled new Merge Request page' do
Phil Hughes committed
29
    expect(page).to have_selector('.merge-request-form')
30
    expect(current_path).to eq project_new_merge_request_path(@project)
31 32 33
    expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s
    expect(find("input#merge_request_source_branch").value).to eq "fix"
    expect(find("input#merge_request_target_branch").value).to eq "master"
34 35
  end

36
  step 'I have group with projects' do
37
    @group   = create(:group)
38
    @project = create(:empty_project, namespace: @group)
39
    @event   = create(:closed_issue_event, project: @project)
randx committed
40

41
    @project.team << [current_user, :master]
randx committed
42 43
  end

44
  step 'I should see projects list' do
Dmitriy Zaporozhets committed
45
    @user.authorized_projects.all.each do |project|
46
      expect(page).to have_link project.name_with_namespace
Dmitriy Zaporozhets committed
47 48 49
    end
  end

50
  step 'I should see groups list' do
randx committed
51
    Group.all.each do |group|
52
      expect(page).to have_link group.name
randx committed
53 54
    end
  end
Alex Denisov committed
55

56
  step 'group has a projects that does not belongs to me' do
57 58
    @forbidden_project1 = create(:empty_project, group: @group)
    @forbidden_project2 = create(:empty_project, group: @group)
Alex Denisov committed
59 60
  end

61
  step 'I should see 1 project at group list' do
62
    expect(find('span.last_activity/span')).to have_content('1')
Alex Denisov committed
63
  end
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

  step 'I filter the list by label "feature"' do
    page.within ".labels-filter" do
      find('.dropdown').click
      click_link "feature"
    end
  end

  step 'I should see "Bugfix1" in issues list' do
    page.within "ul.content-list" do
      expect(page).to have_content "Bugfix1"
    end
  end

  step 'project "Shop" has issue "Bugfix1" with label "feature"' do
    project = Project.find_by(name: "Shop")
80
    issue = create(:issue, title: "Bugfix1", project: project, assignees: [current_user])
81 82
    issue.labels << project.labels.find_by(title: 'feature')
  end
83
end