Commit ee8e6fa5 authored by Dan Davison's avatar Dan Davison

Merge branch 'qa-fix-filter-comments-spec' into 'master'

Fix filter comments e2e spec

See merge request gitlab-org/gitlab!45825
parents 14377e92 091138a7
...@@ -117,6 +117,7 @@ export default { ...@@ -117,6 +117,7 @@ export default {
v-if="displayFilters" v-if="displayFilters"
id="discussion-filter-dropdown" id="discussion-filter-dropdown"
class="gl-mr-3 full-width-mobile discussion-filter-container js-discussion-filter-container qa-discussion-filter" class="gl-mr-3 full-width-mobile discussion-filter-container js-discussion-filter-container qa-discussion-filter"
data-qa-selector="discussion_filter_dropdown"
:text="currentFilter.title" :text="currentFilter.title"
> >
<div v-for="filter in filters" :key="filter.value" class="dropdown-item-wrapper"> <div v-for="filter in filters" :key="filter.value" class="dropdown-item-wrapper">
...@@ -125,7 +126,7 @@ export default { ...@@ -125,7 +126,7 @@ export default {
:is-checked="filter.value === currentValue" :is-checked="filter.value === currentValue"
:class="{ 'is-active': filter.value === currentValue }" :class="{ 'is-active': filter.value === currentValue }"
:data-filter-type="filterType(filter.value)" :data-filter-type="filterType(filter.value)"
class="qa-filter-options" data-qa-selector="filter_menu_item"
@click.prevent="selectFilter(filter.value)" @click.prevent="selectFilter(filter.value)"
> >
{{ filter.title }} {{ filter.title }}
......
...@@ -33,7 +33,10 @@ export default { ...@@ -33,7 +33,10 @@ export default {
</script> </script>
<template> <template>
<li class="timeline-entry note note-wrapper discussion-filter-note js-discussion-filter-note"> <li
class="timeline-entry note note-wrapper discussion-filter-note js-discussion-filter-note"
data-qa-selector="discussion_filter_container"
>
<div class="timeline-icon d-none d-lg-flex"> <div class="timeline-icon d-none d-lg-flex">
<gl-icon name="comment" /> <gl-icon name="comment" />
</div> </div>
......
...@@ -170,7 +170,9 @@ export default { ...@@ -170,7 +170,9 @@ export default {
</template> </template>
<span v-else>{{ __('A deleted user') }}</span> <span v-else>{{ __('A deleted user') }}</span>
<span class="note-headline-light note-headline-meta"> <span class="note-headline-light note-headline-meta">
<span class="system-note-message"> <slot></slot> </span> <span class="system-note-message" data-qa-selector="system_note_content">
<slot></slot>
</span>
<template v-if="createdAt"> <template v-if="createdAt">
<span ref="actionText" class="system-note-separator"> <span ref="actionText" class="system-note-separator">
<template v-if="actionText">{{ actionText }}</template> <template v-if="actionText">{{ actionText }}</template>
......
...@@ -353,7 +353,8 @@ export default { ...@@ -353,7 +353,8 @@ export default {
:class="classNameBindings" :class="classNameBindings"
:data-award-url="note.toggle_award_path" :data-award-url="note.toggle_award_path"
:data-note-id="note.id" :data-note-id="note.id"
class="note note-wrapper qa-noteable-note-item" class="note note-wrapper"
data-qa-selector="noteable_note_container"
> >
<div <div
v-if="showMultiLineComment" v-if="showMultiLineComment"
......
...@@ -97,7 +97,11 @@ export default { ...@@ -97,7 +97,11 @@ export default {
class="related-issues-token-body bordered-box bg-white" class="related-issues-token-body bordered-box bg-white"
:class="{ 'sortable-container': canReorder }" :class="{ 'sortable-container': canReorder }"
> >
<div v-if="isFetching" class="related-issues-loading-icon qa-related-issues-loading-icon"> <div
v-if="isFetching"
class="related-issues-loading-icon"
data-qa-selector="related_issues_loading_placeholder"
>
<gl-loading-icon ref="loadingIcon" label="Fetching linked issues" class="gl-mt-2" /> <gl-loading-icon ref="loadingIcon" label="Fetching linked issues" class="gl-mt-2" />
</div> </div>
<ul ref="list" :class="{ 'content-list': !canReorder }" class="related-items-list"> <ul ref="list" :class="{ 'content-list': !canReorder }" class="related-items-list">
...@@ -132,7 +136,7 @@ export default { ...@@ -132,7 +136,7 @@ export default {
:is-locked="issue.lockIssueRemoval" :is-locked="issue.lockIssueRemoval"
:locked-message="issue.lockedMessage" :locked-message="issue.lockedMessage"
event-namespace="relatedIssue" event-namespace="relatedIssue"
class="qa-related-issuable-item" data-qa-selector="related_issuable_content"
@relatedIssueRemoveRequest="$emit('relatedIssueRemoveRequest', $event)" @relatedIssueRemoveRequest="$emit('relatedIssueRemoveRequest', $event)"
/> />
</li> </li>
......
...@@ -61,6 +61,7 @@ exports[`Event Item with action buttons renders the action buttons 1`] = ` ...@@ -61,6 +61,7 @@ exports[`Event Item with action buttons renders the action buttons 1`] = `
> >
<span <span
class="system-note-message" class="system-note-message"
data-qa-selector="system_note_content"
> >
· ·
</span> </span>
......
...@@ -16,12 +16,20 @@ module QA ...@@ -16,12 +16,20 @@ module QA
end end
view 'app/assets/javascripts/notes/components/discussion_filter.vue' do view 'app/assets/javascripts/notes/components/discussion_filter.vue' do
element :discussion_filter, required: true element :discussion_filter_dropdown, required: true
element :filter_options element :filter_menu_item
end
view 'app/assets/javascripts/notes/components/discussion_filter_note.vue' do
element :discussion_filter_container
end end
view 'app/assets/javascripts/notes/components/noteable_note.vue' do view 'app/assets/javascripts/notes/components/noteable_note.vue' do
element :noteable_note_item element :noteable_note_container
end
view 'app/assets/javascripts/notes/components/note_header.vue' do
element :system_note_content
end end
view 'app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue' do view 'app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue' do
...@@ -51,8 +59,8 @@ module QA ...@@ -51,8 +59,8 @@ module QA
end end
view 'app/assets/javascripts/related_issues/components/related_issues_list.vue' do view 'app/assets/javascripts/related_issues/components/related_issues_list.vue' do
element :related_issuable_item element :related_issuable_content
element :related_issues_loading_icon element :related_issues_loading_placeholder
end end
def relate_issue(issue) def relate_issue(issue)
...@@ -62,11 +70,11 @@ module QA ...@@ -62,11 +70,11 @@ module QA
end end
def related_issuable_item def related_issuable_item
find_element(:related_issuable_item) find_element(:related_issuable_content)
end end
def wait_for_related_issues_to_load def wait_for_related_issues_to_load
has_no_element?(:related_issues_loading_icon, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) has_no_element?(:related_issues_loading_placeholder, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
end end
def click_remove_related_issue_button def click_remove_related_issue_button
...@@ -95,11 +103,15 @@ module QA ...@@ -95,11 +103,15 @@ module QA
end end
def has_comment?(comment_text) def has_comment?(comment_text)
has_element?(:noteable_note_item, text: comment_text, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) has_element?(:noteable_note_container, text: comment_text, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
end
def has_system_note?(note_text)
has_element?(:system_note_content, text: note_text, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
end end
def noteable_note_item def noteable_note_item
find_element(:noteable_note_item) find_element(:noteable_note_container)
end end
def select_all_activities_filter def select_all_activities_filter
...@@ -108,10 +120,18 @@ module QA ...@@ -108,10 +120,18 @@ module QA
def select_comments_only_filter def select_comments_only_filter
select_filter_with_text('Show comments only') select_filter_with_text('Show comments only')
wait_until do
has_no_element?(:system_note_content)
end
end end
def select_history_only_filter def select_history_only_filter
select_filter_with_text('Show history only') select_filter_with_text('Show history only')
wait_until do
has_element?(:discussion_filter_container) && has_no_element?(:noteable_note_container)
end
end end
def has_metrics_unfurled? def has_metrics_unfurled?
...@@ -123,8 +143,8 @@ module QA ...@@ -123,8 +143,8 @@ module QA
def select_filter_with_text(text) def select_filter_with_text(text)
retry_on_exception do retry_on_exception do
click_element(:title) click_element(:title)
click_element :discussion_filter click_element :discussion_filter_dropdown
find_element(:filter_options, text: text).click find_element(:filter_menu_item, text: text).click
wait_for_loading wait_for_loading
end end
......
...@@ -18,16 +18,16 @@ module QA ...@@ -18,16 +18,16 @@ module QA
show.comment(my_own_comment, filter: :comments_only) show.comment(my_own_comment, filter: :comments_only)
expect(show).not_to have_content(made_the_issue_confidential) expect(show).not_to have_content(made_the_issue_confidential)
expect(show).to have_content(my_own_comment) expect(show).to have_comment(my_own_comment)
show.select_all_activities_filter show.select_all_activities_filter
expect(show).to have_content(made_the_issue_confidential) expect(show).to have_system_note(made_the_issue_confidential)
expect(show).to have_content(my_own_comment) expect(show).to have_comment(my_own_comment)
show.select_history_only_filter show.select_history_only_filter
expect(show).to have_content(made_the_issue_confidential) expect(show).to have_system_note(made_the_issue_confidential)
expect(show).not_to have_content(my_own_comment) expect(show).not_to have_content(my_own_comment)
end end
end end
......
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