2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'Multi-file editor upload file', :js, feature_category: :web_ide do
|
2018-05-09 12:01:36 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:txt_file) { File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt') }
|
|
|
|
let(:img_file) { File.join(Rails.root, 'spec', 'fixtures', 'dk.png') }
|
|
|
|
|
|
|
|
before do
|
2022-10-11 01:57:18 +05:30
|
|
|
stub_feature_flags(vscode_web_ide: false)
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-05-09 12:01:36 +05:30
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit project_tree_path(project, :master)
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
click_link('Web IDE')
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
set_cookie('new_repo', 'false')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'uploads text file' do
|
|
|
|
# make the field visible so capybara can use it
|
|
|
|
execute_script('document.querySelector("#file-upload").classList.remove("hidden")')
|
|
|
|
attach_file('file-upload', txt_file)
|
|
|
|
|
|
|
|
expect(page).to have_selector('.multi-file-tab', text: 'doc_sample.txt')
|
2019-09-04 21:01:54 +05:30
|
|
|
expect(find('.blob-editor-container .lines-content')['innerText']).to have_content(File.open(txt_file, &:readline).gsub!(/\s+/, ' '))
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|