Commit 08f6a0fb authored by Anastasia McDonald's avatar Anastasia McDonald Committed by Ramya Authappan

Rewrite content_editor_spec to run with ff on and off

parent 89099ed4
...@@ -442,6 +442,8 @@ export default { ...@@ -442,6 +442,8 @@ export default {
> >
<gl-button <gl-button
data-testid="toggle-editing-mode-button" data-testid="toggle-editing-mode-button"
data-qa-selector="editing_mode_button"
:data-qa-mode="toggleEditingModeButtonText"
variant="link" variant="link"
@click="toggleEditingMode" @click="toggleEditingMode"
>{{ toggleEditingModeButtonText }}</gl-button >{{ toggleEditingModeButtonText }}</gl-button
......
...@@ -15,6 +15,7 @@ module QA ...@@ -15,6 +15,7 @@ module QA
element :wiki_message_textbox element :wiki_message_textbox
element :wiki_submit_button element :wiki_submit_button
element :try_new_editor_container element :try_new_editor_container
element :editing_mode_button
end end
base.view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do base.view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do
...@@ -36,6 +37,10 @@ module QA ...@@ -36,6 +37,10 @@ module QA
def click_submit def click_submit
click_element(:wiki_submit_button) click_element(:wiki_submit_button)
wait_until(reload: false) do
has_no_element?(:wiki_title_textbox)
end
end end
def delete_page def delete_page
...@@ -43,11 +48,19 @@ module QA ...@@ -43,11 +48,19 @@ module QA
Page::Modal::DeleteWiki.perform(&:confirm_deletion) Page::Modal::DeleteWiki.perform(&:confirm_deletion)
end end
def use_new_editor def use_new_editor(toggle)
within_element(:try_new_editor_container) do # Update once the feature is released, see https://gitlab.com/gitlab-org/gitlab/-/issues/345398
click_button('Use the new editor') if toggle
click_element(:editing_mode_button, mode: 'Edit rich text')
else
within_element(:try_new_editor_container) do
click_button('Use the new editor')
end
end
wait_until(reload: false) do
has_element?(:content_editor_container)
end end
has_element?(:content_editor_container)
end end
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
RSpec.describe 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/346149', type: :stale } do RSpec.describe 'Create', :requires_admin do # remove :requires_admin once the ff is enabled by default in https://gitlab.com/gitlab-org/gitlab/-/issues/345398
context 'Content Editor' do context 'Content Editor' do
let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
let(:page_title) { 'Content Editor Page' } let(:page_title) { 'Content Editor Page' }
let(:heading_text) { 'My New Heading' } let(:heading_text) { 'My New Heading' }
let(:image_file_name) { 'testfile.png' } let(:image_file_name) { 'testfile.png' }
let!(:toggle) { Runtime::Feature.enabled?(:wiki_switch_between_content_editor_raw_markdown) }
before do before do
Flow::Login.sign_in Flow::Login.sign_in
...@@ -23,7 +24,7 @@ module QA ...@@ -23,7 +24,7 @@ module QA
Page::Project::Wiki::Edit.perform do |edit| Page::Project::Wiki::Edit.perform do |edit|
edit.set_title(page_title) edit.set_title(page_title)
edit.use_new_editor edit.use_new_editor(toggle)
edit.add_heading('Heading 1', heading_text) edit.add_heading('Heading 1', heading_text)
edit.upload_image(File.absolute_path(File.join('qa', 'fixtures', 'designs', image_file_name))) edit.upload_image(File.absolute_path(File.join('qa', 'fixtures', 'designs', image_file_name)))
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