boards_spec.rb 18.8 KB
Newer Older
P
Phil Hughes 已提交
1 2 3
require 'rails_helper'

describe 'Issue Boards', feature: true, js: true do
4
  include WaitForAjax
P
Phil Hughes 已提交
5
  include WaitForVueResource
6

7
  let(:project) { create(:project_with_board, :public) }
8 9
  let(:user)    { create(:user) }
  let!(:user2)  { create(:user) }
P
Phil Hughes 已提交
10 11 12

  before do
    project.team << [user, :master]
P
Phil Hughes 已提交
13
    project.team << [user2, :master]
14

P
Phil Hughes 已提交
15 16 17
    login_as(user)
  end

P
Phil Hughes 已提交
18 19 20
  context 'no lists' do
    before do
      visit namespace_project_board_path(project.namespace, project)
P
Phil Hughes 已提交
21 22
      wait_for_vue_resource
      expect(page).to have_selector('.board', count: 3)
P
Phil Hughes 已提交
23
    end
P
Phil Hughes 已提交
24

P
Phil Hughes 已提交
25 26
    it 'shows blank state' do
      expect(page).to have_content('Welcome to your Issue Board!')
P
Phil Hughes 已提交
27 28
    end

29
    it 'hides the blank state when clicking nevermind button' do
P
Phil Hughes 已提交
30
      page.within(find('.board-blank-state')) do
P
Phil Hughes 已提交
31
        click_button("Nevermind, I'll use my own")
P
Phil Hughes 已提交
32 33
      end
      expect(page).to have_selector('.board', count: 2)
P
Phil Hughes 已提交
34 35
    end

P
Phil Hughes 已提交
36 37
    it 'creates default lists' do
      lists = ['Backlog', 'Development', 'Testing', 'Production', 'Ready', 'Done']
P
Phil Hughes 已提交
38

P
Phil Hughes 已提交
39
      page.within(find('.board-blank-state')) do
P
Phil Hughes 已提交
40 41
        click_button('Add default lists')
      end
P
Phil Hughes 已提交
42 43
      wait_for_vue_resource

P
Phil Hughes 已提交
44 45 46 47 48 49
      expect(page).to have_selector('.board', count: 6)

      page.all('.board').each_with_index do |list, i|
        expect(list.find('.board-title')).to have_content(lists[i])
      end
    end
P
Phil Hughes 已提交
50 51
  end

P
Phil Hughes 已提交
52
  context 'with lists' do
53
    let(:milestone) { create(:milestone, project: project) }
P
Phil Hughes 已提交
54

P
Phil Hughes 已提交
55 56 57
    let(:planning)    { create(:label, project: project, name: 'Planning') }
    let(:development) { create(:label, project: project, name: 'Development') }
    let(:testing)     { create(:label, project: project, name: 'Testing') }
P
Phil Hughes 已提交
58
    let(:bug)         { create(:label, project: project, name: 'Bug') }
59 60
    let!(:backlog)    { create(:label, project: project, name: 'Backlog') }
    let!(:done)       { create(:label, project: project, name: 'Done') }
P
Phil Hughes 已提交
61 62 63 64

    let!(:list1) { create(:list, board: project.board, label: planning, position: 0) }
    let!(:list2) { create(:list, board: project.board, label: development, position: 1) }

65 66 67 68 69
    let!(:confidential_issue) { create(:issue, :confidential, project: project, author: user) }
    let!(:issue1) { create(:issue, project: project, assignee: user) }
    let!(:issue2) { create(:issue, project: project, author: user2) }
    let!(:issue3) { create(:issue, project: project) }
    let!(:issue4) { create(:issue, project: project) }
P
Phil Hughes 已提交
70
    let!(:issue5) { create(:labeled_issue, project: project, labels: [planning], milestone: milestone) }
71 72
    let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development]) }
    let!(:issue7) { create(:labeled_issue, project: project, labels: [development]) }
73
    let!(:issue8) { create(:closed_issue, project: project) }
74
    let!(:issue9) { create(:labeled_issue, project: project, labels: [testing, bug]) }
P
Phil Hughes 已提交
75 76 77 78

    before do
      visit namespace_project_board_path(project.namespace, project)

