BigW Consortium Gitlab

Commit 9f00c2b0 by Filipa Lacerda

Reduce number of pipelines created to test pagination

stub pagination in tests
parent e1af42ce
...@@ -56,7 +56,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s ...@@ -56,7 +56,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
*/ */
change(pagenum, apiScope) { change(pagenum, apiScope) {
if (!apiScope) apiScope = 'all'; if (!apiScope) apiScope = 'all';
gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`); gl.utils.visitUrl(`?scope=${apiScope}&page=${pagenum}`);
}, },
}, },
template: ` template: `
......
...@@ -288,23 +288,22 @@ describe 'Pipelines', :feature, :js do ...@@ -288,23 +288,22 @@ describe 'Pipelines', :feature, :js do
context 'with pagination' do context 'with pagination' do
before do before do
create_list(:ci_empty_pipeline, 40, project: project) allow(Ci::Pipeline).to receive(:default_per_page).and_return(1)
create(:ci_empty_pipeline, project: project)
end end
it 'should render pagination' do it 'should render pagination' do
visit namespace_project_pipelines_path(project.namespace, project) visit namespace_project_pipelines_path(project.namespace, project)
wait_for_vue_resource wait_for_vue_resource
expect(page).to have_css('.gl-pagination') expect(page).to have_selector('.gl-pagination')
expect(page.find_all('tbody tr').length).to eq(20)
end end
it "should render second page of pipelines" do it 'should render second page of pipelines' do
visit namespace_project_pipelines_path(project.namespace, project, page: '2') visit namespace_project_pipelines_path(project.namespace, project, page: '2')
wait_for_vue_resource wait_for_vue_resource
expect(page).to have_css('.gl-pagination') expect(page).to have_selector('.gl-pagination .page', count: 2)
expect(page.find_all('tbody tr').length).to eq(20)
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