summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb
blob: ea821f8b3e662f22ce45f131cc83314564a41d5a (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
# frozen_string_literal: true

module QA
  RSpec.describe 'Create' do
    describe 'First file using Web IDE' do
      let(:project) do
        Resource::Project.fabricate_via_api! do |project|
          project.name = 'empty-project'
          project.initialize_with_readme = false
        end
      end

      let(:web_ide_url) { current_url + '-/ide/project/' + project.path_with_namespace }
      let(:file_name) { 'the very first file.txt' }

      before do
        Flow::Login.sign_in
      end

      it "creates the first file in an empty project via Web IDE", testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/847' do
        # In the first iteration, the test opens Web IDE by modifying the URL to address past regressions.
        # Once the Web IDE button is introduced for empty projects, the test will be modified to go through UI.
        # See https://gitlab.com/gitlab-org/gitlab/-/issues/27915 and https://gitlab.com/gitlab-org/gitlab/-/issues/27535.
        page.visit(web_ide_url)

        Page::Project::WebIDE::Edit.perform do |ide|
          ide.create_first_file(file_name)
          ide.commit_changes
        end

        project.visit!

        Page::Project::Show.perform do |project|
          expect(project).to have_file(file_name)
        end
      end
    end
  end
end