Commit e841f02d authored by Tanya Pazitny's avatar Tanya Pazitny

Merge branch 'ml-wait-for-requests-when-checking-project-files' into 'master'

Wait for requests when checking for project files

See merge request gitlab-org/gitlab!27640
parents b1209c39 7670eb06
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
</gl-link> </gl-link>
</div> </div>
</div> </div>
<div class="blob-viewer"> <div class="blob-viewer" data-qa-selector="blob_viewer_content">
<gl-loading-icon v-if="loading > 0" size="md" color="dark" class="my-4 mx-auto" /> <gl-loading-icon v-if="loading > 0" size="md" color="dark" class="my-4 mx-auto" />
<div v-else-if="readme" ref="readme" v-html="readme.html"></div> <div v-else-if="readme" ref="readme" v-html="readme.html"></div>
</div> </div>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
= button_tag class: 'toggle-mobile-nav', type: 'button' do = button_tag class: 'toggle-mobile-nav', type: 'button' do
%span.sr-only= _("Open sidebar") %span.sr-only= _("Open sidebar")
= icon ('bars') = icon ('bars')
.breadcrumbs-links.js-title-container .breadcrumbs-links.js-title-container{ data: { qa_selector: 'breadcrumb_links_content' } }
%ul.list-unstyled.breadcrumbs-list.js-breadcrumbs-list %ul.list-unstyled.breadcrumbs-list.js-breadcrumbs-list
- unless hide_top_links - unless hide_top_links
= header_title = header_title
......
...@@ -385,6 +385,7 @@ module QA ...@@ -385,6 +385,7 @@ module QA
# Classes describing components that are used by several pages. # Classes describing components that are used by several pages.
# #
module Component module Component
autoload :Breadcrumbs, 'qa/page/component/breadcrumbs'
autoload :CiBadgeLink, 'qa/page/component/ci_badge_link' autoload :CiBadgeLink, 'qa/page/component/ci_badge_link'
autoload :ClonePanel, 'qa/page/component/clone_panel' autoload :ClonePanel, 'qa/page/component/clone_panel'
autoload :LazyLoader, 'qa/page/component/lazy_loader' autoload :LazyLoader, 'qa/page/component/lazy_loader'
......
# frozen_string_literal: true
module QA
module Page
module Component
module Breadcrumbs
def self.included(base)
base.view 'app/views/layouts/nav/_breadcrumbs.html.haml' do
element :breadcrumb_links_content
end
end
def has_breadcrumb?(text)
has_element?(:breadcrumb_links_content, text: text)
end
end
end
end
end
...@@ -5,8 +5,13 @@ module QA ...@@ -5,8 +5,13 @@ module QA
module Project module Project
class Show < Page::Base class Show < Page::Base
include Page::Component::ClonePanel include Page::Component::ClonePanel
include Page::Component::Breadcrumbs
include Page::Project::SubMenus::Settings include Page::Project::SubMenus::Settings
view 'app/assets/javascripts/repository/components/preview/index.vue' do
element :blob_viewer_content
end
view 'app/assets/javascripts/repository/components/table/row.vue' do view 'app/assets/javascripts/repository/components/table/row.vue' do
element :file_name_link element :file_name_link
end end
...@@ -90,7 +95,7 @@ module QA ...@@ -90,7 +95,7 @@ module QA
def click_file(filename) def click_file(filename)
within_element(:file_tree_table) do within_element(:file_tree_table) do
click_on filename click_element(:file_name_link, text: filename)
end end
end end
...@@ -115,6 +120,10 @@ module QA ...@@ -115,6 +120,10 @@ module QA
has_element?(:project_name_content, text: name) has_element?(:project_name_content, text: name)
end end
def has_readme_content?(text)
has_element?(:blob_viewer_content, text: text)
end
def last_commit_content def last_commit_content
find_element(:commit_content).text find_element(:commit_content).text
end end
......
...@@ -47,8 +47,8 @@ module QA ...@@ -47,8 +47,8 @@ module QA
Page::Project::Settings::Main.perform(&:click_project) Page::Project::Settings::Main.perform(&:click_project)
Page::Project::Show.perform do |project| Page::Project::Show.perform do |project|
expect(project).to have_text(target_group.path) expect(project).to have_breadcrumb(target_group.path)
expect(project).to have_text(edited_readme_content) expect(project).to have_readme_content(edited_readme_content)
end end
end end
end end
......
...@@ -60,12 +60,15 @@ module QA ...@@ -60,12 +60,15 @@ module QA
end end
end end
project.visit!
project.wait_for_push_new_branch project.wait_for_push_new_branch
project.visit!
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
expect(git_protocol_reported).to eq(git_protocol) expect(git_protocol_reported).to eq(git_protocol)
Page::Project::Show.perform do |show|
expect(show).to have_file(file_name)
expect(show).to have_readme_content(file_content)
end
end end
end end
end end
......
...@@ -24,8 +24,10 @@ module QA ...@@ -24,8 +24,10 @@ module QA
Page::Project::Show.perform(&:wait_for_viewers_to_load) Page::Project::Show.perform(&:wait_for_viewers_to_load)
expect(page).to have_content('README.md') Page::Project::Show.perform do |project|
expect(page).to have_content('This is a test project') expect(project).to have_file('README.md')
expect(project).to have_readme_content('This is a test project')
end
end end
end end
end end
......
...@@ -12,8 +12,10 @@ module QA ...@@ -12,8 +12,10 @@ module QA
push.commit_message = 'Add README.md' push.commit_message = 'Add README.md'
end.project.visit! end.project.visit!
expect(page).to have_content('README.md') Page::Project::Show.perform do |project|
expect(page).to have_content('This is a test project') expect(project).to have_file('README.md')
expect(project).to have_readme_content('This is a test project')
end
end end
end end
end end
......
...@@ -27,6 +27,7 @@ exports[`Repository file preview component renders file HTML 1`] = ` ...@@ -27,6 +27,7 @@ exports[`Repository file preview component renders file HTML 1`] = `
<div <div
class="blob-viewer" class="blob-viewer"
data-qa-selector="blob_viewer_content"
> >
<div> <div>
<div <div
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment