diff options
Diffstat (limited to 'spec/features/projects/files/user_browses_files_spec.rb')
-rw-r--r-- | spec/features/projects/files/user_browses_files_spec.rb | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/spec/features/projects/files/user_browses_files_spec.rb b/spec/features/projects/files/user_browses_files_spec.rb index 508dec70db6..9b4d1502bc8 100644 --- a/spec/features/projects/files/user_browses_files_spec.rb +++ b/spec/features/projects/files/user_browses_files_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe "User browses files" do +RSpec.describe "User browses files", :js do include RepoHelpers let(:fork_message) do @@ -13,7 +13,7 @@ RSpec.describe "User browses files" do let(:project) { create(:project, :repository, name: "Shop") } let(:project2) { create(:project, :repository, name: "Another Project", path: "another-project") } let(:tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) } - let(:user) { project.owner } + let(:user) { project.first_owner } before do sign_in(user) @@ -340,32 +340,37 @@ RSpec.describe "User browses files" do let(:newrev) { project.repository.commit('master').sha } before do - stub_feature_flags(refactor_blob_viewer: false) # This stub will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/350456 create_file_in_repo(project, 'master', 'master', filename, 'Test file') path = File.join('master', filename) visit(project_blob_path(project, path)) + wait_for_requests end - it "shows a raw file content" do - click_link("Open raw") + it "shows raw file content in a new tab" do + new_tab = window_opened_by {click_link 'Open raw'} - expect(source).to eq("") # Body is filled in by gitlab-workhorse + within_window new_tab do + expect(page).to have_content("Test file") + end end end context "when browsing a raw file" do before do - stub_feature_flags(refactor_blob_viewer: false) # This stub will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/350456 - path = File.join(RepoHelpers.sample_commit.id, RepoHelpers.sample_blob.path) + visit(tree_path_root_ref) + wait_for_requests - visit(project_blob_path(project, path)) + click_link(".gitignore") + wait_for_requests end - it "shows a raw file content" do - click_link("Open raw") + it "shows raw file content in a new tab" do + new_tab = window_opened_by {click_link 'Open raw'} - expect(source).to eq("") # Body is filled in by gitlab-workhorse + within_window new_tab do + expect(page).to have_content("*.rbc") + end end end end |