P
Phil Hughes 已提交
79
      wait_for_vue_resource
P
Phil Hughes 已提交
80 81

      expect(page).to have_selector('.board', count: 4)
82 83 84 85
      expect(find('.board:nth-child(1)')).to have_selector('.card')
      expect(find('.board:nth-child(2)')).to have_selector('.card')
      expect(find('.board:nth-child(3)')).to have_selector('.card')
      expect(find('.board:nth-child(4)')).to have_selector('.card')
P
Phil Hughes 已提交
86 87 88 89 90 91 92
    end

    it 'shows lists' do
      expect(page).to have_selector('.board', count: 4)
    end

    it 'shows issues in lists' do
93 94
      wait_for_board_cards(2, 2)
      wait_for_board_cards(3, 2)
P
Phil Hughes 已提交
95
    end
P
Phil Hughes 已提交
96

P
Phil Hughes 已提交
97
    it 'shows confidential issues with icon' do
P
Phil Hughes 已提交
98
      page.within(find('.board', match: :first)) do
P
Phil Hughes 已提交
99 100 101 102
        expect(page).to have_selector('.confidential-icon', count: 1)
      end
    end

103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
    it 'search backlog list' do
      page.within('#js-boards-seach') do
        find('.form-control').set(issue1.title)
      end

      wait_for_vue_resource

      expect(find('.board:nth-child(1)')).to have_selector('.card', count: 1)
      expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0)
      expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0)
      expect(find('.board:nth-child(4)')).to have_selector('.card', count: 0)
    end

    it 'search done list' do
      page.within('#js-boards-seach') do
        find('.form-control').set(issue8.title)
      end

      wait_for_vue_resource

      expect(find('.board:nth-child(1)')).to have_selector('.card', count: 0)
      expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0)
      expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0)
      expect(find('.board:nth-child(4)')).to have_selector('.card', count: 1)
    end

    it 'search list' do
      page.within('#js-boards-seach') do
        find('.form-control').set(issue5.title)
      end

      wait_for_vue_resource

      expect(find('.board:nth-child(1)')).to have_selector('.card', count: 0)
      expect(find('.board:nth-child(2)')).to have_selector('.card', count: 1)
      expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0)
      expect(find('.board:nth-child(4)')).to have_selector('.card', count: 0)
    end

P
Phil Hughes 已提交
142
    it 'allows user to delete board' do
P
Phil Hughes 已提交
143
      page.within(find('.board:nth-child(2)')) do
P
Phil Hughes 已提交
144
        find('.board-delete').click
P
Phil Hughes 已提交
145
      end
P
Phil Hughes 已提交
146 147 148

      wait_for_vue_resource

P
Phil Hughes 已提交
149
      expect(page).to have_selector('.board', count: 3)
P
Phil Hughes 已提交
150 151
    end

152 153 154 155
    it 'removes checkmark in new list dropdown after deleting' do
      click_button 'Create new list'
      wait_for_ajax

P
Phil Hughes 已提交
156
      page.within(find('.board:nth-child(2)')) do
157 158
        find('.board-delete').click
      end
159

P
Phil Hughes 已提交
160
      wait_for_vue_resource
161

162
      expect(page).to have_selector('.board', count: 3)
163 164 165
      expect(find(".js-board-list-#{planning.id}", visible: false)).not_to have_css('.is-active')
    end

166 167
    it 'infinite scrolls list' do
      50.times do
168
        create(:issue, project: project)
169 170 171
      end

      visit namespace_project_board_path(project.namespace, project)
P
Phil Hughes 已提交
172
      wait_for_vue_resource
173

P
Phil Hughes 已提交
174
      page.within(find('.board', match: :first)) do
175
        expect(page.find('.board-header')).to have_content('56')
176
        expect(page).to have_selector('.card', count: 20)
P
Phil Hughes 已提交
177
        expect(page).to have_content('Showing 20 of 56 issues')
178 179

        evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")
P
Phil Hughes 已提交
180
        wait_for_vue_resource
181 182

        expect(page).to have_selector('.card', count: 40)
P
Phil Hughes 已提交
183 184 185
        expect(page).to have_content('Showing 40 of 56 issues')

        evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")
P
Phil Hughes 已提交
186
        wait_for_vue_resource
