summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb
blob: 25c095d9edaa50defa27ebbb9dd8343115fe7e3a (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
# frozen_string_literal: true

module QA
  RSpec.describe 'Create' do
    context 'File management' do
      let(:file) { Resource::File.fabricate_via_api! }

      updated_file_content = 'QA Test - Updated file content'
      commit_message_for_update = 'QA Test - Update file'

      before do
        Flow::Login.sign_in
        file.visit!
      end

      it 'user edits a file via the Web', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347730' do
        Page::File::Show.perform(&:click_edit)

        Page::File::Form.perform do |file|
          file.remove_content
          file.add_content(updated_file_content)
          file.add_commit_message(commit_message_for_update)
          file.commit_changes
        end

        Page::File::Show.perform do |file|
          aggregate_failures 'file details' do
            expect(file).to have_notice('Your changes have been successfully committed.')
            expect(file).to have_file_content(updated_file_content)
            expect(file).to have_commit_message(commit_message_for_update)
          end
        end
      end
    end
  end
end