Commit eeddd966 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'replace_project_builds_summary.feature' into 'master'

Replace the 'project/builds/summary.feature' spinach test with an rspec analog

See merge request !14177
parents 7e992b0b 6f0a727e
---
title: Replace the 'project/builds/summary.feature' spinach test with an rspec analog
merge_request: 14177
author: Vitaliy @blackst0ne Klachkov
type: other
Feature: Project Builds Summary
Background:
Given I sign in as a user
And I own a project
And project has CI enabled
And project has coverage enabled
And project has a recent build
@javascript
Scenario: I browse build details page
When I visit recent build details page
Then I see details of a build
And I see build trace
@javascript
Scenario: I browse project builds page
When I visit project builds page
Then I see coverage
Then I see button to CI Lint
@javascript
Scenario: I erase a build
Given recent build is successful
And recent build has a build trace
When I visit recent build details page
And I click erase build button
Then recent build has been erased
And recent build summary does not have artifacts widget
And recent build summary contains information saying that build has been erased
And the build count cache is updated
class Spinach::Features::ProjectBuildsSummary < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedBuilds
include RepoHelpers
step 'I see coverage' do
page.within('td.coverage') do
expect(page).to have_content "99.9%"
end
end
step 'I see button to CI Lint' do
page.within('.nav-controls') do
ci_lint_tool_link = page.find_link('CI lint')
expect(ci_lint_tool_link[:href]).to end_with(ci_lint_path)
end
end
step 'I click erase build button' do
click_link 'Erase'
end
step 'recent build has been erased' do
expect(@build).not_to have_trace
expect(@build.artifacts_file.exists?).to be_falsy
expect(@build.artifacts_metadata.exists?).to be_falsy
end
step 'recent build summary does not have artifacts widget' do
expect(page).to have_no_css('.artifacts')
end
step 'recent build summary contains information saying that build has been erased' do
page.within('.erased') do
expect(page).to have_content 'Job has been erased'
end
end
step 'the build count cache is updated' do
expect(@build.project.running_or_pending_build_count).to eq @build.project.builds.running_or_pending.count(:all)
end
end
require 'spec_helper'
describe 'User browses a job', :js do
let!(:build) { create(:ci_build, :coverage, pipeline: pipeline) }
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.sha, ref: 'master') }
let(:project) { create(:project, :repository, namespace: user.namespace) }
let(:user) { create(:user) }
before do
project.add_master(user)
project.enable_ci
build.success
build.trace.set('job trace')
sign_in(user)
visit(project_job_path(project, build))
end
it 'erases the job log' do
expect(page).to have_content("Job ##{build.id}")
expect(page).to have_css('#build-trace')
click_link('Erase')
expect(build).not_to have_trace
expect(build.artifacts_file.exists?).to be_falsy
expect(build.artifacts_metadata.exists?).to be_falsy
expect(page).to have_no_css('.artifacts')
page.within('.erased') do
expect(page).to have_content('Job has been erased')
end
expect(build.project.running_or_pending_build_count).to eq(build.project.builds.running_or_pending.count(:all))
end
end
require 'spec_helper'
describe 'User browses jobs' do
let!(:build) { create(:ci_build, :coverage, pipeline: pipeline) }
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.sha, ref: 'master') }
let(:project) { create(:project, :repository, namespace: user.namespace) }
let(:user) { create(:user) }
before do
project.add_master(user)
project.enable_ci
project.update_attribute(:build_coverage_regex, /Coverage (\d+)%/)
sign_in(user)
visit(project_jobs_path(project))
end
it 'shows the coverage' do
page.within('td.coverage') do
expect(page).to have_content('99.9%')
end
end
it 'shows the "CI Lint" button' do
page.within('.nav-controls') do
ci_lint_tool_link = page.find_link('CI lint')
expect(ci_lint_tool_link[:href]).to end_with(ci_lint_path)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment