Commit 8e796698 authored by Dan Davison's avatar Dan Davison

Merge branch 'tmslvnkc/wiki/delete_page' into 'master'

[E2E] Delete a wiki page

Closes gitlab-org/quality/testcases#268

See merge request gitlab-org/gitlab!36161
parents 38d1aab1 84fba565
...@@ -55,13 +55,22 @@ export default { ...@@ -55,13 +55,22 @@ export default {
<template> <template>
<div class="d-inline-block"> <div class="d-inline-block">
<button v-gl-modal="modalId" type="button" class="btn btn-danger">{{ __('Delete') }}</button> <button
v-gl-modal="modalId"
type="button"
class="btn btn-danger"
data-qa-selector="delete_button"
>
{{ __('Delete') }}
</button>
<gl-modal <gl-modal
:title="title" :title="title"
:ok-title="s__('WikiPageConfirmDelete|Delete page')" :action-primary="{
text: s__('WikiPageConfirmDelete|Delete page'),
attributes: { variant: 'danger', 'data-qa-selector': 'confirm_deletion_button' },
}"
:modal-id="modalId" :modal-id="modalId"
title-tag="h4" title-tag="h4"
ok-variant="danger"
@ok="onSubmit" @ok="onSubmit"
> >
{{ message }} {{ message }}
......
...@@ -474,6 +474,10 @@ module QA ...@@ -474,6 +474,10 @@ module QA
autoload :Templates, 'qa/page/component/project/templates' autoload :Templates, 'qa/page/component/project/templates'
end end
end end
module Modal
autoload :DeleteWiki, 'qa/page/modal/delete_wiki'
end
end end
## ##
......
# frozen_string_literal: true
module QA
module Page
module Modal
class DeleteWiki < Base
view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do
element :confirm_deletion_button, required: true
end
def confirm_deletion
click_element :confirm_deletion_button
end
end
end
end
end
...@@ -15,6 +15,10 @@ module QA ...@@ -15,6 +15,10 @@ module QA
element :create_page_button element :create_page_button
end end
view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do
element :delete_button
end
def set_title(title) def set_title(title)
fill_element :wiki_title_textbox, title fill_element :wiki_title_textbox, title
end end
...@@ -34,6 +38,11 @@ module QA ...@@ -34,6 +38,11 @@ module QA
def click_create_page def click_create_page
click_element :create_page_button click_element :create_page_button
end end
def delete_page
click_element :delete_button, Page::Modal::DeleteWiki
Page::Modal::DeleteWiki.perform(&:confirm_deletion)
end
end end
end end
end end
......
...@@ -58,6 +58,10 @@ module QA ...@@ -58,6 +58,10 @@ module QA
def has_content?(content) def has_content?(content)
has_element?(:wiki_page_content, content) has_element?(:wiki_page_content, content)
end end
def has_no_page?
has_element? :create_first_page_link
end
end end
end end
end end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
context 'Wiki' do
let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
before do
Flow::Login.sign_in
end
context 'Page deletion' do
it 'has removed the deleted page correctly' do
initial_wiki.visit!
Page::Project::Wiki::Show.perform(&:click_edit)
Page::Project::Wiki::Edit.perform(&:delete_page)
Page::Project::Wiki::Show.perform do |wiki|
expect(wiki).to have_no_page
end
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