Skip to content
Snippets Groups Projects
Commit ed75b46c authored by Mark Lapierre's avatar Mark Lapierre
Browse files

Update tests and Resources to use new file button

The 'Create new' dropdown is no longer available on a blank project
so use the 'New file' button instead.
parent c61c5cf2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -32,7 +32,7 @@
.prepend-top-20
 
%nav.project-buttons
.scrolling-tabs-container.inner-page-scroll-tabs.is-smaller
.scrolling-tabs-container.inner-page-scroll-tabs.is-smaller.qa-quick-actions
.fade-left= icon('angle-left')
.fade-right= icon('angle-right')
.nav-links.scrolling-tabs.quick-links
Loading
Loading
Loading
Loading
@@ -20,7 +20,7 @@
 
- if can_collaborate || can_create_mr_from_fork
%li.breadcrumb-item
%a.btn.add-to-tree{ addtotree_toggle_attributes }
%a.btn.add-to-tree.qa-add-to-tree{ addtotree_toggle_attributes }
= sprite_icon('plus', size: 16, css_class: 'float-left')
= sprite_icon('arrow-down', size: 16, css_class: 'float-left')
- if on_top_of_branch?
Loading
Loading
@@ -30,7 +30,7 @@
%li.dropdown-header
#{ _('This directory') }
%li
= link_to project_new_blob_path(@project, @id) do
= link_to project_new_blob_path(@project, @id), class: 'qa-new-file-option' do
#{ _('New file') }
%li
= link_to '#modal-upload-blob', { 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal' } do
Loading
Loading
Loading
Loading
@@ -132,6 +132,10 @@ module QA
Page::Element.new(name).selector_css
end
 
def click_link_with_text(text)
click_link text
end
def self.path
raise NotImplementedError
end
Loading
Loading
Loading
Loading
@@ -6,6 +6,11 @@ module QA
class Show < Page::Base
include Page::Component::ClonePanel
 
view 'app/views/layouts/header/_new_dropdown.haml' do
element :new_menu_toggle
element :new_issue_link, "link_to _('New issue'), new_project_issue_path(@project)" # rubocop:disable QA/ElementWithPattern
end
view 'app/views/projects/_last_push.html.haml' do
element :create_merge_request
end
Loading
Loading
@@ -14,14 +19,12 @@ module QA
element :project_name
end
 
view 'app/views/layouts/header/_new_dropdown.haml' do
element :new_menu_toggle
element :new_issue_link, "link_to _('New issue'), new_project_issue_path(@project)" # rubocop:disable QA/ElementWithPattern
view 'app/views/projects/_files.html.haml' do
element :tree_holder, '.tree-holder' # rubocop:disable QA/ElementWithPattern
end
 
view 'app/views/shared/_ref_switcher.html.haml' do
element :branches_select
element :branches_dropdown
view 'app/views/projects/buttons/_dropdown.html.haml' do
element :create_new_dropdown
end
 
view 'app/views/projects/buttons/_fork.html.haml' do
Loading
Loading
@@ -29,44 +32,50 @@ module QA
element :fork_link, "link_to new_project_fork_path(@project)" # rubocop:disable QA/ElementWithPattern
end
 
view 'app/views/projects/_files.html.haml' do
element :tree_holder, '.tree-holder' # rubocop:disable QA/ElementWithPattern
view 'app/views/projects/empty.html.haml' do
element :quick_actions
end
 
view 'app/views/projects/buttons/_dropdown.html.haml' do
element :create_new_dropdown
element :new_file_option
view 'app/views/projects/tree/_tree_content.html.haml' do
element :file_tree
end
 
view 'app/views/projects/tree/_tree_header.html.haml' do
element :add_to_tree
element :new_file_option
element :web_ide_button
end
 
view 'app/views/projects/tree/_tree_content.html.haml' do
element :file_tree
view 'app/views/shared/_ref_switcher.html.haml' do
element :branches_select
element :branches_dropdown
end
 
def project_name
find('.qa-project-name').text
def create_first_new_file!
within_element(:quick_actions) do
click_link_with_text 'New file'
end
end
 
def create_new_file!
click_element :create_new_dropdown
click_element :add_to_tree
click_element :new_file_option
end
 
def fork_project
click_on 'Fork'
end
def go_to_file(filename)
within_element(:file_tree) do
click_on filename
end
end
 
def switch_to_branch(branch_name)
find_element(:branches_select).click
def go_to_new_issue
click_element :new_menu_toggle
 
within_element(:branches_dropdown) do
click_on branch_name
end
click_link 'New issue'
end
 
def last_commit_content
Loading
Loading
@@ -81,24 +90,26 @@ module QA
click_element :create_merge_request
end
 
def wait_for_import
wait(reload: true) do
has_css?('.tree-holder')
end
def open_web_ide!
click_element :web_ide_button
end
 
def go_to_new_issue
click_element :new_menu_toggle
click_link 'New issue'
def project_name
find('.qa-project-name').text
end
 
def fork_project
click_on 'Fork'
def switch_to_branch(branch_name)
find_element(:branches_select).click
within_element(:branches_dropdown) do
click_on branch_name
end
end
 
def open_web_ide!
click_element :web_ide_button
def wait_for_import
wait(reload: true) do
has_css?('.tree-holder')
end
end
end
end
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ module QA
def fabricate!
project.visit!
 
Page::Project::Show.perform(&:create_new_file!)
Page::Project::Show.perform(&:create_first_new_file!)
 
Page::File::Form.perform do |page|
page.add_name(@name)
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ module QA
 
def login
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
Page::Main::Login.perform(&:sign_in_using_credentials)
end
 
before(:all) do
Loading
Loading
@@ -18,7 +18,15 @@ module QA
project.description = 'Add file templates via the Files view'
end
 
Page::Main::Menu.act { sign_out }
# There's no 'New File' dropdown when the project is blank, so we first
# add a dummy file so that the dropdown will appear
Resource::File.fabricate! do |file|
file.project = @project
file.name = 'README.md'
file.content = '# Readme'
end
Page::Main::Menu.perform(&:sign_out)
end
 
templates = [
Loading
Loading
@@ -55,7 +63,7 @@ module QA
login
@project.visit!
 
Page::Project::Show.act { create_new_file! }
Page::Project::Show.perform(&:create_new_file!)
Page::File::Form.perform do |page|
page.select_template template[:file_name], template[:name]
end
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ module QA
 
def login
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
Page::Main::Login.perform(&:sign_in_using_credentials)
end
 
before(:all) do
Loading
Loading
@@ -21,14 +21,14 @@ module QA
 
# Add a file via the regular Files view because the Web IDE isn't
# available unless there is a file present
Page::Project::Show.act { create_new_file! }
Page::Project::Show.perform(&:create_first_new_file!)
Page::File::Form.perform do |page|
page.add_name('dummy')
page.add_content('Enable the Web IDE')
page.commit_changes
end
 
Page::Main::Menu.act { sign_out }
Page::Main::Menu.perform(&:sign_out)
end
 
templates = [
Loading
Loading
@@ -65,7 +65,7 @@ module QA
login
@project.visit!
 
Page::Project::Show.act { open_web_ide! }
Page::Project::Show.perform(&:open_web_ide!)
Page::Project::WebIDE::Edit.perform do |page|
page.create_new_file_from_template template[:file_name], template[:name]
 
Loading
Loading
@@ -75,9 +75,7 @@ module QA
expect(page).to have_button('Undo')
expect(page).to have_content(content[0..100])
 
Page::Project::WebIDE::Edit.perform do |page|
page.commit_changes
end
Page::Project::WebIDE::Edit.perform(&:commit_changes)
 
expect(page).to have_content(template[:file_name])
expect(page).to have_content(content[0..100])
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment