Commit fdb217fa authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'qa-e2e-improve-add-file-template' into 'master'

Add unique folder name for add_file_template test

Closes #220997

See merge request gitlab-org/gitlab!36905
parents bcce1723 222b4f38
...@@ -64,6 +64,7 @@ export default { ...@@ -64,6 +64,7 @@ export default {
:aria-label="__('Create new file or directory')" :aria-label="__('Create new file or directory')"
type="button" type="button"
class="rounded border-0 d-flex ide-entry-dropdown-toggle" class="rounded border-0 d-flex ide-entry-dropdown-toggle"
data-qa-selector="dropdown_button"
@click.stop="openDropdown()" @click.stop="openDropdown()"
> >
<icon name="ellipsis_v" /> <icon name="chevron-down" /> <icon name="ellipsis_v" /> <icon name="chevron-down" />
...@@ -97,6 +98,7 @@ export default { ...@@ -97,6 +98,7 @@ export default {
class="d-flex" class="d-flex"
icon="pencil" icon="pencil"
icon-classes="mr-2" icon-classes="mr-2"
data-qa-selector="rename_move_button"
@click="createNewItem($options.modalTypes.rename)" @click="createNewItem($options.modalTypes.rename)"
/> />
</li> </li>
......
...@@ -118,7 +118,12 @@ export default { ...@@ -118,7 +118,12 @@ export default {
@mouseleave="$emit('mouseleave', $event)" @mouseleave="$emit('mouseleave', $event)"
> >
<div class="file-row-name-container"> <div class="file-row-name-container">
<span ref="textOutput" :style="levelIndentation" class="file-row-name str-truncated"> <span
ref="textOutput"
:style="levelIndentation"
class="file-row-name str-truncated"
data-qa-selector="file_name_content"
>
<file-icon <file-icon
class="file-row-icon" class="file-row-icon"
:class="{ 'text-secondary': file.type === 'tree' }" :class="{ 'text-secondary': file.type === 'tree' }"
......
...@@ -9,7 +9,7 @@ module QA ...@@ -9,7 +9,7 @@ module QA
view 'app/assets/javascripts/ide/components/new_dropdown/modal.vue' do view 'app/assets/javascripts/ide/components/new_dropdown/modal.vue' do
element :file_name_field, required: true element :file_name_field, required: true
element :new_file_modal, required: true element :new_file_modal, required: true
element :template_list, required: true element :template_list
end end
end end
end end
......
...@@ -50,6 +50,15 @@ module QA ...@@ -50,6 +50,15 @@ module QA
element :first_file_button element :first_file_button
end end
view 'app/assets/javascripts/vue_shared/components/file_row.vue' do
element :file_name_content
end
view 'app/assets/javascripts/ide/components/new_dropdown/index.vue' do
element :dropdown_button
element :rename_move_button
end
def has_file?(file_name) def has_file?(file_name)
within_element(:file_list) do within_element(:file_list) do
page.has_content? file_name page.has_content? file_name
...@@ -132,6 +141,14 @@ module QA ...@@ -132,6 +141,14 @@ module QA
fill_element(:file_name_field, file_name) fill_element(:file_name_field, file_name)
click_button('Create file') click_button('Create file')
end end
def rename_file(file_name, new_file_name)
click_element(:file_name_content, text: file_name)
click_element(:dropdown_button)
click_element(:rename_move_button, Page::Component::WebIDE::Modal::CreateNewFile)
fill_element(:file_name_field, new_file_name)
click_button('Rename file')
end
end end
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
require 'securerandom'
module QA module QA
RSpec.describe 'Create' do RSpec.describe 'Create' do
describe 'Web IDE file templates' do describe 'Web IDE file templates' do
...@@ -53,10 +55,11 @@ module QA ...@@ -53,10 +55,11 @@ module QA
ide.create_new_file_from_template template[:file_name], template[:name] ide.create_new_file_from_template template[:file_name], template[:name]
expect(ide.has_file?(template[:file_name])).to be_truthy expect(ide.has_file?(template[:file_name])).to be_truthy
expect(ide).to have_button('Undo') expect(ide).to have_button('Undo')
expect(ide).to have_normalized_ws_text(content[0..100]) expect(ide).to have_normalized_ws_text(content[0..100])
ide.rename_file(template[:file_name], "#{SecureRandom.hex(8)}/#{template[:file_name]}")
ide.commit_changes ide.commit_changes
expect(ide).to have_content(template[:file_name]) expect(ide).to have_content(template[:file_name])
......
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