Commit acc05479 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'ml-update-create-snippet-spec' into 'master'

Update new snippet elements

Closes #205511

See merge request gitlab-org/gitlab!25210
parents 4cf01c0f 72587edd
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
- current_text ||= nil - current_text ||= nil
- supports_autocomplete = local_assigns.fetch(:supports_autocomplete, true) - supports_autocomplete = local_assigns.fetch(:supports_autocomplete, true)
- supports_quick_actions = local_assigns.fetch(:supports_quick_actions, false) - supports_quick_actions = local_assigns.fetch(:supports_quick_actions, false)
- qa_selector = local_assigns.fetch(:qa_selector, '')
.zen-backdrop .zen-backdrop
- classes << ' js-gfm-input js-autosize markdown-area' - classes << ' js-gfm-input js-autosize markdown-area'
- if defined?(f) && f - if defined?(f) && f
...@@ -10,7 +11,8 @@ ...@@ -10,7 +11,8 @@
placeholder: placeholder, placeholder: placeholder,
dir: 'auto', dir: 'auto',
data: { supports_quick_actions: supports_quick_actions, data: { supports_quick_actions: supports_quick_actions,
supports_autocomplete: supports_autocomplete } supports_autocomplete: supports_autocomplete,
qa_selector: qa_selector }
- else - else
= text_area_tag attr, current_text, class: classes, placeholder: placeholder = text_area_tag attr, current_text, class: classes, placeholder: placeholder
%a.zen-control.zen-control-leave.js-zen-leave{ href: "#" } %a.zen-control.zen-control-leave.js-zen-leave{ href: "#" }
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
= f.label :description, s_("Snippets|Description (optional)"), class: 'label-bold' = f.label :description, s_("Snippets|Description (optional)"), class: 'label-bold'
.js-collapsible-input .js-collapsible-input
.js-collapsed{ class: ('d-none' if is_expanded) } .js-collapsed{ class: ('d-none' if is_expanded) }
= text_field_tag nil, nil, class: 'form-control', placeholder: description_placeholder = text_field_tag nil, nil, class: 'form-control', placeholder: description_placeholder, data: { qa_selector: 'description_placeholder' }
.js-expanded{ class: ('d-none' if !is_expanded) } .js-expanded{ class: ('d-none' if !is_expanded) }
= render layout: 'projects/md_preview', locals: { url: preview_markdown_path(@project), referenced_users: true } do = render layout: 'projects/md_preview', locals: { url: preview_markdown_path(@project), referenced_users: true } do
= render 'projects/zen', f: f, attr: :description, classes: 'note-textarea', placeholder: description_placeholder = render 'projects/zen', f: f, attr: :description, classes: 'note-textarea', placeholder: description_placeholder, qa_selector: 'description_field'
= render 'shared/notes/hints' = render 'shared/notes/hints'
.form-group.file-editor .form-group.file-editor
......
...@@ -10,17 +10,25 @@ module QA ...@@ -10,17 +10,25 @@ module QA
end end
view 'app/views/shared/snippets/_form.html.haml' do view 'app/views/shared/snippets/_form.html.haml' do
element :description_field
element :description_placeholder
element :snippet_title element :snippet_title
element :snippet_file_name element :snippet_file_name
element :create_snippet_button element :create_snippet_button
end end
view 'app/views/projects/_zen.html.haml' do
# 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
end
def fill_title(title) def fill_title(title)
fill_element :snippet_title, title fill_element :snippet_title, title
end end
def fill_description(description) def fill_description(description)
fill_element :issuable_form_description, description click_element :description_placeholder
fill_element :description_field, description
end end
def set_visibility(visibility) def set_visibility(visibility)
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
context 'Create', :smoke, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/issues/205511', type: :bug } do context 'Create', :smoke do
describe 'Snippet creation' do describe 'Snippet creation' do
it 'User creates a snippet' do it 'User creates a snippet' do
Flow::Login.sign_in Flow::Login.sign_in
......
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