2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'list of badges', feature_category: :continuous_integration do
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2016-06-02 11:05:42 +05:30
|
|
|
user = create(:user)
|
2017-09-10 17:25:29 +05:30
|
|
|
project = create(:project, :repository)
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2018-05-09 12:01:36 +05:30
|
|
|
visit project_settings_ci_cd_path(project)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user wants to see build status badge' do
|
2017-09-10 17:25:29 +05:30
|
|
|
page.within('.pipeline-status') do
|
|
|
|
expect(page).to have_content 'pipeline status'
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_content 'Markdown'
|
|
|
|
expect(page).to have_content 'HTML'
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content 'AsciiDoc'
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(page).to have_css('.js-syntax-highlight', count: 3)
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_xpath("//img[@alt='pipeline status']")
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
page.within('.js-syntax-highlight', match: :first) do
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content 'badges/master/pipeline.svg'
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user wants to see coverage report badge' do
|
2016-09-13 17:45:13 +05:30
|
|
|
page.within('.coverage-report') do
|
|
|
|
expect(page).to have_content 'coverage report'
|
|
|
|
expect(page).to have_content 'Markdown'
|
|
|
|
expect(page).to have_content 'HTML'
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content 'AsciiDoc'
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(page).to have_css('.js-syntax-highlight', count: 3)
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_xpath("//img[@alt='coverage report']")
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
page.within('.js-syntax-highlight', match: :first) do
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_content 'badges/master/coverage.svg'
|
|
|
|
end
|
2016-06-22 15:30:34 +05:30
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user changes current ref of build status badge', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
page.within('.pipeline-status') do
|
2023-05-27 22:25:52 +05:30
|
|
|
find('.ref-selector').click
|
|
|
|
wait_for_requests
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
page.within('.ref-selector') do
|
|
|
|
fill_in 'Search by Git revision', with: 'improve/awesome'
|
|
|
|
wait_for_requests
|
|
|
|
find('li', text: 'improve/awesome', match: :prefer_exact).click
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content 'badges/improve/awesome/pipeline.svg'
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
2023-05-27 22:25:52 +05:30
|
|
|
|
|
|
|
it 'user changes current ref of coverage status badge', :js do
|
|
|
|
page.within('.coverage-report') do
|
|
|
|
find('.ref-selector').click
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
page.within('.ref-selector') do
|
|
|
|
fill_in 'Search by Git revision', with: 'improve/awesome'
|
|
|
|
wait_for_requests
|
|
|
|
find('li', text: 'improve/awesome', match: :prefer_exact).click
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content 'badges/improve/awesome/coverage.svg'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'user changes current ref of latest release status badge', :js do
|
|
|
|
page.within('.Latest-Release') do
|
|
|
|
find('.ref-selector').click
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
page.within('.ref-selector') do
|
|
|
|
fill_in 'Search by Git revision', with: 'improve/awesome'
|
|
|
|
wait_for_requests
|
|
|
|
find('li', text: 'improve/awesome', match: :prefer_exact).click
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content '-/badges/release.svg'
|
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|