Commit 860f2b0a authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'qa-smoke-create-project-snippet' into 'master'

Smoke test for project snippet

Closes gitlab-org/quality/testcases#813

See merge request gitlab-org/gitlab!31817
parents ba10ad09 229482a0
......@@ -66,6 +66,7 @@ export default {
ref="contentViewer"
:content="content"
:type="activeViewer.fileType"
data-qa-selector="file_content"
/>
</template>
</div>
......
......@@ -89,6 +89,7 @@ module QA
autoload :ProjectSnippet, 'qa/resource/project_snippet'
autoload :UserGPG, 'qa/resource/user_gpg'
autoload :Visibility, 'qa/resource/visibility'
autoload :ProjectSnippet, 'qa/resource/project_snippet'
module KubernetesCluster
autoload :Base, 'qa/resource/kubernetes_cluster/base'
......
......@@ -35,6 +35,10 @@ module QA
element :file_content
end
view 'app/assets/javascripts/blob/components/blob_content.vue' do
element :file_content
end
view 'app/assets/javascripts/snippets/components/snippet_header.vue' do
element :snippet_action_button
element :delete_snippet_button
......@@ -57,6 +61,10 @@ module QA
has_element? :snippet_description_field, text: snippet_description
end
def has_no_snippet_description?
has_no_element?(:snippet_description_field)
end
def has_visibility_type?(visibility_type)
within_element(:snippet_box) do
has_text?(visibility_type)
......
......@@ -2,8 +2,8 @@
module QA
context 'Create', :smoke do
describe 'Snippet creation' do
it 'User creates a snippet' do
describe 'Personal snippet creation' do
it 'User creates a personal snippet' do
Flow::Login.sign_in
Page::Main::Menu.perform(&:go_to_snippets)
......
# frozen_string_literal: true
module QA
context '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' do
Flow::Login.sign_in
Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Project snippet'
snippet.description = ' '
snippet.visibility = 'Internal'
snippet.file_name = 'markdown_file.md'
snippet.file_content = "### Snippet heading\n\n[Gitlab link](https://gitlab.com/)"
end
Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Project snippet')
expect(snippet).to have_no_snippet_description
expect(snippet).to have_visibility_type(/internal/i)
expect(snippet).to have_file_name('markdown_file.md')
expect(snippet).to have_file_content('Snippet heading')
expect(snippet).to have_file_content('Gitlab link')
expect(snippet).not_to have_file_content('###')
expect(snippet).not_to have_file_content('https://gitlab.com/')
end
end
end
end
end
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