summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_creation_spec.rb
blob: 2b04ede25b07ade85fd829eceadca7ff53a13d65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# frozen_string_literal: true

module QA
  RSpec.describe 'Create', product_group: :editor do
    describe 'Testing wiki content creation inside a project' do
      let(:new_wiki_title) { "just_another_wiki_page" }
      let(:new_wiki_content) { "this content is changed or added" }
      let(:commit_message) { "this is a new addition to the wiki" }

      let(:project) { Resource::Project.fabricate_via_api! }
      let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }

      before do
        Flow::Login.sign_in
      end

      it 'by adding a home page to the wiki',
        testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do
        project.visit!

        Page::Project::Menu.perform(&:click_wiki)
        Page::Project::Wiki::Show.perform(&:click_create_your_first_page)

        Page::Project::Wiki::Edit.perform do |edit|
          edit.set_title new_wiki_title
          edit.set_content new_wiki_content
          edit.set_message commit_message
        end

        Page::Project::Wiki::Edit.perform(&:click_submit)

        Page::Project::Wiki::Show.perform do |wiki|
          expect(wiki).to have_title new_wiki_title
          expect(wiki).to have_content new_wiki_content
        end
      end

      it 'by adding a second page to the wiki',
        testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do
        wiki.visit!

        Page::Project::Wiki::Show.perform(&:click_new_page)

        Page::Project::Wiki::Edit.perform do |edit|
          edit.set_title new_wiki_title
          edit.set_content new_wiki_content
          edit.set_message commit_message
        end

        Page::Project::Wiki::Edit.perform(&:click_submit)

        Page::Project::Wiki::Show.perform do |wiki|
          expect(wiki).to have_title new_wiki_title
          expect(wiki).to have_content new_wiki_content
        end
      end

      it 'by adding a home page to the wiki using git push',
        testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do
        empty_wiki = Resource::Wiki::ProjectPage.new do |empty_wiki|
          empty_wiki.project = project
        end

        Resource::Repository::WikiPush.fabricate! do |push|
          push.file_name = "#{new_wiki_title}.md"
          push.file_content = new_wiki_content
          push.commit_message = commit_message
          push.wiki = empty_wiki
          push.new_branch = true
        end.visit!

        Page::Project::Wiki::Show.perform do |wiki|
          expect(wiki).to have_title new_wiki_title
          expect(wiki).to have_content new_wiki_content
        end
      end

      it 'by adding a second page to the wiki using git push',
        testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347807' do
        Resource::Repository::WikiPush.fabricate! do |push|
          push.file_name = "#{new_wiki_title}.md"
          push.file_content = new_wiki_content
          push.commit_message = commit_message
          push.wiki = wiki
          push.new_branch = false
        end.visit!

        Page::Project::Wiki::Show.perform do |wiki|
          expect(wiki).to have_title new_wiki_title
          expect(wiki).to have_content new_wiki_content
        end
      end
    end
  end
end