BigW Consortium Gitlab

admin_settings_spec.rb 1.91 KB
Newer Older
1
require 'spec_helper'
2

3
feature 'Admin updates settings', feature: true do
4 5 6 7
  include StubENV

  before do
    stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
8 9 10 11
    login_as :admin
    visit admin_application_settings_path
  end

12
  scenario 'Change visibility settings' do
13
    choose "application_setting_default_project_visibility_20"
14 15 16 17 18
    click_button 'Save'

    expect(page).to have_content "Application settings saved successfully"
  end

19
  scenario 'Change application settings' do
20
    uncheck 'Gravatar enabled'
21
    fill_in 'Home page URL', with: 'https://about.gitlab.com/'
22
    fill_in 'Help page text', with: 'Example text'
23 24
    click_button 'Save'

Robert Speicher committed
25 26 27
    expect(current_application_settings.gravatar_enabled).to be_falsey
    expect(current_application_settings.home_page_url).to eq "https://about.gitlab.com/"
    expect(page).to have_content "Application settings saved successfully"
28
  end
29

Kamil Trzcinski committed
30
  scenario 'Change Slack Notifications Service template settings' do
31
    click_link 'Service Templates'
Kamil Trzcinski committed
32
    click_link 'Slack notifications'
33 34
    fill_in 'Webhook', with: 'http://localhost'
    fill_in 'Username', with: 'test_user'
35
    fill_in 'service_push_channel', with: '#test_channel'
36
    page.check('Notify only broken pipelines')
37
    page.check('Notify only default branch')
38

39 40 41
    check_all_events
    click_on 'Save'

42
    expect(page).to have_content 'Application settings saved successfully'
43

Kamil Trzcinski committed
44
    click_link 'Slack notifications'
45

46
    page.all('input[type=checkbox]').each do |checkbox|
47
      expect(checkbox).to be_checked
48
    end
49 50
    expect(find_field('Webhook').value).to eq 'http://localhost'
    expect(find_field('Username').value).to eq 'test_user'
51
    expect(find('#service_push_channel').value).to eq '#test_channel'
52
  end
53 54 55 56 57 58 59 60 61 62

  def check_all_events
    page.check('Active')
    page.check('Push')
    page.check('Tag push')
    page.check('Note')
    page.check('Issue')
    page.check('Merge request')
    page.check('Pipeline')
  end
63
end