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
b4bd6a06
Commit
b4bd6a06
authored
Oct 04, 2021
by
Anastasia McDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove snippets created via Browser UI
See
https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/763
parent
7fb683a5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
23 deletions
+74
-23
app/views/layouts/nav/_breadcrumbs.html.haml
app/views/layouts/nav/_breadcrumbs.html.haml
+1
-1
qa/qa/page/component/snippet.rb
qa/qa/page/component/snippet.rb
+11
-0
qa/qa/resource/project_snippet.rb
qa/qa/resource/project_snippet.rb
+2
-0
qa/qa/resource/snippet.rb
qa/qa/resource/snippet.rb
+6
-0
qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb
...owser_ui/3_create/snippet/create_personal_snippet_spec.rb
+13
-7
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
+15
-9
qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
...rowser_ui/3_create/snippet/create_project_snippet_spec.rb
+13
-3
qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
...nippet/create_project_snippet_with_multiple_files_spec.rb
+13
-3
No files found.
app/views/layouts/nav/_breadcrumbs.html.haml
View file @
b4bd6a06
...
...
@@ -19,7 +19,7 @@
=
render
"layouts/nav/breadcrumbs/collapsed_dropdown"
,
location: :after
-
unless
@skip_current_level_breadcrumb
%li
%h2
.breadcrumbs-sub-title
%h2
.breadcrumbs-sub-title
{
data:
{
qa_selector:
'breadcrumb_sub_title_content'
}
}
=
link_to
@breadcrumb_title
,
breadcrumb_title_link
%script
{
type:
'application/ld+json'
}
:plain
...
...
qa/qa/page/component/snippet.rb
View file @
b4bd6a06
...
...
@@ -79,6 +79,11 @@ module QA
element
:default_actions_container
element
:copy_contents_button
end
base
.
view
'app/views/layouts/nav/_breadcrumbs.html.haml'
do
element
:breadcrumb_links_content
element
:breadcrumb_sub_title_content
end
end
def
has_snippet_title?
(
snippet_title
)
...
...
@@ -249,6 +254,12 @@ module QA
raise
ElementNotFound
,
"Comment did not appear as expected"
end
end
def
snippet_id
within_element
(
:breadcrumb_links_content
)
do
find_element
(
:breadcrumb_sub_title_content
).
text
.
delete_prefix
(
'$'
)
end
end
end
end
end
...
...
qa/qa/resource/project_snippet.rb
View file @
b4bd6a06
...
...
@@ -30,6 +30,8 @@ module QA
new_snippet
.
click_create_snippet_button
end
@id
=
Page
::
Project
::
Snippet
::
Show
.
perform
(
&
:snippet_id
)
end
def
api_get_path
...
...
qa/qa/resource/snippet.rb
View file @
b4bd6a06
...
...
@@ -22,6 +22,10 @@ module QA
end
def
fabricate!
Page
::
Main
::
Menu
.
perform
do
|
menu
|
menu
.
go_to_menu_dropdown_option
(
:snippets_link
)
end
Page
::
Dashboard
::
Snippet
::
Index
.
perform
(
&
:go_to_new_snippet_page
)
Page
::
Dashboard
::
Snippet
::
New
.
perform
do
|
new_page
|
...
...
@@ -38,6 +42,8 @@ module QA
end
new_page
.
click_create_snippet_button
end
@id
=
Page
::
Dashboard
::
Snippet
::
Show
.
perform
(
&
:snippet_id
)
end
def
fabricate_via_api!
...
...
qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb
View file @
b4bd6a06
...
...
@@ -3,13 +3,7 @@
module
QA
RSpec
.
describe
'Create'
do
# convert back to a smoke test once proved to be stable
describe
'Personal snippet creation'
do
it
'user creates a personal snippet'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1357'
do
Flow
::
Login
.
sign_in
Page
::
Main
::
Menu
.
perform
do
|
menu
|
menu
.
go_to_menu_dropdown_option
(
:snippets_link
)
end
let
(
:snippet
)
do
Resource
::
Snippet
.
fabricate_via_browser_ui!
do
|
snippet
|
snippet
.
title
=
'Snippet title'
snippet
.
description
=
'Snippet description'
...
...
@@ -17,6 +11,18 @@ module QA
snippet
.
file_name
=
'ruby_file.rb'
snippet
.
file_content
=
'File.read("test.txt").split(/\n/)'
end
end
before
do
Flow
::
Login
.
sign_in
end
after
do
snippet
.
remove_via_api!
end
it
'user creates a personal snippet'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1357'
do
snippet
.
visit!
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
expect
(
snippet
).
to
have_snippet_title
(
'Snippet title'
)
...
...
qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
View file @
b4bd6a06
...
...
@@ -3,17 +3,11 @@
module
QA
RSpec
.
describe
'Create'
do
describe
'Multiple file snippet'
do
it
'creates a personal snippet with multiple files'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1654'
do
Flow
::
Login
.
sign_in
Page
::
Main
::
Menu
.
perform
do
|
menu
|
menu
.
go_to_menu_dropdown_option
(
:snippets_link
)
end
let
(
:snippet
)
do
Resource
::
Snippet
.
fabricate_via_browser_ui!
do
|
snippet
|
snippet
.
title
=
'Personal snippet with multiple files'
snippet
.
description
=
'Snippet description'
snippet
.
visibility
=
'P
ublic
'
snippet
.
visibility
=
'P
rivate
'
snippet
.
file_name
=
'First file name'
snippet
.
file_content
=
'First file content'
...
...
@@ -22,11 +16,23 @@ module QA
files
.
append
(
name:
'Third file name'
,
content:
'Third file content'
)
end
end
end
before
do
Flow
::
Login
.
sign_in
end
after
do
snippet
.
remove_via_api!
end
it
'creates a personal snippet with multiple files'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1654'
do
snippet
.
visit!
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
(
/p
ublic
/i
)
expect
(
snippet
).
to
have_visibility_type
(
/p
rivate
/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
)
...
...
qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
View file @
b4bd6a06
...
...
@@ -3,9 +3,7 @@
module
QA
RSpec
.
describe
'Create'
do
# to be converted to a smoke test once proved to be stable
describe
'Project snippet creation'
do
it
'user creates a project snippet'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1358'
do
Flow
::
Login
.
sign_in
let
(
:snippet
)
do
Resource
::
ProjectSnippet
.
fabricate_via_browser_ui!
do
|
snippet
|
snippet
.
title
=
'Project snippet'
snippet
.
description
=
' '
...
...
@@ -13,6 +11,18 @@ module QA
snippet
.
file_name
=
'markdown_file.md'
snippet
.
file_content
=
"### Snippet heading
\n\n
[Gitlab link](https://gitlab.com/)"
end
end
before
do
Flow
::
Login
.
sign_in
end
after
do
snippet
.
remove_via_api!
end
it
'user creates a project snippet'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1358'
do
snippet
.
visit!
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
expect
(
snippet
).
to
have_snippet_title
(
'Project snippet'
)
...
...
qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
View file @
b4bd6a06
...
...
@@ -3,9 +3,7 @@
module
QA
RSpec
.
describe
'Create'
do
describe
'Multiple file snippet'
do
it
'creates a project snippet with multiple files'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1648'
do
Flow
::
Login
.
sign_in
let
(
:snippet
)
do
Resource
::
ProjectSnippet
.
fabricate_via_browser_ui!
do
|
snippet
|
snippet
.
title
=
'Project snippet with multiple files'
snippet
.
description
=
'Snippet description'
...
...
@@ -20,6 +18,18 @@ module QA
end
end
end
end
before
do
Flow
::
Login
.
sign_in
end
after
do
snippet
.
remove_via_api!
end
it
'creates a project snippet with multiple files'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1648'
do
snippet
.
visit!
Page
::
Dashboard
::
Snippet
::
Show
.
perform
do
|
snippet
|
aggregate_failures
'file content verification'
do
...
...
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