diff options
Diffstat (limited to 'spec/features/projects/files')
7 files changed, 25 insertions, 40 deletions
diff --git a/spec/features/projects/files/dockerfile_dropdown_spec.rb b/spec/features/projects/files/dockerfile_dropdown_spec.rb index a74cde35be6..55b15ad95d1 100644 --- a/spec/features/projects/files/dockerfile_dropdown_spec.rb +++ b/spec/features/projects/files/dockerfile_dropdown_spec.rb @@ -12,20 +12,16 @@ RSpec.describe 'Projects > Files > User wants to add a Dockerfile file', :js, fe end it 'user can pick a Dockerfile file from the dropdown' do - expect(page).to have_css('.dockerfile-selector') + click_button 'Apply a template' - find('.js-dockerfile-selector').click - - wait_for_requests - - within '.dockerfile-selector' do - find('.dropdown-input-field').set('HTTPd') - find('.dropdown-content li', text: 'HTTPd').click + within '.gl-new-dropdown-panel' do + find('.gl-listbox-search-input').set('HTTPd') + find('.gl-new-dropdown-contents li', text: 'HTTPd').click end wait_for_requests - expect(page).to have_css('.dockerfile-selector .dropdown-toggle-text', text: 'Apply a template') + expect(page).to have_css('.gl-new-dropdown-button-text', text: 'HTTPd') expect(find('.monaco-editor')).to have_content('COPY ./ /usr/local/apache2/htdocs/') end end diff --git a/spec/features/projects/files/gitignore_dropdown_spec.rb b/spec/features/projects/files/gitignore_dropdown_spec.rb index 36b02b9b948..b1f7f1c5716 100644 --- a/spec/features/projects/files/gitignore_dropdown_spec.rb +++ b/spec/features/projects/files/gitignore_dropdown_spec.rb @@ -12,20 +12,16 @@ RSpec.describe 'Projects > Files > User wants to add a .gitignore file', :js, fe end it 'user can pick a .gitignore file from the dropdown' do - expect(page).to have_css('.gitignore-selector') + click_button 'Apply a template' - find('.js-gitignore-selector').click - - wait_for_requests - - within '.gitignore-selector' do - find('.dropdown-input-field').set('rails') - find('.dropdown-content li', text: 'Rails').click + within '.gl-new-dropdown-panel' do + find('.gl-listbox-search-input').set('rails') + find('.gl-new-dropdown-contents li', text: 'Rails').click end wait_for_requests - expect(page).to have_css('.gitignore-selector .dropdown-toggle-text', text: 'Apply a template') + expect(page).to have_css('.gl-new-dropdown-button-text', text: 'Rails') expect(find('.monaco-editor')).to have_content('/.bundle') expect(find('.monaco-editor')).to have_content('config/initializers/secret_token.rb') end diff --git a/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb b/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb index 929554ff0d6..7bfff6b68e8 100644 --- a/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb +++ b/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb @@ -16,20 +16,16 @@ RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file', :js end it 'user can pick a template from the dropdown' do - expect(page).to have_css('.gitlab-ci-yml-selector') + click_button 'Apply a template' - find('.js-gitlab-ci-yml-selector').click - - wait_for_requests - - within '.gitlab-ci-yml-selector' do - find('.dropdown-input-field').set('Jekyll') - find('.dropdown-content li', text: 'Jekyll').click + within '.gl-new-dropdown-panel' do + find('.gl-listbox-search-input').set('Jekyll') + find('.gl-new-dropdown-contents li', text: 'Jekyll').click end wait_for_requests - expect(page).to have_css('.gitlab-ci-yml-selector .dropdown-toggle-text', text: 'Apply a template') + expect(page).to have_css('.gl-new-dropdown-button-text', text: 'Jekyll') expect(find('.monaco-editor')).to have_content('This file is a template, and might need editing before it works on your project') expect(find('.monaco-editor')).to have_content('jekyll build -d test') end @@ -40,7 +36,7 @@ RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file', :js it 'uses the given template' do wait_for_requests - expect(page).to have_css('.gitlab-ci-yml-selector .dropdown-toggle-text', text: 'Apply a template') + expect(page).to have_css('.gl-new-dropdown-button-text', text: 'Jekyll') expect(find('.monaco-editor')).to have_content('This file is a template, and might need editing before it works on your project') expect(find('.monaco-editor')).to have_content('jekyll build -d test') end @@ -52,7 +48,7 @@ RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file', :js it 'leaves the editor empty' do wait_for_requests - expect(page).to have_css('.gitlab-ci-yml-selector .dropdown-toggle-text', text: 'Apply a template') + expect(page).to have_css('.gl-new-dropdown-button-text', text: 'Apply a template') expect(find('.monaco-editor')).to have_content('') end end diff --git a/spec/features/projects/files/project_owner_creates_license_file_spec.rb b/spec/features/projects/files/project_owner_creates_license_file_spec.rb index 8ec9adaeb9a..95e96159744 100644 --- a/spec/features/projects/files/project_owner_creates_license_file_spec.rb +++ b/spec/features/projects/files/project_owner_creates_license_file_spec.rb @@ -20,8 +20,6 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js, f fill_in :file_name, with: 'LICENSE' - expect(page).to have_selector('.license-selector') - select_template('MIT License') file_content = first('.file-editor') @@ -44,7 +42,6 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js, f expect(page).to have_current_path( project_new_blob_path(project, 'master'), ignore_query: true) expect(find('#file_name').value).to eq('LICENSE') - expect(page).to have_selector('.license-selector') select_template('MIT License') @@ -62,9 +59,9 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js, f end def select_template(template) - page.within('.js-license-selector-wrap') do + page.within('.gl-new-dropdown') do click_button 'Apply a template' - click_link template + find('.gl-new-dropdown-contents li', text: template).click wait_for_requests end end diff --git a/spec/features/projects/files/template_selector_menu_spec.rb b/spec/features/projects/files/template_selector_menu_spec.rb index 46c4b69bc89..920da6e72ce 100644 --- a/spec/features/projects/files/template_selector_menu_spec.rb +++ b/spec/features/projects/files/template_selector_menu_spec.rb @@ -58,7 +58,7 @@ end def check_template_selector_menu_display(is_visible) count = is_visible ? 1 : 0 - expect(page).to have_css('.template-selectors-menu', count: count) + expect(page).to have_css('[data-testid="template-selector"]', count: count) end def create_and_edit_file(file_name) diff --git a/spec/features/projects/files/undo_template_spec.rb b/spec/features/projects/files/undo_template_spec.rb index 4b6e6b7282c..d6f9acc68a0 100644 --- a/spec/features/projects/files/undo_template_spec.rb +++ b/spec/features/projects/files/undo_template_spec.rb @@ -13,7 +13,7 @@ RSpec.describe 'Projects > Files > Template Undo Button', :js, feature_category: context 'editing a matching file and applying a template' do before do visit project_edit_blob_path(project, File.join(project.default_branch, "LICENSE")) - select_file_template('.js-license-selector', 'Apache License 2.0') + select_file_template('Apache License 2.0') end it 'reverts template application' do @@ -42,8 +42,8 @@ def check_content_reverted(template_content) expect(page).not_to have_content(template_content) end -def select_file_template(template_selector_selector, template_name) - find(template_selector_selector).click - find('.dropdown-content li', text: template_name).click +def select_file_template(template_name) + click_button 'Apply a template' + find('.gl-new-dropdown-contents li', text: template_name).click wait_for_requests end diff --git a/spec/features/projects/files/user_browses_files_spec.rb b/spec/features/projects/files/user_browses_files_spec.rb index 3b30a620257..e93c9427c91 100644 --- a/spec/features/projects/files/user_browses_files_spec.rb +++ b/spec/features/projects/files/user_browses_files_spec.rb @@ -155,7 +155,7 @@ RSpec.describe "User browses files", :js, feature_category: :groups_and_projects click_link("d") end - expect(page).to have_link("..", href: project_tree_path(project, "markdown/")) + expect(page).to have_link("..", href: project_tree_path(project, "markdown")) page.within(".tree-table") do click_link("README.md") |