debian-mirror-gitlab/spec/features/help_pages_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.9 KiB
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
2015-04-26 12:48:37 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Help Pages' do
2017-08-17 22:00:37 +05:30
describe 'Get the main help page' do
2020-05-24 23:13:21 +05:30
before do
allow(File).to receive(:read).and_call_original
allow(File).to receive(:read).with(Rails.root.join('doc', 'README.md')).and_return(fixture_file('sample_doc.md'))
2017-08-17 22:00:37 +05:30
end
2018-03-17 18:26:18 +05:30
context 'quick link shortcuts', :js do
before do
visit help_path
end
it 'focuses search bar' do
find('.js-trigger-search-bar').click
expect(page).to have_selector('#search:focus')
end
it 'opens shortcuts help dialog' do
find('.js-trigger-shortcut').click
2021-03-11 19:13:27 +05:30
expect(page).to have_selector('[data-testid="modal-shortcuts"]')
2018-03-17 18:26:18 +05:30
end
end
2017-08-17 22:00:37 +05:30
end
2022-03-02 08:16:31 +05:30
describe 'with version check enabled' do
let_it_be(:user) { create(:user) }
2015-04-26 12:48:37 +05:30
before do
2018-03-17 18:26:18 +05:30
stub_application_setting(version_check_enabled: true)
2022-03-02 08:16:31 +05:30
allow(User).to receive(:single_user).and_return(double(user, requires_usage_stats_consent?: false))
allow(user).to receive(:can_read_all_resources?).and_return(true)
2019-02-15 15:39:39 +05:30
2022-03-02 08:16:31 +05:30
sign_in(user)
2017-08-17 22:00:37 +05:30
visit help_path
end
2022-03-02 08:16:31 +05:30
it 'renders the version check badge' do
2023-01-13 00:05:48 +05:30
expect(page).to have_selector('.js-gitlab-version-check-badge')
2017-08-17 22:00:37 +05:30
end
2017-09-10 17:25:29 +05:30
end
describe 'when help page is customized' do
before do
2018-03-17 18:26:18 +05:30
stub_application_setting(help_page_hide_commercial_content: true,
help_page_text: 'My Custom Text',
help_page_support_url: 'http://example.com/help')
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
sign_in(create(:user))
visit help_path
end
2019-07-07 11:18:12 +05:30
it 'displays custom help page text' do
2017-09-10 17:25:29 +05:30
expect(page).to have_text "My Custom Text"
end
2019-07-07 11:18:12 +05:30
it 'hides marketing content when enabled' do
2017-09-10 17:25:29 +05:30
expect(page).not_to have_link "Get a support subscription"
end
2017-08-17 22:00:37 +05:30
2019-07-07 11:18:12 +05:30
it 'uses a custom support url' do
2021-09-30 23:02:18 +05:30
expect(page).to have_link "See our website for help", href: "http://example.com/help"
2015-04-26 12:48:37 +05:30
end
end
end