Skip to content
Snippets Groups Projects
Commit 19b8437b authored by Phil Hughes's avatar Phil Hughes
Browse files

Tests updated

parent 7a68262d
No related branches found
No related tags found
No related merge requests found
Loading
@@ -50,7 +50,7 @@ class List {
Loading
@@ -50,7 +50,7 @@ class List {
} }
   
update () { update () {
gl.boardService.updateList(this); gl.boardService.updateList(this.id, this.position);
} }
   
nextPage () { nextPage () {
Loading
Loading
Loading
@@ -2,14 +2,14 @@ class BoardService {
Loading
@@ -2,14 +2,14 @@ class BoardService {
constructor (root) { constructor (root) {
Vue.http.options.root = root; Vue.http.options.root = root;
   
this.lists = Vue.resource(`${root}/lists{/id}.json`, {}, { this.lists = Vue.resource(`${root}/lists{/id}`, {}, {
generate: { generate: {
method: 'POST', method: 'POST',
url: `${root}/lists/generate.json` url: `${root}/lists/generate.json`
} }
}); });
this.issue = Vue.resource(`${root}/issues{/id}.json`, {}); this.issue = Vue.resource(`${root}/issues{/id}`, {});
this.issues = Vue.resource(`${root}/lists{/id}/issues.json`, {}); this.issues = Vue.resource(`${root}/lists{/id}/issues`, {});
} }
   
setCSRF () { setCSRF () {
Loading
@@ -37,12 +37,12 @@ class BoardService {
Loading
@@ -37,12 +37,12 @@ class BoardService {
}); });
} }
   
updateList (list) { updateList (id, position) {
this.setCSRF(); this.setCSRF();
   
return this.lists.update({ id: list.id }, { return this.lists.update({ id }, {
list: { list: {
position: list.position position
} }
}); });
} }
Loading
Loading
Loading
@@ -17,15 +17,15 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -17,15 +17,15 @@ describe 'Issue Boards', feature: true, js: true do
context 'no lists' do context 'no lists' do
before do before do
visit namespace_project_board_path(project.namespace, project) visit namespace_project_board_path(project.namespace, project)
wait_for_vue_resource
expect(page).to have_selector('.board', count: 3)
end end
   
it 'shows blank state' do it 'shows blank state' do
expect(page).to have_selector('.board', count: 3)
expect(page).to have_content('Welcome to your Issue Board!') expect(page).to have_content('Welcome to your Issue Board!')
end end
   
it 'hides the blank state when clicking nevermind button' do it 'hides the blank state when clicking nevermind button' do
expect(page).to have_selector('.board', count: 3)
page.within(find('.board-blank-state')) do page.within(find('.board-blank-state')) do
click_button("Nevermind, I'll use my own") click_button("Nevermind, I'll use my own")
end end
Loading
@@ -33,8 +33,6 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -33,8 +33,6 @@ describe 'Issue Boards', feature: true, js: true do
end end
   
it 'creates default lists' do it 'creates default lists' do
expect(page).to have_selector('.board', count: 3)
lists = ['Backlog', 'Development', 'Testing', 'Production', 'Ready', 'Done'] lists = ['Backlog', 'Development', 'Testing', 'Production', 'Ready', 'Done']
   
page.within(find('.board-blank-state')) do page.within(find('.board-blank-state')) do
Loading
@@ -78,10 +76,12 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -78,10 +76,12 @@ describe 'Issue Boards', feature: true, js: true do
visit namespace_project_board_path(project.namespace, project) visit namespace_project_board_path(project.namespace, project)
   
wait_for_vue_resource wait_for_vue_resource
expect(page).to have_selector('.board', count: 4)
has_issues
end end
   
it 'shows lists' do it 'shows lists' do
wait_for_vue_resource
expect(page).to have_selector('.board', count: 4) expect(page).to have_selector('.board', count: 4)
end end
   
Loading
@@ -169,14 +169,11 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -169,14 +169,11 @@ describe 'Issue Boards', feature: true, js: true do
   
find('.board-search-clear-btn').click find('.board-search-clear-btn').click
   
wait_for_vue_resource
expect(page).to have_selector('.card', count: 6) expect(page).to have_selector('.card', count: 6)
end end
end end
   
it 'moves issue from backlog into list' do it 'moves issue from backlog into list' do
has_issues
drag_to(list_to_index: 1) drag_to(list_to_index: 1)
   
page.within(find('.board', match: :first)) do page.within(find('.board', match: :first)) do
Loading
@@ -197,7 +194,6 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -197,7 +194,6 @@ describe 'Issue Boards', feature: true, js: true do
end end
   
it 'moves issue to done' do it 'moves issue to done' do
has_issues
drag_to(list_from_index: 0, list_to_index: 3) drag_to(list_from_index: 0, list_to_index: 3)
   
expect(find('.board:nth-child(4)')).to have_selector('.card', count: 2) expect(find('.board:nth-child(4)')).to have_selector('.card', count: 2)
Loading
@@ -206,7 +202,6 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -206,7 +202,6 @@ describe 'Issue Boards', feature: true, js: true do
end end
   
it 'removes all of the same issue to done' do it 'removes all of the same issue to done' do
has_issues
drag_to(list_from_index: 1, list_to_index: 3) drag_to(list_from_index: 1, list_to_index: 3)
   
expect(find('.board:nth-child(2)')).to have_selector('.card', count: 1) expect(find('.board:nth-child(2)')).to have_selector('.card', count: 1)
Loading
@@ -218,16 +213,13 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -218,16 +213,13 @@ describe 'Issue Boards', feature: true, js: true do
   
context 'lists' do context 'lists' do
it 'changes position of list' do it 'changes position of list' do
expect(page).to have_selector('.board', count: 4) drag_to(list_from_index: 1, list_to_index: 2, selector: '.board-header')
has_issues
drag_to(list_from_index: 1, list_to_index: 2, selector: '.js-board-handle')
   
expect(find('.board:nth-child(2)')).to have_content(development.title) expect(find('.board:nth-child(2)')).to have_content(development.title)
expect(find('.board:nth-child(2)')).to have_content(planning.title) expect(find('.board:nth-child(2)')).to have_content(planning.title)
end end
   
it 'issue moves between lists' do it 'issue moves between lists' do
has_issues
drag_to(list_from_index: 1, card_index: 1, list_to_index: 2) drag_to(list_from_index: 1, card_index: 1, list_to_index: 2)
   
expect(find('.board:nth-child(2)')).to have_selector('.card', count: 1) expect(find('.board:nth-child(2)')).to have_selector('.card', count: 1)
Loading
@@ -237,7 +229,6 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -237,7 +229,6 @@ describe 'Issue Boards', feature: true, js: true do
end end
   
it 'issue moves between lists' do it 'issue moves between lists' do
has_issues
drag_to(list_from_index: 2, list_to_index: 1) drag_to(list_from_index: 2, list_to_index: 1)
   
expect(find('.board:nth-child(2)')).to have_selector('.card', count: 3) expect(find('.board:nth-child(2)')).to have_selector('.card', count: 3)
Loading
@@ -247,7 +238,6 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -247,7 +238,6 @@ describe 'Issue Boards', feature: true, js: true do
end end
   
it 'issue moves from done' do it 'issue moves from done' do
has_issues
drag_to(list_from_index: 3, list_to_index: 1) drag_to(list_from_index: 3, list_to_index: 1)
   
expect(find('.board:nth-child(2)')).to have_selector('.card', count: 3) expect(find('.board:nth-child(2)')).to have_selector('.card', count: 3)
Loading
@@ -441,8 +431,6 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -441,8 +431,6 @@ describe 'Issue Boards', feature: true, js: true do
   
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight") evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")
   
wait_for_vue_resource
expect(page.find('.board-header')).to have_content('40') expect(page.find('.board-header')).to have_content('40')
expect(page).to have_selector('.card', count: 40) expect(page).to have_selector('.card', count: 40)
end end
Loading
@@ -565,5 +553,6 @@ describe 'Issue Boards', feature: true, js: true do
Loading
@@ -565,5 +553,6 @@ describe 'Issue Boards', feature: true, js: true do
Timeout.timeout(Capybara.default_max_wait_time) do Timeout.timeout(Capybara.default_max_wait_time) do
loop until page.evaluate_script('Vue.activeResources').zero? loop until page.evaluate_script('Vue.activeResources').zero?
end end
expect(find('.boards-list')).not_to have_selector('.fa-spinner')
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment