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
0ca472c1
Commit
0ca472c1
authored
Sep 25, 2020
by
Anastasia McDonald
Committed by
Dan Davison
Sep 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add E2E for personal snippet with multiple files
See
https://gitlab.com/gitlab-org/quality/testcases/-/issues/842
parent
2771d5e1
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
108 additions
and
14 deletions
+108
-14
app/assets/javascripts/snippets/components/snippet_blob_actions_edit.vue
...scripts/snippets/components/snippet_blob_actions_edit.vue
+1
-0
app/assets/javascripts/snippets/components/snippet_blob_edit.vue
...ets/javascripts/snippets/components/snippet_blob_edit.vue
+1
-1
qa/qa/page/component/new_snippet.rb
qa/qa/page/component/new_snippet.rb
+25
-4
qa/qa/page/component/snippet.rb
qa/qa/page/component/snippet.rb
+21
-9
qa/qa/resource/snippet.rb
qa/qa/resource/snippet.rb
+11
-0
qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
...ippet/create_personal_snippet_with_multiple_files_spec.rb
+48
-0
spec/frontend/snippets/components/__snapshots__/snippet_blob_edit_spec.js.snap
...s/components/__snapshots__/snippet_blob_edit_spec.js.snap
+1
-0
No files found.
app/assets/javascripts/snippets/components/snippet_blob_actions_edit.vue
View file @
0ca472c1
...
@@ -149,6 +149,7 @@ export default {
...
@@ -149,6 +149,7 @@ export default {
data-testid=
"add_button"
data-testid=
"add_button"
class=
"gl-my-3"
class=
"gl-my-3"
variant=
"dashed"
variant=
"dashed"
data-qa-selector=
"add_file_button"
@
click=
"addBlob"
@
click=
"addBlob"
>
{{
addLabel
}}
</gl-button
>
{{
addLabel
}}
</gl-button
>
>
...
...
app/assets/javascripts/snippets/components/snippet_blob_edit.vue
View file @
0ca472c1
...
@@ -69,7 +69,7 @@ export default {
...
@@ -69,7 +69,7 @@ export default {
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"file-holder snippet"
>
<div
class=
"file-holder snippet"
data-qa-selector=
"file_holder_container"
>
<blob-header-edit
<blob-header-edit
:id=
"inputId"
:id=
"inputId"
:value=
"blob.path"
:value=
"blob.path"
...
...
qa/qa/page/component/new_snippet.rb
View file @
0ca472c1
...
@@ -21,6 +21,7 @@ module QA
...
@@ -21,6 +21,7 @@ module QA
base
.
view
'app/assets/javascripts/snippets/components/snippet_blob_edit.vue'
do
base
.
view
'app/assets/javascripts/snippets/components/snippet_blob_edit.vue'
do
element
:file_name_field
element
:file_name_field
element
:file_holder_container
end
end
base
.
view
'app/views/shared/form_elements/_description.html.haml'
do
base
.
view
'app/views/shared/form_elements/_description.html.haml'
do
...
@@ -35,6 +36,10 @@ module QA
...
@@ -35,6 +36,10 @@ module QA
element
:submit_button
element
:submit_button
end
end
base
.
view
'app/assets/javascripts/snippets/components/snippet_blob_actions_edit.vue'
do
element
:add_file_button
end
base
.
view
'app/views/shared/_zen.html.haml'
do
base
.
view
'app/views/shared/_zen.html.haml'
do
# This 'element' is here only to ensure the changes in the view source aren't mistakenly changed
# This 'element' is here only to ensure the changes in the view source aren't mistakenly changed
element
:_
,
"qa_selector = local_assigns.fetch(:qa_selector, '')"
# rubocop:disable QA/ElementWithPattern
element
:_
,
"qa_selector = local_assigns.fetch(:qa_selector, '')"
# rubocop:disable QA/ElementWithPattern
...
@@ -54,13 +59,29 @@ module QA
...
@@ -54,13 +59,29 @@ module QA
choose
visibility
choose
visibility
end
end
def
fill_file_name
(
name
)
def
fill_file_name
(
name
,
file_number
=
nil
)
fill_element
:file_name_field
,
name
if
file_number
within_element_by_index
(
:file_holder_container
,
file_number
-
1
)
do
fill_element
(
:file_name_field
,
name
)
end
else
fill_element
(
:file_name_field
,
name
)
end
end
end
def
fill_file_content
(
content
)
def
fill_file_content
(
content
,
file_number
=
nil
)
if
file_number
within_element_by_index
(
:file_holder_container
,
file_number
-
1
)
do
text_area
.
set
(
content
)
end
else
text_area
.
set
content
text_area
.
set
content
end
end
end
def
click_add_file
click_element
(
:add_file_button
)
end
def
click_create_snippet_button
def
click_create_snippet_button
wait_until
(
reload:
false
)
{
!
find_element
(
:submit_button
).
disabled?
}
wait_until
(
reload:
false
)
{
!
find_element
(
:submit_button
).
disabled?
}
...
...
qa/qa/page/component/snippet.rb
View file @
0ca472c1
...
@@ -98,17 +98,29 @@ module QA
...
@@ -98,17 +98,29 @@ module QA
end
end
end
end
def
has_file_name?
(
file_name
)
def
has_file_name?
(
file_name
,
file_number
=
nil
)
if
file_number
within_element_by_index
(
:file_title_content
,
file_number
-
1
)
do
has_text?
(
file_name
)
end
else
within_element
(
:file_title_content
)
do
within_element
(
:file_title_content
)
do
has_text?
(
file_name
)
has_text?
(
file_name
)
end
end
end
end
end
def
has_file_content?
(
file_content
)
def
has_file_content?
(
file_content
,
file_number
=
nil
)
if
file_number
within_element_by_index
(
:file_content
,
file_number
-
1
)
do
has_text?
(
file_content
)
end
else
within_element
(
:file_content
)
do
within_element
(
:file_content
)
do
has_text?
(
file_content
)
has_text?
(
file_content
)
end
end
end
end
end
def
has_embed_dropdown?
def
has_embed_dropdown?
has_element?
(
:snippet_embed_dropdown
)
has_element?
(
:snippet_embed_dropdown
)
...
...
qa/qa/resource/snippet.rb
View file @
0ca472c1
...
@@ -11,6 +11,11 @@ module QA
...
@@ -11,6 +11,11 @@ module QA
@visibility
=
'Public'
@visibility
=
'Public'
@file_content
=
'The snippet content'
@file_content
=
'The snippet content'
@file_name
=
'New snippet file name'
@file_name
=
'New snippet file name'
@files
=
[]
end
def
add_files
yield
@files
end
end
def
fabricate!
def
fabricate!
...
@@ -22,6 +27,12 @@ module QA
...
@@ -22,6 +27,12 @@ module QA
new_page
.
set_visibility
(
@visibility
)
new_page
.
set_visibility
(
@visibility
)
new_page
.
fill_file_name
(
@file_name
)
new_page
.
fill_file_name
(
@file_name
)
new_page
.
fill_file_content
(
@file_content
)
new_page
.
fill_file_content
(
@file_content
)
@files
.
each
.
with_index
(
2
)
do
|
file
,
i
|
new_page
.
click_add_file
new_page
.
fill_file_name
(
file
[
:name
],
i
)
new_page
.
fill_file_content
(
file
[
:content
],
i
)
end
new_page
.
click_create_snippet_button
new_page
.
click_create_snippet_button
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
0 → 100644
View file @
0ca472c1
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Create'
,
:requires_admin
do
describe
'Multiple file snippet'
do
before
do
Runtime
::
Feature
.
enable_and_verify
(
'snippet_multiple_files'
)
end
after
do
Runtime
::
Feature
.
disable_and_verify
(
'snippet_multiple_files'
)
end
it
'creates a personal snippet with multiple files'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/842'
do
Flow
::
Login
.
sign_in
Page
::
Main
::
Menu
.
perform
do
|
menu
|
menu
.
go_to_more_dropdown_option
(
:snippets_link
)
end
Resource
::
Snippet
.
fabricate_via_browser_ui!
do
|
snippet
|
snippet
.
title
=
'Personal snippet with multiple files'
snippet
.
description
=
'Snippet description'
snippet
.
visibility
=
'Public'
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
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
expect
(
snippet
).
to
have_snippet_title
(
'Personal snippet with multiple files'
)
expect
(
snippet
).
to
have_snippet_description
(
'Snippet description'
)
expect
(
snippet
).
to
have_visibility_type
(
/public/i
)
expect
(
snippet
).
to
have_file_name
(
'First file name'
,
1
)
expect
(
snippet
).
to
have_file_content
(
'First file content'
,
1
)
expect
(
snippet
).
to
have_file_name
(
'Second file name'
,
2
)
expect
(
snippet
).
to
have_file_content
(
'Second file content'
,
2
)
expect
(
snippet
).
to
have_file_name
(
'Third file name'
,
3
)
expect
(
snippet
).
to
have_file_content
(
'Third file content'
,
3
)
end
end
end
end
end
spec/frontend/snippets/components/__snapshots__/snippet_blob_edit_spec.js.snap
View file @
0ca472c1
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
exports[`Snippet Blob Edit component with loaded blob matches snapshot 1`] = `
exports[`Snippet Blob Edit component with loaded blob matches snapshot 1`] = `
<div
<div
class="file-holder snippet"
class="file-holder snippet"
data-qa-selector="file_holder_container"
>
>
<blob-header-edit-stub
<blob-header-edit-stub
candelete="true"
candelete="true"
...
...
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