Skip to content
Snippets Groups Projects
Commit 689c3c27 authored by Anastasia McDonald's avatar Anastasia McDonald Committed by Mark Lapierre
Browse files
parent 1e7ea614
No related branches found
No related tags found
No related merge requests found
%li{ class: active_when(params[:id] == wiki_page.slug) }
= link_to wiki_page_path(@wiki, wiki_page), data: { qa_selector: 'wiki_page_link', qa_page_name: wiki_page.slug } do
= link_to wiki_page_path(@wiki, wiki_page), data: { qa_selector: 'wiki_page_link', qa_page_name: wiki_page.human_title } do
= wiki_page.human_title
Loading
Loading
@@ -121,6 +121,7 @@ module Repository
 
module Wiki
autoload :ProjectPage, 'qa/resource/wiki/project_page'
autoload :GroupPage, 'qa/resource/wiki/group_page'
end
end
 
Loading
Loading
@@ -380,7 +381,6 @@ module Wiki
autoload :Edit, 'qa/page/project/wiki/edit'
autoload :Show, 'qa/page/project/wiki/show'
autoload :GitAccess, 'qa/page/project/wiki/git_access'
autoload :Sidebar, 'qa/page/project/wiki/sidebar'
autoload :List, 'qa/page/project/wiki/list'
end
 
Loading
Loading
@@ -496,6 +496,9 @@ module Component
autoload :Snippet, 'qa/page/component/snippet'
autoload :NewSnippet, 'qa/page/component/new_snippet'
autoload :InviteMembersModal, 'qa/page/component/invite_members_modal'
autoload :Wiki, 'qa/page/component/wiki'
autoload :WikiSidebar, 'qa/page/component/wiki_sidebar'
autoload :WikiPageForm, 'qa/page/component/wiki_page_form'
 
module Issuable
autoload :Common, 'qa/page/component/issuable/common'
Loading
Loading
Loading
Loading
@@ -49,6 +49,11 @@ module Settings
autoload :LDAPSync, 'qa/ee/page/group/settings/ldap_sync'
autoload :General, 'qa/ee/page/group/settings/general'
end
module Wiki
autoload :Show, 'qa/ee/page/group/wiki/show'
autoload :Edit, 'qa/ee/page/group/wiki/edit'
end
end
 
