Welcome to mirror list, hosted at ThFree Co, Russian Federation.

user_browses_lfs_files_spec.rb « files « projects « refactor_blob_viewer_disabled « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2d9b6b3a90351666db33f9c8bcf02fa4654db5eb (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 'Projects > Files > User browses LFS files' do
  let(:project) { create(:project, :repository) }
  let(:user) { project.first_owner }

  before do
    stub_feature_flags(refactor_blob_viewer: false)
    sign_in(user)
  end

  context 'when LFS is disabled', :js do
    before do
      allow_next_found_instance_of(Project) do |project|
        allow(project).to receive(:lfs_enabled?).and_return(false)
      end

      visit project_tree_path(project, 'lfs')
      wait_for_requests
    end

    it 'is possible to see raw content of LFS pointer' do
      click_link 'files'

      page.within('.repo-breadcrumb') do
        expect(page).to have_link('files')
      end

      click_link 'lfs'

      page.within('.repo-breadcrumb') do
        expect(page).to have_link('lfs')
      end

      click_link 'lfs_object.iso'

      expect(page).to have_content 'version https://git-lfs.github.com/spec/v1'
      expect(page).to have_content 'oid sha256:91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
      expect(page).to have_content 'size 1575078'
      expect(page).not_to have_content 'Download (1.5 MB)'
    end
  end

  context 'when LFS is enabled', :js do
    before do
      allow_next_found_instance_of(Project) do |project|
        allow(project).to receive(:lfs_enabled?).and_return(true)
      end

      visit project_tree_path(project, 'lfs')
      wait_for_requests
    end

    it 'shows an LFS object' do
      click_link('files')

      page.within('.repo-breadcrumb') do
        expect(page).to have_link('files')
      end

      click_link('lfs')
      click_link('lfs_object.iso')

      expect(page).to have_content('Download (1.5 MB)')
      expect(page).not_to have_content('version https://git-lfs.github.com/spec/v1')
      expect(page).not_to have_content('oid sha256:91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897')
      expect(page).not_to have_content('size 1575078')

      page.within('.content') do
        expect(page).to have_content('Delete')
        expect(page).to have_content('History')
        expect(page).to have_content('Permalink')
        expect(page).to have_content('Replace')
        expect(page).to have_link('Download')

        expect(page).not_to have_content('Annotate')
        expect(page).not_to have_content('Blame')

        expect(page).not_to have_selector(:link_or_button, text: /^Edit$/)
        expect(page).to have_selector(:link_or_button, 'Open in Web IDE')
      end
    end
  end
end