2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-20 10:12:48 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-03 14:08:28 -04:00
|
|
|
RSpec.describe 'Multi-file editor new file', :js do
|
2018-03-20 10:12:48 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
|
|
|
before do
|
2022-08-19 20:12:08 -04:00
|
|
|
stub_feature_flags(vscode_web_ide: false)
|
|
|
|
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2018-03-20 10:12:48 -04:00
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit project_path(project)
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
click_link('Web IDE')
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
set_cookie('new_repo', 'false')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates file in current directory' do
|
2018-08-07 11:15:56 -04:00
|
|
|
first('.ide-tree-actions button').click
|
2018-03-20 10:12:48 -04:00
|
|
|
|
|
|
|
page.within('.modal') do
|
|
|
|
find('.form-control').set('file name')
|
|
|
|
|
|
|
|
click_button('Create file')
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
2018-04-17 11:27:46 -04:00
|
|
|
find('.js-ide-commit-mode').click
|
|
|
|
|
2020-01-21 19:08:47 -05:00
|
|
|
# Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
|
2021-06-22 20:07:53 -04:00
|
|
|
# (as it is with WEBDRIVER_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
|
2020-01-21 19:08:47 -05:00
|
|
|
# taller (as it is by default with chrome headless) then the button will not exist.
|
2022-08-05 02:11:46 -04:00
|
|
|
if page.has_css?('[data-testid="begin-commit-button"]')
|
|
|
|
find('[data-testid="begin-commit-button"]').click
|
2020-01-21 19:08:47 -05:00
|
|
|
end
|
|
|
|
|
2018-03-20 10:12:48 -04:00
|
|
|
fill_in('commit-message', with: 'commit message ide')
|
|
|
|
|
2019-08-22 19:23:06 -04:00
|
|
|
find(:css, ".js-ide-commit-new-mr input").set(false)
|
|
|
|
|
2019-07-15 09:16:55 -04:00
|
|
|
page.within '.multi-file-commit-form' do
|
|
|
|
click_button('Commit')
|
2019-08-22 19:23:06 -04:00
|
|
|
|
|
|
|
wait_for_requests
|
2019-07-15 09:16:55 -04:00
|
|
|
end
|
2018-03-20 10:12:48 -04:00
|
|
|
|
2019-08-22 19:23:06 -04:00
|
|
|
find('.js-ide-edit-mode').click
|
|
|
|
|
2018-03-20 10:12:48 -04:00
|
|
|
expect(page).to have_content('file name')
|
|
|
|
end
|
|
|
|
end
|