PageRenderTime 17ms CodeModel.GetById 9ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/spec/features/projects/tree/create_directory_spec.rb

https://gitlab.com/tnir/gitlab-ce
Ruby | 72 lines | 43 code | 25 blank | 4 comment | 1 complexity | 321578a7ce4ca120b61c47543fe39028 MD5 | raw file
 1# frozen_string_literal: true
 2
 3require 'spec_helper'
 4
 5describe 'Multi-file editor new directory', :js do
 6  let(:user) { create(:user) }
 7  let(:project) { create(:project, :repository) }
 8
 9  before do
10    project.add_maintainer(user)
11    sign_in(user)
12
13    visit project_tree_path(project, :master)
14
15    wait_for_requests
16
17    click_link('Web IDE')
18
19    wait_for_requests
20  end
21
22  after do
23    set_cookie('new_repo', 'false')
24  end
25
26  it 'creates directory in current directory' do
27    all('.ide-tree-actions button').last.click
28
29    page.within('.modal') do
30      find('.form-control').set('folder name')
31
32      click_button('Create directory')
33    end
34
35    expect(page).to have_content('folder name')
36
37    first('.ide-tree-actions button').click
38
39    page.within('.modal') do
40      find('.form-control').set('folder name/file name')
41
42      click_button('Create file')
43    end
44
45    wait_for_requests
46
47    find('.js-ide-commit-mode').click
48
49    # Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
50    # (as it is with CHROME_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
51    # taller (as it is by default with chrome headless) then the button will not exist.
52    if page.has_css?('.qa-begin-commit-button')
53      find('.qa-begin-commit-button').click
54    end
55
56    fill_in('commit-message', with: 'commit message ide')
57
58    find(:css, ".js-ide-commit-new-mr input").set(false)
59
60    wait_for_requests
61
62    page.within '.multi-file-commit-form' do
63      click_button('Commit')
64
65      wait_for_requests
66    end
67
68    find('.js-ide-edit-mode').click
69
70    expect(page).to have_content('folder name')
71  end
72end