Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d258996a
Commit
d258996a
authored
Dec 22, 2020
by
Anastasia McDonald
Committed by
Mark Lapierre
Dec 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New E2E to test copying snippet file contents
See
https://gitlab.com/gitlab-org/quality/testcases/-/issues/1099
parent
2503be2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
5 deletions
+117
-5
app/assets/javascripts/blob/components/blob_header_default_actions.vue
...vascripts/blob/components/blob_header_default_actions.vue
+2
-1
qa/qa/page/component/snippet.rb
qa/qa/page/component/snippet.rb
+39
-3
qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb
...er_ui/3_create/snippet/copy_snippet_file_contents_spec.rb
+75
-0
qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb
...eatures/browser_ui/3_create/snippet/share_snippet_spec.rb
+1
-1
No files found.
app/assets/javascripts/blob/components/blob_header_default_actions.vue
View file @
d258996a
...
@@ -50,7 +50,7 @@ export default {
...
@@ -50,7 +50,7 @@ export default {
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<gl-button-group>
<gl-button-group
data-qa-selector=
"default_actions_container"
>
<gl-button
<gl-button
v-if=
"!hasRenderError"
v-if=
"!hasRenderError"
v-gl-tooltip
.
hover
v-gl-tooltip
.
hover
...
@@ -59,6 +59,7 @@ export default {
...
@@ -59,6 +59,7 @@ export default {
:disabled=
"copyDisabled"
:disabled=
"copyDisabled"
:data-clipboard-target=
"getBlobHashTarget"
:data-clipboard-target=
"getBlobHashTarget"
data-testid=
"copyContentsButton"
data-testid=
"copyContentsButton"
data-qa-selector=
"copy_contents_button"
icon=
"copy-to-clipboard"
icon=
"copy-to-clipboard"
category=
"primary"
category=
"primary"
variant=
"default"
variant=
"default"
...
...
qa/qa/page/component/snippet.rb
View file @
d258996a
...
@@ -78,6 +78,11 @@ module QA
...
@@ -78,6 +78,11 @@ module QA
base
.
view
'app/assets/javascripts/snippets/components/embed_dropdown.vue'
do
base
.
view
'app/assets/javascripts/snippets/components/embed_dropdown.vue'
do
element
:copy_button
element
:copy_button
end
end
base
.
view
'app/assets/javascripts/blob/components/blob_header_default_actions.vue'
do
element
:default_actions_container
element
:copy_contents_button
end
end
end
def
has_snippet_title?
(
snippet_title
)
def
has_snippet_title?
(
snippet_title
)
...
@@ -182,7 +187,10 @@ module QA
...
@@ -182,7 +187,10 @@ module QA
def
add_comment
(
comment
)
def
add_comment
(
comment
)
fill_element
(
:note_field
,
comment
)
fill_element
(
:note_field
,
comment
)
click_element
(
:comment_button
)
click_element
(
:comment_button
)
wait_until
(
reload:
false
)
{
has_element?
(
:note_author_content
)
}
unless
has_element?
(
:note_author_content
)
raise
ElementNotFound
,
"Comment did not appear as expected"
end
end
end
def
has_comment_author?
(
author_username
)
def
has_comment_author?
(
author_username
)
...
@@ -207,7 +215,10 @@ module QA
...
@@ -207,7 +215,10 @@ module QA
click_element
(
:edit_comment_button
)
click_element
(
:edit_comment_button
)
fill_element
(
:edit_note_field
,
comment
)
fill_element
(
:edit_note_field
,
comment
)
click_element
(
:save_comment_button
)
click_element
(
:save_comment_button
)
wait_until
(
reload:
false
)
{
has_element?
(
:note_author_content
)
}
unless
has_element?
(
:note_author_content
)
raise
ElementNotFound
,
"Comment did not appear as expected"
end
end
end
def
delete_comment
(
comment
)
def
delete_comment
(
comment
)
...
@@ -215,7 +226,32 @@ module QA
...
@@ -215,7 +226,32 @@ module QA
accept_alert
do
accept_alert
do
click_element
(
:delete_comment_button
)
click_element
(
:delete_comment_button
)
end
end
wait_until
(
reload:
false
)
{
has_no_text?
(
comment
)
}
unless
has_no_element?
(
:note_content
,
text:
comment
)
raise
ElementNotFound
,
"Comment was not removed as expected"
end
end
def
click_copy_file_contents
(
file_number
=
nil
)
if
file_number
within_element_by_index
(
:default_actions_container
,
file_number
-
1
)
do
click_element
(
:copy_contents_button
)
end
else
within_element
(
:default_actions_container
)
do
click_element
(
:copy_contents_button
)
end
end
end
def
copy_file_contents_to_comment
(
file_number
=
nil
)
click_copy_file_contents
(
file_number
)
send_keys_to_element
(
:note_field
,
[
:shift
,
:insert
])
click_element
(
:comment_button
)
unless
has_element?
(
:note_author_content
)
raise
ElementNotFound
,
"Comment did not appear as expected"
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb
0 → 100644
View file @
d258996a
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Create'
do
describe
'Multiple file snippet'
do
let
(
:first_file_content
)
{
'First file content'
}
let
(
:second_file_content
)
{
'Second file content'
}
let
(
:third_file_content
)
{
'Third file content'
}
let
(
:personal_snippet
)
do
Resource
::
Snippet
.
fabricate_via_api!
do
|
snippet
|
snippet
.
title
=
'Personal snippet to copy file contents from'
snippet
.
file_name
=
'First file name'
snippet
.
file_content
=
first_file_content
snippet
.
add_files
do
|
files
|
files
.
append
(
name:
'Second file name'
,
content:
second_file_content
)
files
.
append
(
name:
'Third file name'
,
content:
third_file_content
)
end
end
end
let
(
:project_snippet
)
do
Resource
::
ProjectSnippet
.
fabricate_via_api!
do
|
snippet
|
snippet
.
title
=
'Project snippet to copy file contents from'
snippet
.
file_name
=
'First file name'
snippet
.
file_content
=
first_file_content
snippet
.
add_files
do
|
files
|
files
.
append
(
name:
'Second file name'
,
content:
second_file_content
)
files
.
append
(
name:
'Third file name'
,
content:
third_file_content
)
end
end
end
let
(
:files
)
do
[
{
number:
1
,
content:
first_file_content
},
{
number:
2
,
content:
second_file_content
},
{
number:
3
,
content:
third_file_content
}
]
end
before
do
Flow
::
Login
.
sign_in
end
shared_examples
'copying snippet file contents'
do
|
snippet_type
|
it
"copies file contents of a multi-file
#{
snippet_type
}
to a comment and verifies them"
do
send
(
snippet_type
).
visit!
files
.
each
do
|
files
|
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
snippet
.
copy_file_contents_to_comment
(
files
[
:number
])
expect
(
snippet
).
to
have_comment_content
(
files
[
:content
])
snippet
.
delete_comment
(
files
[
:content
])
end
end
end
end
it_behaves_like
'copying snippet file contents'
,
:personal_snippet
it_behaves_like
'copying snippet file contents'
,
:project_snippet
end
end
end
qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb
View file @
d258996a
...
@@ -7,7 +7,7 @@ module QA
...
@@ -7,7 +7,7 @@ module QA
Resource
::
Snippet
.
fabricate!
do
|
snippet
|
Resource
::
Snippet
.
fabricate!
do
|
snippet
|
snippet
.
title
=
'Shared snippet'
snippet
.
title
=
'Shared snippet'
snippet
.
visibility
=
'Public'
snippet
.
visibility
=
'Public'
snippet
.
file_
content
=
'code.py'
snippet
.
file_
name
=
'code.py'
snippet
.
file_content
=
'code to be shared'
snippet
.
file_content
=
'code to be shared'
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment