Commit 6789befb authored by Filipa Lacerda's avatar Filipa Lacerda

Fixes after review

Fix pipelines tests

Fix rubocop
parent cb9cee54
/* global Element */ /* global Element */
/* eslint-disable consistent-return, max-len */ /* eslint-disable consistent-return, max-len, no-empty, no-plusplus, func-names */
Element.prototype.closest = Element.prototype.closest || function closest(selector, selectedElement = this) { Element.prototype.closest = Element.prototype.closest || function closest(selector, selectedElement = this) {
if (!selectedElement) return; if (!selectedElement) return;
return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement); return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement);
}; };
/* eslint-disable */
/**
* .matches polyfill from mdn
* https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
*
* .matches is used in our code.
* In order to run the tests in Phantomjs we need this polyfill
*/
if (!Element.prototype.matches) { if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.matches =
Element.prototype.matchesSelector || Element.prototype.matchesSelector ||
...@@ -22,8 +14,8 @@ if (!Element.prototype.matches) { ...@@ -22,8 +14,8 @@ if (!Element.prototype.matches) {
Element.prototype.oMatchesSelector || Element.prototype.oMatchesSelector ||
Element.prototype.webkitMatchesSelector || Element.prototype.webkitMatchesSelector ||
function (s) { function (s) {
var matches = (this.document || this.ownerDocument).querySelectorAll(s), const matches = (this.document || this.ownerDocument).querySelectorAll(s);
i = matches.length; let i = matches.length;
while (--i >= 0 && matches.item(i) !== this) {} while (--i >= 0 && matches.item(i) !== this) {}
return i > -1; return i > -1;
}; };
......
...@@ -25,16 +25,13 @@ describe "Pipelines", feature: true, js: true do ...@@ -25,16 +25,13 @@ describe "Pipelines", feature: true, js: true do
before { visit namespace_project_pipeline_path(project.namespace, project, pipeline) } before { visit namespace_project_pipeline_path(project.namespace, project, pipeline) }
it 'shows a list of builds' do it 'shows the pipeline graph' do
expect(page).to have_selector('.pipeline-visualization')
expect(page).to have_content('Build')
expect(page).to have_content('Test') expect(page).to have_content('Test')
expect(page).to have_content(@success.id)
expect(page).to have_content('Deploy') expect(page).to have_content('Deploy')
expect(page).to have_content(@failed.id)
expect(page).to have_content(@running.id)
expect(page).to have_content(@external.id)
expect(page).to have_content('Retry failed') expect(page).to have_content('Retry failed')
expect(page).to have_content('Cancel running') expect(page).to have_content('Cancel running')
expect(page).to have_link('Play')
end end
it 'shows Pipeline tab pane as active' do it 'shows Pipeline tab pane as active' do
...@@ -63,7 +60,6 @@ describe "Pipelines", feature: true, js: true do ...@@ -63,7 +60,6 @@ describe "Pipelines", feature: true, js: true do
before { click_on 'Retry failed' } before { click_on 'Retry failed' }
it { expect(page).not_to have_content('Retry failed') } it { expect(page).not_to have_content('Retry failed') }
it { expect(page).to have_selector('.retried') }
end end
end end
...@@ -74,19 +70,8 @@ describe "Pipelines", feature: true, js: true do ...@@ -74,19 +70,8 @@ describe "Pipelines", feature: true, js: true do
before { click_on 'Cancel running' } before { click_on 'Cancel running' }
it { expect(page).not_to have_content('Cancel running') } it { expect(page).not_to have_content('Cancel running') }
it { expect(page).to have_selector('.ci-canceled') }
end end
end end
context 'playing manual build' do
before do
within '.pipeline-holder' do
click_link('Play')
end
end
it { expect(@manual.reload).to be_pending }
end
end end
describe 'GET /:project/pipelines/:id/builds' do describe 'GET /:project/pipelines/:id/builds' do
...@@ -166,5 +151,4 @@ describe "Pipelines", feature: true, js: true do ...@@ -166,5 +151,4 @@ describe "Pipelines", feature: true, js: true do
it { expect(@manual.reload).to be_pending } it { expect(@manual.reload).to be_pending }
end end
end 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