P
Phil Hughes 已提交
187 188 189

        expect(page).to have_selector('.card', count: 56)
        expect(page).to have_content('Showing all issues')
190 191 192
      end
    end

P
Phil Hughes 已提交
193 194
    context 'backlog' do
      it 'shows issues in backlog with no labels' do
195
        wait_for_board_cards(1, 6)
P
Phil Hughes 已提交
196 197 198 199
      end

      it 'moves issue from backlog into list' do
        drag_to(list_to_index: 1)
P
Phil Hughes 已提交
200

201
        wait_for_vue_resource
202 203
        wait_for_board_cards(1, 5)
        wait_for_board_cards(2, 3)
P
Phil Hughes 已提交
204 205 206
      end
    end

P
Phil Hughes 已提交
207 208
    context 'done' do
      it 'shows list of done issues' do
209 210
        wait_for_board_cards(4, 1)
        wait_for_ajax
P
Phil Hughes 已提交
211 212 213 214 215
      end

      it 'moves issue to done' do
        drag_to(list_from_index: 0, list_to_index: 3)

216 217 218 219 220 221
        wait_for_board_cards(1, 5)
        wait_for_board_cards(2, 2)
        wait_for_board_cards(3, 2)
        wait_for_board_cards(4, 2)

        expect(find('.board:nth-child(1)')).not_to have_content(issue9.title)
P
Phil Hughes 已提交
222 223 224
        expect(find('.board:nth-child(4)')).to have_selector('.card', count: 2)
        expect(find('.board:nth-child(4)')).to have_content(issue9.title)
        expect(find('.board:nth-child(4)')).not_to have_content(planning.title)
P
Phil Hughes 已提交
225 226 227 228 229
      end

      it 'removes all of the same issue to done' do
        drag_to(list_from_index: 1, list_to_index: 3)

230 231 232 233 234 235
        wait_for_board_cards(1, 6)
        wait_for_board_cards(2, 1)
        wait_for_board_cards(3, 1)
        wait_for_board_cards(4, 2)

        expect(find('.board:nth-child(2)')).not_to have_content(issue6.title)
P
Phil Hughes 已提交
236 237
        expect(find('.board:nth-child(4)')).to have_content(issue6.title)
        expect(find('.board:nth-child(4)')).not_to have_content(planning.title)
P
Phil Hughes 已提交
238 239 240 241
      end
    end

    context 'lists' do
P
Phil Hughes 已提交
242
      it 'changes position of list' do
P
Phil Hughes 已提交
243
        drag_to(list_from_index: 1, list_to_index: 2, selector: '.board-header')
P
Phil Hughes 已提交
244

245 246 247 248 249
        wait_for_board_cards(1, 6)
        wait_for_board_cards(2, 2)
        wait_for_board_cards(3, 2)
        wait_for_board_cards(4, 1)

P
Phil Hughes 已提交
250 251
        expect(find('.board:nth-child(2)')).to have_content(development.title)
        expect(find('.board:nth-child(2)')).to have_content(planning.title)
P
Phil Hughes 已提交
252 253
      end

P
Phil Hughes 已提交
254
      it 'issue moves between lists' do
255
        drag_to(list_from_index: 1, card_index: 1, list_to_index: 2)
P
Phil Hughes 已提交
256

257 258 259 260 261
        wait_for_board_cards(1, 6)
        wait_for_board_cards(2, 1)
        wait_for_board_cards(3, 3)
        wait_for_board_cards(4, 1)

P
Phil Hughes 已提交
262 263
        expect(find('.board:nth-child(3)')).to have_content(issue6.title)
        expect(find('.board:nth-child(3)').all('.card').last).not_to have_content(development.title)
P
Phil Hughes 已提交
264 265
      end

P
Phil Hughes 已提交
266
      it 'issue moves between lists' do
P
Phil Hughes 已提交
267 268
        drag_to(list_from_index: 2, list_to_index: 1)

269 270 271 272 273
        wait_for_board_cards(1, 6)
        wait_for_board_cards(2, 3)
        wait_for_board_cards(3, 1)
        wait_for_board_cards(4, 1)

