Commit 27d3b70f authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'qa-remove-snippets-created-via-browser-ui' into 'master'

Remove snippets created via Browser UI

See merge request gitlab-org/gitlab!71625
parents 20b513a7 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
......
......@@ -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
......
......@@ -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
......
......@@ -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!
......
......@@ -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')
......
......@@ -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 = 'Public'
snippet.visibility = 'Private'
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(/public/i)
expect(snippet).to have_visibility_type(/private/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)
......
......@@ -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')
......
......@@ -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
......
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