summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/wiki/content_editor_spec.rb
blob: 4b8edf8b792fc32cc8e848ad4495c69bbfe3f1b5 (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
# frozen_string_literal: true

module QA
  RSpec.describe 'Create', :reliable do
    context 'Content Editor' do
      let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
      let(:page_title) { 'Content Editor Page' }
      let(:heading_text) { 'My New Heading' }
      let(:image_file_name) { 'testfile.png' }

      before do
        Flow::Login.sign_in
      end

      after do
        initial_wiki.project.remove_via_api!
      end

      it 'creates a formatted Wiki page with an image uploaded', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347640' do
        initial_wiki.visit!

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

        Page::Project::Wiki::Edit.perform do |edit|
          edit.set_title(page_title)
          edit.use_new_editor
          edit.add_heading('Heading 1', heading_text)
          edit.upload_image(File.absolute_path(File.join('qa', 'fixtures', 'designs', image_file_name)))
        end

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

        Page::Project::Wiki::Show.perform do |wiki|
          aggregate_failures 'page shows expected content' do
            expect(wiki).to have_title(page_title)
            expect(wiki).to have_heading('h1', heading_text)
            expect(wiki).to have_image(image_file_name)
          end
        end
      end
    end
  end
end