Commit 18cfacc9 authored by Regis's avatar Regis

more fine tuning - catching edge cases - progress in testing - [ci skip]

parent 2b198ee8
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
<!-- ** will still need gravatar url ** --> <!-- ** will still need gravatar url ** -->
<img <img
class="avatar has-tooltip s20 hidden-xs" class="avatar has-tooltip s20 hidden-xs"
:alt='alt'
:title='pipeline.commit.author_name' :title='pipeline.commit.author_name'
data-container="body" data-container="body"
:src='avatarUrl' :src='avatarUrl'
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
(() => { (() => {
const url = window.location.href; const url = window.location.href;
if (~url.indexOf('scope')) return null; if (~url.indexOf('scope') && !~url.indexOf('scope=pipelines')) return null;
const project = document.querySelector('.pipelines'); const project = document.querySelector('.pipelines');
......
...@@ -16,35 +16,41 @@ ...@@ -16,35 +16,41 @@
<div class="controls pull-right"> <div class="controls pull-right">
<div class="btn-group inline"> <div class="btn-group inline">
<div class="btn-group"> <div class="btn-group">
<a <a
v-if='pipeline.details.manual_actions.length > 0' v-if='pipeline.details.manual_actions.length > 0'
class="dropdown-toggle btn btn-default" class="dropdown-toggle btn btn-default"
data-toggle="dropdown" data-toggle="dropdown"
type="button" type="button"
> title="Manual build"
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 11" class="icon-play"> >
<path <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 11" class="icon-play">
fill-rule="evenodd" <path
d="m9.283 6.47l-7.564 4.254c-.949.534-1.719.266-1.719-.576v-9.292c0-.852.756-1.117 1.719-.576l7.564 4.254c.949.534.963 1.392 0 1.934" fill-rule="evenodd"
> d="m9.283 6.47l-7.564 4.254c-.949.534-1.719.266-1.719-.576v-9.292c0-.852.756-1.117 1.719-.576l7.564 4.254c.949.534.963 1.392 0 1.934"
</path> >
</svg> </path>
<i class="fa fa-caret-down"></i> </svg>
</a> <i class="fa fa-caret-down"></i>
<ul class="dropdown-menu dropdown-menu-align-right"> </a>
<li v-for='action in pipeline.details.manual_actions'> <ul class="dropdown-menu dropdown-menu-align-right">
<a rel="nofollow" data-method="post" :href='action.url' title="Manual build"> <li v-for='action in pipeline.details.manual_actions'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 11" class="icon-play"> <a
<path rel="nofollow"
fill-rule="evenodd" data-method="post"
d="m9.283 6.47l-7.564 4.254c-.949.534-1.719.266-1.719-.576v-9.292c0-.852.756-1.117 1.719-.576l7.564 4.254c.949.534.963 1.392 0 1.934" :href='action.url'
> title="Manual build"
</path> >
</svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 11" class="icon-play">
<span>{{action.name}}</span> <path
</a> fill-rule="evenodd"
</li> d="m9.283 6.47l-7.564 4.254c-.949.534-1.719.266-1.719-.576v-9.292c0-.852.756-1.117 1.719-.576l7.564 4.254c.949.534.963 1.392 0 1.934"
</ul> >
</path>
</svg>
<span>{{action.name}}</span>
</a>
</li>
</ul>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<a <a
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
], ],
computed: { computed: {
user() { user() {
if (!this.pipeline.user) return 'API'; if (!this.pipeline.user === null) return true;
return this.pipeline.user; return false;
}, },
}, },
template: ` template: `
...@@ -21,7 +21,24 @@ ...@@ -21,7 +21,24 @@
<span class="pipeline-id">#{{pipeline.id}}</span> <span class="pipeline-id">#{{pipeline.id}}</span>
</a> </a>
<span>by</span> <span>by</span>
<span class="api monospace">{{user}}</span> <a
v-if='user'
:href='pipeline.user.url'
>
<img
v-if='user'
class="avatar has-tooltip s20 "
:title='pipeline.user.name'
data-container="body"
:src='pipeline.user.avatar_url || pipeline.user.gravatar'
>
</a>
<span
v-if='!user'
class="api monospace"
>
API
</span>
<span <span
v-if='pipeline.flags.latest === true' v-if='pipeline.flags.latest === true'
class="label label-success has-tooltip" class="label label-success has-tooltip"
......
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
], ],
created() { created() {
const url = window.location.toString(); const url = window.location.toString();
if (~url.indexOf('?')) this.pagenum = url.split('?')[1].split('=')[1]; if (~url.indexOf('?') && !~url.indexOf('scope=pipelines')) {
this.pagenum = url.split('?')[1].split('=')[1];
}
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope); this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope);
}, },
methods: { methods: {
......
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
.vue-pipelines-index .vue-pipelines-index
= page_specific_javascript_tag('vue_icons/index.js') = page_specific_javascript_tag('vue_icons/index.js')
-# ^^ this component loads Vue so the rest don't
-# this will no longer be an issue once Vue2 is global
= page_specific_javascript_tag('vue_pagination/index.js') = page_specific_javascript_tag('vue_pagination/index.js')
= page_specific_javascript_tag('vue_pipelines_status/index.js') = page_specific_javascript_tag('vue_pipelines_status/index.js')
= page_specific_javascript_tag('vue_pipelines_index/index.js') = page_specific_javascript_tag('vue_pipelines_index/index.js')
require 'spec_helper' require 'spec_helper'
require 'rails_helper'
describe "Pipelines", feature: true, js: true do describe "Pipelines", feature: true, js: true do
include GitlabRoutingHelper include GitlabRoutingHelper
include WaitForAjax include WaitForVueResource
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -12,22 +13,34 @@ describe "Pipelines", feature: true, js: true do ...@@ -12,22 +13,34 @@ describe "Pipelines", feature: true, js: true do
project.team << [user, :developer] project.team << [user, :developer]
end end
describe 'GET /:project/pipelines' do describe 'GET /:project/pipelines', feature: true, js: true do
include WaitForVueResource
let!(:pipeline) { create(:ci_empty_pipeline, project: project, ref: 'master', status: 'running') } let!(:pipeline) { create(:ci_empty_pipeline, project: project, ref: 'master', status: 'running') }
[:all, :running, :branches].each do |scope| [:pipelines].each do |scope|
context "displaying #{scope}" do context "displaying #{scope}" do
let(:project) { create(:project) } let(:project) { create(:project) }
before { visit namespace_project_pipelines_path(project.namespace, project, scope: scope) } before { visit namespace_project_pipelines_path(project.namespace, project, scope: scope) }
it do it do
wait_for_ajax wait_for_vue_resource
expect(page).to have_content(pipeline.short_sha) expect(page).to have_content(pipeline.short_sha)
end end
end end
end end
[:running, :branches].each do |scope|
context "displaying #{scope}" do
let(:project) { create(:project) }
before { visit namespace_project_pipelines_path(project.namespace, project, scope: scope) }
it { expect(page).to have_content(pipeline.short_sha) }
end
end
context 'anonymous access' do context 'anonymous access' do
before { visit namespace_project_pipelines_path(project.namespace, project) } before { visit namespace_project_pipelines_path(project.namespace, project) }
...@@ -42,14 +55,31 @@ describe "Pipelines", feature: true, js: true do ...@@ -42,14 +55,31 @@ describe "Pipelines", feature: true, js: true do
visit namespace_project_pipelines_path(project.namespace, project) visit namespace_project_pipelines_path(project.namespace, project)
end end
it { expect(page).to have_link('Cancel') } it do
it { expect(page).to have_selector('.ci-running') } wait_for_vue_resource
expect(page).to have_link('Cancel')
end
it do
wait_for_vue_resource
expect(page).to have_selector('.ci-running')
end
context 'when canceling' do context 'when canceling' do
before { click_link('Cancel') } before do
wait_for_vue_resource
click_link('Cancel')
end
it { expect(page).not_to have_link('Cancel') } it do
it { expect(page).to have_selector('.ci-canceled') } wait_for_vue_resource
expect(page).not_to have_link('Cancel')
end
it do
wait_for_vue_resource
expect(page).to have_selector('.ci-canceled')
end
end end
end end
...@@ -77,12 +107,21 @@ describe "Pipelines", feature: true, js: true do ...@@ -77,12 +107,21 @@ describe "Pipelines", feature: true, js: true do
before { visit namespace_project_pipelines_path(project.namespace, project) } before { visit namespace_project_pipelines_path(project.namespace, project) }
it { expect(page).to have_link('Manual build') } it do
wait_for_vue_resource
expect(page).to have_link('Manual build')
end
context 'when playing' do context 'when playing' do
before { click_link('Manual build') } before do
wait_for_vue_resource
click_link('Manual build')
end
it { expect(manual.reload).to be_pending } it do
wait_for_vue_resource
expect(manual.reload).to be_pending
end
end end
end end
...@@ -127,8 +166,15 @@ describe "Pipelines", feature: true, js: true do ...@@ -127,8 +166,15 @@ describe "Pipelines", feature: true, js: true do
before { visit namespace_project_pipelines_path(project.namespace, project) } before { visit namespace_project_pipelines_path(project.namespace, project) }
it { expect(page).to have_selector('.build-artifacts') } it do
it { expect(page).to have_link(with_artifacts.name) } wait_for_vue_resource
expect(page).to have_selector('.build-artifacts')
end
it do
wait_for_vue_resource
expect(page).to have_link(with_artifacts.name)
end
end end
context 'with artifacts expired' do context 'with artifacts expired' do
...@@ -149,7 +195,7 @@ describe "Pipelines", feature: true, js: true do ...@@ -149,7 +195,7 @@ describe "Pipelines", feature: true, js: true do
end end
end end
describe 'GET /:project/pipelines/:id' do describe 'GET /:project/pipelines/:id', feature: true, js: true do
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master') } let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master') }
before do before do
...@@ -207,7 +253,7 @@ describe "Pipelines", feature: true, js: true do ...@@ -207,7 +253,7 @@ describe "Pipelines", feature: true, js: true do
end end
end end
describe 'POST /:project/pipelines' do describe 'POST /:project/pipelines', feature: true, js: true do
let(:project) { create(:project) } let(:project) { create(:project) }
before { visit new_namespace_project_pipeline_path(project.namespace, project) } before { visit new_namespace_project_pipeline_path(project.namespace, project) }
...@@ -238,7 +284,7 @@ describe "Pipelines", feature: true, js: true do ...@@ -238,7 +284,7 @@ describe "Pipelines", feature: true, js: true do
end end
end end
describe 'Create pipelines', feature: true do describe 'Create pipelines', feature: true, js: true do
let(:project) { create(:project) } let(:project) { create(:project) }
before do before do
......
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