Welcome to mirror list, hosted at ThFree Co, Russian Federation.

create_edit_clone_push_wiki_spec.rb « wiki « 3_create « browser_ui « features « specs « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e689ba4c69c8ac64e7cc049cc1fe01f4232bfa6e (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
  context 'Create' do
    describe 'Wiki management' do
      it 'user creates, edits, clones, and pushes to the wiki' do
        Runtime::Browser.visit(:gitlab, Page::Main::Login)
        Page::Main::Login.perform(&:sign_in_using_credentials)

        wiki = Resource::Wiki.fabricate! do |resource|
          resource.title = 'Home'
          resource.content = '# My First Wiki Content'
          resource.message = 'Update home'
        end

        validate_content('My First Wiki Content')

        Page::Project::Wiki::Edit.perform(&:click_edit)
        Page::Project::Wiki::New.perform do |page|
          page.set_content("My Second Wiki Content")
          page.save_changes
        end

        validate_content('My Second Wiki Content')

        Resource::Repository::WikiPush.fabricate! do |push|
          push.wiki = wiki
          push.file_name = 'Home.md'
          push.file_content = '# My Third Wiki Content'
          push.commit_message = 'Update Home.md'
        end
        Page::Project::Menu.perform(&:click_wiki)

        expect(page).to have_content('My Third Wiki Content')
      end

      def validate_content(content)
        expect(page).to have_content('Wiki was successfully updated')
        expect(page).to have_content(/#{content}/)
      end
    end
  end
end