2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-04-04 09:05:38 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'list of badges' do
|
|
|
|
before do
|
2016-04-04 09:05:38 -04:00
|
|
|
user = create(:user)
|
2017-07-24 18:51:14 -04:00
|
|
|
project = create(:project, :repository)
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2018-03-22 10:31:41 -04:00
|
|
|
visit project_settings_ci_cd_path(project)
|
2016-04-04 09:05:38 -04:00
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'user wants to see build status badge' do
|
2017-07-19 07:08:47 -04:00
|
|
|
page.within('.pipeline-status') do
|
|
|
|
expect(page).to have_content 'pipeline status'
|
2016-08-12 08:30:17 -04:00
|
|
|
expect(page).to have_content 'Markdown'
|
|
|
|
expect(page).to have_content 'HTML'
|
2017-02-11 14:15:01 -05:00
|
|
|
expect(page).to have_content 'AsciiDoc'
|
|
|
|
expect(page).to have_css('.highlight', count: 3)
|
2017-07-19 07:08:47 -04:00
|
|
|
expect(page).to have_xpath("//img[@alt='pipeline status']")
|
2016-08-12 08:30:17 -04:00
|
|
|
|
|
|
|
page.within('.highlight', match: :first) do
|
2017-07-19 07:08:47 -04:00
|
|
|
expect(page).to have_content 'badges/master/pipeline.svg'
|
2016-08-12 08:30:17 -04:00
|
|
|
end
|
2016-04-04 09:05:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'user wants to see coverage report badge' do
|
2016-08-12 08:30:17 -04:00
|
|
|
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-02-11 14:15:01 -05:00
|
|
|
expect(page).to have_content 'AsciiDoc'
|
|
|
|
expect(page).to have_css('.highlight', count: 3)
|
2016-08-12 08:30:17 -04:00
|
|
|
expect(page).to have_xpath("//img[@alt='coverage report']")
|
2016-06-08 06:38:19 -04:00
|
|
|
|
2016-08-12 08:30:17 -04:00
|
|
|
page.within('.highlight', match: :first) do
|
|
|
|
expect(page).to have_content 'badges/master/coverage.svg'
|
|
|
|
end
|
2016-06-08 06:38:19 -04:00
|
|
|
end
|
2016-08-12 08:30:17 -04:00
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'user changes current ref of build status badge', :js do
|
2017-07-19 07:08:47 -04:00
|
|
|
page.within('.pipeline-status') do
|
2016-08-12 08:30:17 -04:00
|
|
|
first('.js-project-refs-dropdown').click
|
2016-04-04 09:05:38 -04:00
|
|
|
|
2016-08-12 08:30:17 -04:00
|
|
|
page.within '.project-refs-form' do
|
|
|
|
click_link 'improve/awesome'
|
|
|
|
end
|
|
|
|
|
2017-07-19 07:08:47 -04:00
|
|
|
expect(page).to have_content 'badges/improve/awesome/pipeline.svg'
|
2016-08-12 08:30:17 -04:00
|
|
|
end
|
2016-04-04 09:05:38 -04:00
|
|
|
end
|
|
|
|
end
|