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
13beeccc
Commit
13beeccc
authored
Sep 09, 2020
by
Anastasia McDonald
Committed by
Sanad Liaquat
Sep 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E for sharing a snippet
See
https://gitlab.com/gitlab-org/quality/testcases/-/issues/985
parent
8bda24d2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
1 deletion
+88
-1
app/assets/javascripts/snippets/components/embed_dropdown.vue
...assets/javascripts/snippets/components/embed_dropdown.vue
+2
-0
app/assets/javascripts/snippets/components/show.vue
app/assets/javascripts/snippets/components/show.vue
+5
-1
qa/qa/page/component/snippet.rb
qa/qa/page/component/snippet.rb
+14
-0
qa/qa/page/dashboard/snippet/edit.rb
qa/qa/page/dashboard/snippet/edit.rb
+4
-0
qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb
...eatures/browser_ui/3_create/snippet/share_snippet_spec.rb
+63
-0
No files found.
app/assets/javascripts/snippets/components/embed_dropdown.vue
View file @
13beeccc
...
...
@@ -67,6 +67,8 @@ export default {
:title=
"$options.MSG_COPY"
:data-clipboard-text=
"value"
icon=
"copy-to-clipboard"
data-qa-selector=
"copy_button"
:data-qa-action=
"name"
/>
</
template
>
</gl-form-input-group>
...
...
app/assets/javascripts/snippets/components/show.vue
View file @
13beeccc
...
...
@@ -46,7 +46,11 @@ export default {
<snippet-header
:snippet=
"snippet"
/>
<snippet-title
:snippet=
"snippet"
/>
<div
class=
"gl-display-flex gl-justify-content-end gl-mb-5"
>
<embed-dropdown
v-if=
"embeddable"
:url=
"snippet.webUrl"
/>
<embed-dropdown
v-if=
"embeddable"
:url=
"snippet.webUrl"
data-qa-selector=
"snippet_embed_dropdown"
/>
<clone-dropdown-button
v-if=
"canBeCloned"
class=
"gl-ml-3"
...
...
qa/qa/page/component/snippet.rb
View file @
13beeccc
...
...
@@ -40,6 +40,7 @@ module QA
base
.
view
'app/assets/javascripts/snippets/components/show.vue'
do
element
:clone_button
element
:snippet_embed_dropdown
end
base
.
view
'app/assets/javascripts/vue_shared/components/clone_dropdown.vue'
do
...
...
@@ -73,6 +74,10 @@ module QA
element
:more_actions_dropdown
element
:delete_comment_button
end
base
.
view
'app/assets/javascripts/snippets/components/embed_dropdown.vue'
do
element
:copy_button
end
end
def
has_snippet_title?
(
snippet_title
)
...
...
@@ -105,6 +110,10 @@ module QA
end
end
def
has_embed_dropdown?
has_element?
(
:snippet_embed_dropdown
)
end
def
click_edit_button
click_element
(
:snippet_action_button
,
action:
'Edit'
)
end
...
...
@@ -129,6 +138,11 @@ module QA
Git
::
Location
.
new
(
find_element
(
:copy_ssh_url_button
)[
'data-clipboard-text'
]).
uri
.
to_s
end
def
get_sharing_link
click_element
(
:snippet_embed_dropdown
)
find_element
(
:copy_button
,
action:
'Share'
)[
'data-clipboard-text'
]
end
def
add_comment
(
comment
)
fill_element
(
:note_field
,
comment
)
click_element
(
:comment_button
)
...
...
qa/qa/page/dashboard/snippet/edit.rb
View file @
13beeccc
...
...
@@ -19,6 +19,10 @@ module QA
text_area
.
has_text?
(
content
)
# wait for changes to take effect
end
def
change_visibility_to
(
visibility_type
)
choose
(
visibility_type
)
end
def
save_changes
click_element
(
:submit_button
,
Page
::
Dashboard
::
Snippet
::
Show
)
end
...
...
qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb
0 → 100644
View file @
13beeccc
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Create'
do
describe
'Sharing snippets'
do
let
(
:snippet
)
do
Resource
::
Snippet
.
fabricate!
do
|
snippet
|
snippet
.
title
=
'Shared snippet'
snippet
.
visibility
=
'Public'
snippet
.
file_content
=
'code.py'
snippet
.
file_content
=
'code to be shared'
end
end
before
do
Flow
::
Login
.
sign_in
end
context
'when the snippet is public'
do
it
'can be shared with not signed-in users'
do
snippet
sharing_link
=
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
expect
(
snippet
).
to
have_embed_dropdown
snippet
.
get_sharing_link
end
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
page
.
visit
(
sharing_link
)
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
expect
(
snippet
).
to
have_snippet_title
(
'Shared snippet'
)
expect
(
snippet
).
to
have_visibility_type
(
/public/i
)
expect
(
snippet
).
to
have_file_content
(
'code to be shared'
)
expect
(
snippet
).
to
have_embed_dropdown
end
end
end
context
'when the snippet is changed to private'
do
it
'does not display Embed/Share dropdown'
do
snippet
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
expect
(
snippet
).
to
have_embed_dropdown
snippet
.
click_edit_button
end
Page
::
Dashboard
::
Snippet
::
Edit
.
perform
do
|
snippet
|
snippet
.
change_visibility_to
(
'Private'
)
snippet
.
save_changes
end
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
expect
(
snippet
).
not_to
have_embed_dropdown
end
end
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