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

user_sees_suggest_pipeline_spec.rb « merge_request « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3893a9cdf28f51c38e0defab7ec16499db51897d (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Merge request > User sees suggest pipeline', :js do
  let(:merge_request) { create(:merge_request) }
  let(:project) { merge_request.source_project }
  let(:user) { project.creator }
  let(:suggest_pipeline_enabled) { true }

  before do
    stub_application_setting(suggest_pipeline_enabled: suggest_pipeline_enabled, auto_devops_enabled: false)
    project.add_maintainer(user)
    sign_in(user)
    visit project_merge_request_path(project, merge_request)
  end

  it 'shows the suggest pipeline widget and then allows dismissal correctly' do
    expect(page).to have_content('Are you adding technical debt or code vulnerabilities?')

    page.within '.mr-pipeline-suggest' do
      find('[data-testid="close"]').click
    end

    wait_for_requests

    expect(page).not_to have_content('Are you adding technical debt or code vulnerabilities?')

    # Reload so we know the user callout was registered
    visit page.current_url

    expect(page).not_to have_content('Are you adding technical debt or code vulnerabilities?')
  end

  it 'runs tour from start to finish ensuring all nudges are executed' do
    # nudge 1
    expect(page).to have_content('Are you adding technical debt or code vulnerabilities?')

    page.within '.mr-pipeline-suggest' do
      find('[data-testid="ok"]').click
    end

    wait_for_requests

    # nudge 2
    expect(page).to have_content('Choose Code Quality to add a pipeline that tests the quality of your code.')

    find('.js-gitlab-ci-yml-selector').click

    wait_for_requests

    within '.gitlab-ci-yml-selector' do
      find('.dropdown-input-field').set('Jekyll')
      find('.dropdown-content li', text: 'Jekyll').click
    end

    wait_for_requests

    expect(page).not_to have_content('Choose Code Quality to add a pipeline that tests the quality of your code.')
    # nudge 3
    expect(page).to have_content('The template is ready!')

    find('#commit-changes').click

    wait_for_requests

    # nudge 4
    expect(page).to have_content("That's it, well done!")
  end

  context 'when feature setting is disabled' do
    let(:suggest_pipeline_enabled) { false }

    it 'does not show the suggest pipeline widget' do
      expect(page).not_to have_content('Are you adding technical debt or code vulnerabilities?')
    end
  end
end