module File
Loading
Loading
# frozen_string_literal: true
module QA
module EE
module Page
module Group
module Wiki
class Edit < QA::Page::Base
include QA::Page::Component::WikiPageForm
include QA::Page::Component::WikiSidebar
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Page
module Group
module Wiki
class Show < QA::Page::Base
include QA::Page::Component::Wiki
include QA::Page::Component::WikiSidebar
include QA::Page::Component::LazyLoader
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module Page
module Component
module Wiki
extend QA::Page::PageConcern
def self.included(base)
super
base.view 'app/views/shared/wikis/show.html.haml' do
element :wiki_page_title
element :wiki_page_content
element :edit_page_button
end
base.view 'app/views/shared/wikis/_main_links.html.haml' do
element :new_page_button
element :page_history_button
end
base.view 'app/views/shared/empty_states/_wikis.html.haml' do
element :create_first_page_link
end
base.view 'app/views/shared/empty_states/_wikis_layout.html.haml' do
element :svg_content
end
end
def click_create_your_first_page
# The svg takes a fraction of a second to load after which the
# "Create your first page" button shifts up a bit. This can cause
# webdriver to miss the hit so we wait for the svg to load before
# clicking the button.
within_element(:svg_content) do
has_element?(:js_lazy_loaded)
end
click_element(:create_first_page_link)
end
def click_new_page
click_element(:new_page_button)
end
def click_page_history
click_element(:page_history_button)
end
def click_edit
click_element(:edit_page_button)
end
def has_title?(title)
has_element?(:wiki_page_title, title)
end
def has_content?(content)
has_element?(:wiki_page_content, content)
end
def has_no_content?(content)
has_no_element?(:wiki_page_content, content)
end
def has_no_page?
has_element?(:create_first_page_link)
end
end
end
end
end
# frozen_string_literal: true
module QA
module Page
module Component
module WikiPageForm
extend QA::Page::PageConcern
def self.included(base)
super
base.view 'app/views/shared/wikis/_form.html.haml' do
element :wiki_title_textbox
element :wiki_content_textarea
element :wiki_message_textbox
element :save_changes_button
element :create_page_button
end
base.view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do
element :delete_button
end
end
def set_title(title)
fill_element(:wiki_title_textbox, title)
end
def set_content(content)
fill_element(:wiki_content_textarea, content)
end
def set_message(message)
fill_element(:wiki_message_textbox, message)
end
def click_save_changes
click_element(:save_changes_button)
end
def click_create_page
click_element(:create_page_button)
end
def delete_page
click_element(:delete_button, Page::Modal::DeleteWiki)
Page::Modal::DeleteWiki.perform(&:confirm_deletion)
end
end
end
end
end
# frozen_string_literal: true
module QA
module Page
module Component
module WikiSidebar
extend QA::Page::PageConcern
def self.included(base)
super
base.view 'app/views/shared/wikis/_sidebar.html.haml' do
element :clone_repository_link
element :view_all_pages_button
end
base.view 'app/views/shared/wikis/_sidebar_wiki_page.html.haml' do
element :wiki_page_link
end
base.view 'app/views/shared/wikis/_wiki_directory.html.haml' do
element :wiki_directory_content
end
end
def click_clone_repository
click_element(:clone_repository_link)
end
def click_view_all_pages
click_element(:view_all_pages_button)
end
def click_page_link(page_title)
click_element(:wiki_page_link, page_name: page_title)
end
def has_page_listed?(page_title)
has_element?(:wiki_page_link, page_name: page_title)
end
def has_directory?(directory)
has_element?(:wiki_directory_content, text: directory)
end
end
end
end
end
Loading
Loading
@@ -5,44 +5,8 @@ module Page
module Project
module Wiki
class Edit < Base
include Wiki::Sidebar
view 'app/views/shared/wikis/_form.html.haml' do
element :wiki_title_textbox
element :wiki_content_textarea
element :wiki_message_textbox
element :save_changes_button
element :create_page_button
end
view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do
element :delete_button
end
def set_title(title)
fill_element :wiki_title_textbox, title
end
def set_content(content)
fill_element :wiki_content_textarea, content
end
def set_message(message)
fill_element :wiki_message_textbox, message
end
def click_save_changes
click_element :save_changes_button
end
def click_create_page
click_element :create_page_button
end
def delete_page
click_element :delete_button, Page::Modal::DeleteWiki
Page::Modal::DeleteWiki.perform(&:confirm_deletion)
end
include Page::Component::WikiPageForm
include Page::Component::WikiSidebar
end
end
end
Loading
Loading
Loading
Loading
@@ -5,67 +5,9 @@ module Page
module Project
module Wiki
class Show < Base
include Wiki::Sidebar
include Component::LazyLoader
view 'app/views/shared/wikis/show.html.haml' do
element :wiki_page_title
element :wiki_page_content
element :edit_page_button
end
view 'app/views/shared/wikis/_main_links.html.haml' do
element :new_page_button
element :page_history_button
end
view 'app/views/shared/empty_states/_wikis.html.haml' do
element :create_first_page_link
end
view 'app/views/shared/empty_states/_wikis_layout.html.haml' do
element :svg_content
end
def click_create_your_first_page
# The svg takes a fraction of a second to load after which the
# "Create your first page" button shifts up a bit. This can cause
# webdriver to miss the hit so we wait for the svg to load before
# clicking the button.
within_element(:svg_content) do
has_element? :js_lazy_loaded
end
click_element :create_first_page_link
end
def click_new_page
click_element(:new_page_button)
end
def click_page_history
click_element(:page_history_button)
end
def click_edit
click_element(:edit_page_button)
end
def has_title?(title)
has_element?(:wiki_page_title, title)
end
def has_content?(content)
has_element?(:wiki_page_content, content)
end
def has_no_content?(content)
has_no_element?(:wiki_page_content, content)
end
def has_no_page?
has_element? :create_first_page_link
end
include Page::Component::Wiki
include Page::Component::WikiSidebar
include Page::Component::LazyLoader
end
end
end
Loading
Loading
# frozen_string_literal: true
module QA
module Page
module Project
module Wiki
module Sidebar
extend QA::Page::PageConcern
def self.included(base)
super
base.view 'app/views/shared/wikis/_sidebar.html.haml' do
element :clone_repository_link
element :view_all_pages_button
end
base.view 'app/views/shared/wikis/_sidebar_wiki_page.html.haml' do
element :wiki_page_link
end
base.view 'app/views/shared/wikis/_wiki_directory.html.haml' do
element :wiki_directory_content
end
end
def click_clone_repository
click_element(:clone_repository_link)
end
def click_view_all_pages
click_element(:view_all_pages_button)
end
def click_page_link(page_title)
click_element :wiki_page_link, page_name: page_title
end
def has_page_listed?(page_title)
has_element? :wiki_page_link, page_name: page_title
end
def has_directory?(directory)
has_element? :wiki_directory_content, text: directory
end
end
end
end
end
end
# frozen_string_literal: true
require 'securerandom'
module QA
module Resource
module Wiki
class GroupPage < Base
attribute :title
attribute :content
attribute :slug
attribute :group do
Group.fabricate_via_api! do |group|
group.path = "group-with-wiki-#{SecureRandom.hex(8)}"
end
end
def initialize
@title = 'Home'
@content = 'This wiki page is created via API'
end
def resource_web_url(resource)
super
rescue ResourceURLMissingError
"#{group.web_url}/-/wikis/#{slug}"
end
def api_get_path
"/groups/#{group.id}/wikis/#{slug}"
end
def api_post_path
"/groups/#{group.id}/wikis"
end
def api_post_body
{
id: group.id,
content: content,
title: title
}
end
end
end
end
end
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
context 'Wiki' do
describe 'Creating pages in Group Wikis' do
let(:wiki_title) { 'New Wiki page' }
let(:wiki_content) { 'New Wiki content' }
before do
Flow::Login.sign_in
end
context 'when Wiki is empty' do
let(:group) { Resource::Group.fabricate_via_api! }
it 'creates a home page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1708' do
group.visit!
Page::Group::Menu.perform(&:click_group_wiki_link)
EE::Page::Group::Wiki::Show.perform(&:click_create_your_first_page)
EE::Page::Group::Wiki::Edit.perform do |edit|
edit.set_title(wiki_title)
edit.set_content(wiki_content)
edit.click_create_page
end
EE::Page::Group::Wiki::Show.perform do |wiki|
expect(wiki).to have_title(wiki_title)
expect(wiki).to have_content(wiki_content)
end
end
end
context 'when Wiki has a home page' do
let(:wiki) do
Resource::Wiki::GroupPage.fabricate_via_api! do |wiki|
wiki.title = 'Home page'
end
end
it 'adds a second page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1728' do
wiki.visit!
EE::Page::Group::Wiki::Show.perform(&:click_new_page)
EE::Page::Group::Wiki::Edit.perform do |edit|
edit.set_title(wiki_title)
edit.set_content(wiki_content)
edit.click_create_page
end
EE::Page::Group::Wiki::Show.perform do |wiki|
expect(wiki).to have_title(wiki_title)
expect(wiki).to have_content(wiki_content)
expect(wiki).to have_page_listed('Home page')
end
end
end
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment