summaryrefslogtreecommitdiff
path: root/spec/features/projects/issues/design_management/user_views_designs_spec.rb
blob: 772a9ffbe6fec6ae93429da0a685e9298fc9f0d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'User views issue designs', :js do
  include DesignManagementTestHelpers

  let_it_be(:project) { create(:project_empty_repo, :public) }
  let_it_be(:issue) { create(:issue, project: project) }
  let_it_be(:design) { create(:design, :with_file, issue: issue) }

  context 'design_management_moved flag disabled' do
    before do
      enable_design_management
      stub_feature_flags(design_management_moved: false)
    end

    context 'navigates from the issue view' do
      before do
        visit project_issue_path(project, issue)
        click_link 'Designs'
        wait_for_requests
      end

      it 'fetches list of designs' do
        expect(page).to have_selector('.js-design-list-item', count: 1)
      end
    end

    context 'navigates directly to the design collection view' do
      before do
        visit designs_project_issue_path(project, issue)
      end

      it 'expands the sidebar' do
        expect(page).to have_selector('.layout-page.right-sidebar-expanded')
      end
    end

    context 'navigates directly to the individual design view' do
      before do
        visit designs_project_issue_path(project, issue, vueroute: design.filename)
      end

      it 'sees the design' do
        expect(page).to have_selector('.js-design-detail')
      end
    end
  end

  context 'design_management_moved flag enabled' do
    before do
      enable_design_management
    end

    context 'navigates from the issue view' do
      before do
        visit project_issue_path(project, issue)
      end

      it 'fetches list of designs' do
        expect(page).to have_selector('.js-design-list-item', count: 1)
      end
    end

    context 'navigates directly to the design collection view' do
      before do
        visit designs_project_issue_path(project, issue)
      end

      it 'expands the sidebar' do
        expect(page).to have_selector('.layout-page.right-sidebar-expanded')
      end
    end

    context 'navigates directly to the individual design view' do
      before do
        visit designs_project_issue_path(project, issue, vueroute: design.filename)
      end

      it 'sees the design' do
        expect(page).to have_selector('.js-design-detail')
      end
    end
  end
end