P
Phil Hughes 已提交
274 275
        expect(find('.board:nth-child(2)')).to have_content(issue7.title)
        expect(find('.board:nth-child(2)').all('.card').first).not_to have_content(planning.title)
P
Phil Hughes 已提交
276 277
      end

P
Phil Hughes 已提交
278
      it 'issue moves from done' do
P
Phil Hughes 已提交
279 280
        drag_to(list_from_index: 3, list_to_index: 1)

P
Phil Hughes 已提交
281
        expect(find('.board:nth-child(2)')).to have_content(issue8.title)
282 283 284 285 286

        wait_for_board_cards(1, 6)
        wait_for_board_cards(2, 3)
        wait_for_board_cards(3, 2)
        wait_for_board_cards(4, 0)
P
Phil Hughes 已提交
287 288 289 290
      end

      context 'issue card' do
        it 'shows assignee' do
P
Phil Hughes 已提交
291
          page.within(find('.board', match: :first)) do
P
Phil Hughes 已提交
292
            expect(page).to have_selector('.avatar', count: 1)
P
Phil Hughes 已提交
293 294 295 296 297 298 299
          end
        end
      end

      context 'new list' do
        it 'shows all labels in new list dropdown' do
          click_button 'Create new list'
300
          wait_for_ajax
P
Phil Hughes 已提交
301 302 303 304 305 306 307 308 309 310

          page.within('.dropdown-menu-issues-board-new') do
            expect(page).to have_content(planning.title)
            expect(page).to have_content(development.title)
            expect(page).to have_content(testing.title)
          end
        end

        it 'creates new list for label' do
          click_button 'Create new list'
311
          wait_for_ajax
P
Phil Hughes 已提交
312 313 314 315 316

          page.within('.dropdown-menu-issues-board-new') do
            click_link testing.title
          end

317 318
          wait_for_vue_resource

P
Phil Hughes 已提交
319 320 321
          expect(page).to have_selector('.board', count: 5)
        end

322 323
        it 'creates new list for Backlog label' do
          click_button 'Create new list'
324
          wait_for_ajax
325 326 327 328 329

          page.within('.dropdown-menu-issues-board-new') do
            click_link backlog.title
          end

330 331
          wait_for_vue_resource

332 333 334 335 336
          expect(page).to have_selector('.board', count: 5)
        end

        it 'creates new list for Done label' do
          click_button 'Create new list'
337
          wait_for_ajax
338 339 340 341 342

          page.within('.dropdown-menu-issues-board-new') do
            click_link done.title
          end

343 344
          wait_for_vue_resource

345 346 347
          expect(page).to have_selector('.board', count: 5)
        end

P
Phil Hughes 已提交
348
        it 'moves issues from backlog into new list' do
349
          wait_for_board_cards(1, 6)
P
Phil Hughes 已提交
350 351

          click_button 'Create new list'
352
          wait_for_ajax
P
Phil Hughes 已提交
353 354 355 356 357

          page.within('.dropdown-menu-issues-board-new') do
            click_link testing.title
          end

358 359
          wait_for_vue_resource

360
          wait_for_board_cards(1, 5)
P
Phil Hughes 已提交
361 362 363 364 365
        end
      end
    end

    context 'filtering' do
P
Phil Hughes 已提交
366 367 368
      it 'filters by author' do
        page.within '.issues-filters' do
          click_button('Author')
369
          wait_for_ajax
P
Phil Hughes 已提交
370 371 372 373

          page.within '.dropdown-menu-author' do
            click_link(user2.name)
          end
P
Phil Hughes 已提交
374
          wait_for_vue_resource
P
Phil Hughes 已提交
375 376 377 378

          expect(find('.js-author-search')).to have_content(user2.name)
        end

P
Phil Hughes 已提交
379
        wait_for_vue_resource
380 381
        wait_for_board_cards(1, 1)
        wait_for_empty_boards((2..4))
P
Phil Hughes 已提交
382 383 384 385 386
      end

      it 'filters by assignee' do
        page.within '.issues-filters' do
          click_button('Assignee')
387
          wait_for_ajax
P
Phil Hughes 已提交
388 389 390 391

          page.within '.dropdown-menu-assignee' do
            click_link(user.name)
          end
P
Phil Hughes 已提交
392
          wait_for_vue_resource
