diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-10-31 16:08:11 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-10-31 16:08:11 -0500 |
commit | 1cf167fc3e61c6c78e3bf2ba15a02f7ab317294c (patch) | |
tree | 05fda8866fb5634be495b526d06f00f02b18ea35 /spec/features/projects/tree | |
parent | c73c1a20e3c5a66a71758c4809faf2f69df25392 (diff) | |
parent | 0134079430f0179c527d388539c0986352bca9bd (diff) | |
download | gitlab-ce-1cf167fc3e61c6c78e3bf2ba15a02f7ab317294c.tar.gz |
Merge branch 'master' into sh-headless-chrome-support
* master: (84 commits)
Migrate Gitlab::Git::Wiki#page to Gitaly
Load participants async
Normalize LDAP DN when looking up identity
Improve the maintenance policy page
add changelog
fix spec failure
Allow promoting project milestones to group milestones
fix specs
Be able to bundle gems with newer rubies
Upgrade Ruby to 2.3.5
fixed up upload feature after master merge
fix missing issue assignees
Migrate Gitlab::Git::Wiki#delete_page to Gitaly
Enable eslint
Make `#hashed_storage?` require feature argument
Adds callback function to inital cluster request
Fix example typo.
Upload files through the multi-file editor
get branch name from the DOM
Resolve "Convert autosize.js library to be a Yarn managed library"
...
Diffstat (limited to 'spec/features/projects/tree')
-rw-r--r-- | spec/features/projects/tree/create_file_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/projects/tree/upload_file_spec.rb | 48 |
2 files changed, 48 insertions, 2 deletions
diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index d8e6a3179cb..7eea81d1e8d 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -29,8 +29,6 @@ feature 'Multi-file editor new file', :js do click_button('Create file') end - find('.inputarea').send_keys('file content') - fill_in('commit-message', with: 'commit message') click_button('Commit 1 file') diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb new file mode 100644 index 00000000000..7dbe4fd0aa5 --- /dev/null +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +feature 'Multi-file editor upload file', :js do + include WaitForRequests + + 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 + project.add_master(user) + sign_in(user) + + page.driver.set_cookie('new_repo', 'true') + + visit project_tree_path(project, :master) + + wait_for_requests + end + + it 'uploads text file' do + find('.add-to-tree').click + + # make the field visible so capybara can use it + execute_script('document.querySelector("#file-upload").classList.remove("hidden")') + attach_file('file-upload', txt_file) + + find('.add-to-tree').click + + expect(page).to have_selector('.repo-tab', text: 'doc_sample.txt') + expect(page).to have_content(File.open(txt_file, &:readline)) + end + + it 'uploads image file' do + find('.add-to-tree').click + + # make the field visible so capybara can use it + execute_script('document.querySelector("#file-upload").classList.remove("hidden")') + attach_file('file-upload', img_file) + + find('.add-to-tree').click + + expect(page).to have_selector('.repo-tab', text: 'dk.png') + expect(page).not_to have_selector('.monaco-editor') + expect(page).to have_content('The source could not be displayed for this temporary file.') + end +end |