2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Multi-file editor new directory', :js do
|
2018-05-09 12:01:36 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
|
|
|
before do
|
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 'creates directory in current directory' do
|
2018-11-18 11:00:15 +05:30
|
|
|
all('.ide-tree-actions button').last.click
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
page.within('.modal') do
|
|
|
|
find('.form-control').set('folder name')
|
|
|
|
|
|
|
|
click_button('Create directory')
|
|
|
|
end
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
expect(page).to have_content('folder name')
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
first('.ide-tree-actions button').click
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
page.within('.modal') do
|
|
|
|
find('.form-control').set('folder name/file name')
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
click_button('Create file')
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
find('.js-ide-commit-mode').click
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
# Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
|
2021-09-30 23:02:18 +05:30
|
|
|
# (as it is with WEBDRIVER_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
|
2020-03-13 15:44:24 +05:30
|
|
|
# taller (as it is by default with chrome headless) then the button will not exist.
|
2021-10-27 15:23:28 +05:30
|
|
|
if page.has_css?('.qa-begin-commit-button') # rubocop:disable QA/SelectorUsage
|
|
|
|
find('.qa-begin-commit-button').click # rubocop:disable QA/SelectorUsage
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
fill_in('commit-message', with: 'commit message ide')
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
find(:css, ".js-ide-commit-new-mr input").set(false)
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
page.within '.multi-file-commit-form' do
|
|
|
|
click_button('Commit')
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
wait_for_requests
|
2019-10-12 21:52:04 +05:30
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
find('.js-ide-edit-mode').click
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
expect(page).to have_content('folder name')
|
|
|
|
end
|
|
|
|
end
|