P
Phil Hughes 已提交
393 394 395 396

          expect(find('.js-assignee-search')).to have_content(user.name)
        end

P
Phil Hughes 已提交
397 398
        wait_for_vue_resource

399 400
        wait_for_board_cards(1, 1)
        wait_for_empty_boards((2..4))
P
Phil Hughes 已提交
401 402 403 404
      end

      it 'filters by milestone' do
        page.within '.issues-filters' do
405
          click_button('Milestone')
406
          wait_for_ajax
P
Phil Hughes 已提交
407 408 409 410

          page.within '.milestone-filter' do
            click_link(milestone.title)
          end
P
Phil Hughes 已提交
411
          wait_for_vue_resource
P
Phil Hughes 已提交
412 413 414 415

          expect(find('.js-milestone-select')).to have_content(milestone.title)
        end

P
Phil Hughes 已提交
416
        wait_for_vue_resource
417 418 419 420
        wait_for_board_cards(1, 0)
        wait_for_board_cards(2, 1)
        wait_for_board_cards(3, 0)
        wait_for_board_cards(4, 0)
P
Phil Hughes 已提交
421 422 423 424 425
      end

      it 'filters by label' do
        page.within '.issues-filters' do
          click_button('Label')
426
          wait_for_ajax
P
Phil Hughes 已提交
427 428 429

          page.within '.dropdown-menu-labels' do
            click_link(testing.title)
P
Phil Hughes 已提交
430
            wait_for_vue_resource
P
Phil Hughes 已提交
431 432 433 434
            find('.dropdown-menu-close').click
          end
        end

P
Phil Hughes 已提交
435
        wait_for_vue_resource
436 437
        wait_for_board_cards(1, 1)
        wait_for_empty_boards((2..4))
P
Phil Hughes 已提交
438 439
      end

440 441
      it 'infinite scrolls list with label filter' do
        50.times do
442
          create(:labeled_issue, project: project, labels: [testing])
443 444 445 446
        end

        page.within '.issues-filters' do
          click_button('Label')
447
          wait_for_ajax
448 449 450

          page.within '.dropdown-menu-labels' do
            click_link(testing.title)
P
Phil Hughes 已提交
451
            wait_for_vue_resource
452 453 454 455
            find('.dropdown-menu-close').click
          end
        end

P
Phil Hughes 已提交
456 457
        wait_for_vue_resource

P
Phil Hughes 已提交
458
        page.within(find('.board', match: :first)) do
459
          expect(page.find('.board-header')).to have_content('51')
460
          expect(page).to have_selector('.card', count: 20)
P
Phil Hughes 已提交
461
          expect(page).to have_content('Showing 20 of 51 issues')
462 463 464 465

          evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")

          expect(page).to have_selector('.card', count: 40)
P
Phil Hughes 已提交
466 467 468 469 470 471
          expect(page).to have_content('Showing 40 of 51 issues')

          evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")

          expect(page).to have_selector('.card', count: 51)
          expect(page).to have_content('Showing all issues')
472 473 474
        end
      end

P
Phil Hughes 已提交
475 476 477
      it 'filters by multiple labels' do
        page.within '.issues-filters' do
          click_button('Label')
478
          wait_for_ajax
P
Phil Hughes 已提交
479

480
          page.within(find('.dropdown-menu-labels')) do
P
Phil Hughes 已提交
481
            click_link(testing.title)
P
Phil Hughes 已提交
482
            wait_for_vue_resource
P
Phil Hughes 已提交
483
            click_link(bug.title)
P
Phil Hughes 已提交
484
            wait_for_vue_resource
P
Phil Hughes 已提交
485 486 487 488
            find('.dropdown-menu-close').click
          end
        end

P
Phil Hughes 已提交
489 490
        wait_for_vue_resource

491 492
        wait_for_board_cards(1, 1)
        wait_for_empty_boards((2..4))
P
Phil Hughes 已提交
493 494 495 496 497
      end

      it 'filters by no label' do
        page.within '.issues-filters' do
          click_button('Label')
498
          wait_for_ajax
P
Phil Hughes 已提交
499

P
Phil Hughes 已提交
500 501
          page.within '.dropdown-menu-labels' do
            click_link("No Label")
P
Phil Hughes 已提交
502
            wait_for_vue_resource
P
Phil Hughes 已提交
503 504 505 506
            find('.dropdown-menu-close').click
          end
        end

P
Phil Hughes 已提交
507 508
        wait_for_vue_resource

509 510 511 512
        wait_for_board_cards(1, 5)
        wait_for_board_cards(2, 0)
        wait_for_board_cards(3, 0)
        wait_for_board_cards(4, 1)
P
Phil Hughes 已提交
513
      end
514 515

      it 'filters by clicking label button on issue' do
P
Phil Hughes 已提交
516 517
        page.within(find('.board', match: :first)) do
          expect(page).to have_selector('.card', count: 6)
518
          expect(find('.card', match: :first)).to have_content(bug.title)
P
Phil Hughes 已提交
519
          click_button(bug.title)
P
Phil Hughes 已提交
520
          wait_for_vue_resource
521 522
        end

523 524
        wait_for_vue_resource

525 526
        wait_for_board_cards(1, 1)
        wait_for_empty_boards((2..4))
527 528

        page.within('.labels-filter') do
P
Phil Hughes 已提交
529
          expect(find('.dropdown-toggle-text')).to have_content(bug.title)
530 531 532 533
        end
      end

      it 'removes label filter by clicking label button on issue' do
P
Phil Hughes 已提交
534 535
        page.within(find('.board', match: :first)) do
          page.within(find('.card', match: :first)) do
536 537
            click_button(bug.title)
          end
P
Phil Hughes 已提交
538
          wait_for_vue_resource
539 540 541 542

          expect(page).to have_selector('.card', count: 1)
        end

P
Phil Hughes 已提交
543 544
        wait_for_vue_resource

545 546 547 548
        page.within('.labels-filter') do
          expect(find('.dropdown-toggle-text')).to have_content(bug.title)
        end
      end
P
Phil Hughes 已提交
549 550 551
    end
  end

552 553 554 555 556 557 558 559 560 561 562 563
  context 'keyboard shortcuts' do
    before do
      visit namespace_project_board_path(project.namespace, project)
      wait_for_vue_resource
    end

    it 'allows user to use keyboard shortcuts' do
      find('.boards-list').native.send_keys('i')
      expect(page).to have_content('New Issue')
    end
  end

564 565 566 567
  context 'signed out user' do
    before do
      logout
      visit namespace_project_board_path(project.namespace, project)
568
      wait_for_vue_resource
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583
    end

    it 'does not show create new list' do
      expect(page).not_to have_selector('.js-new-board-list')
    end
  end

  context 'as guest user' do
    let(:user_guest) { create(:user) }

    before do
      project.team << [user_guest, :guest]
      logout
      login_as(user_guest)
      visit namespace_project_board_path(project.namespace, project)
584
      wait_for_vue_resource
585 586 587 588 589 590 591
    end

    it 'does not show create new list' do
      expect(page).not_to have_selector('.js-new-board-list')
    end
  end

P
Phil Hughes 已提交
592 593
  def drag_to(list_from_index: 0, card_index: 0, to_index: 0, list_to_index: 0, selector: '.board-list')
    evaluate_script("simulateDrag({scrollable: document.getElementById('board-app'), from: {el: $('#{selector}').eq(#{list_from_index}).get(0), index: #{card_index}}, to: {el: $('.board-list').eq(#{list_to_index}).get(0), index: #{to_index}}});")
594 595 596 597 598 599

    Timeout.timeout(Capybara.default_max_wait_time) do
      loop until page.evaluate_script('window.SIMULATE_DRAG_ACTIVE').zero?
    end

    wait_for_vue_resource
P
Phil Hughes 已提交
600
  end
601 602 603 604 605 606 607 608 609 610 611 612 613

  def wait_for_board_cards(board_number, expected_cards)
    page.within(find(".board:nth-child(#{board_number})")) do
      expect(page.find('.board-header')).to have_content(expected_cards.to_s)
      expect(page).to have_selector('.card', count: expected_cards)
    end
  end

  def wait_for_empty_boards(board_numbers)
    board_numbers.each do |board|
      wait_for_board_cards(board, 0)
    end
  end
P
Phil Hughes 已提交
614
end