Commit b98fbe8c authored by Florie Guibert's avatar Florie Guibert

Rspec wait_for_requests helper waits for graphQL requests

Review feedback
parent c9931302
......@@ -23,15 +23,11 @@ RSpec.describe 'epics swimlanes sidebar', :js do
visit project_boards_path(project)
wait_for_requests
page.within('.board-swimlanes-toggle-wrapper') do
page.find('.dropdown-toggle').click
page.find('.dropdown-item', text: 'Epic').click
end
end
context 'notifications subscription' do
it 'displays notifications toggle' do
load_epic_boards
click_first_issue_card
page.within('[data-testid="sidebar-notifications"]') do
......@@ -42,6 +38,7 @@ RSpec.describe 'epics swimlanes sidebar', :js do
end
it 'shows toggle as on then as off as user toggles to subscribe and unsubscribe' do
load_epic_boards
click_first_issue_card
toggle = find('[data-testid="notification-subscribe-toggle"]')
......@@ -58,6 +55,8 @@ RSpec.describe 'epics swimlanes sidebar', :js do
context 'when notifications have been disabled' do
before do
project.update_attribute(:emails_disabled, true)
load_epic_boards
end
it 'displays a message that notifications have been disabled' do
......@@ -73,6 +72,7 @@ RSpec.describe 'epics swimlanes sidebar', :js do
context 'time tracking' do
it 'displays time tracking feature with default message' do
load_epic_boards
click_first_issue_card
page.within('[data-testid="time-tracker"]') do
......@@ -85,6 +85,8 @@ RSpec.describe 'epics swimlanes sidebar', :js do
before do
issue1.timelogs.create!(time_spent: 3600, user: user)
load_epic_boards
click_first_issue_card
end
......@@ -100,6 +102,8 @@ RSpec.describe 'epics swimlanes sidebar', :js do
before do
issue1.update!(time_estimate: 3600)
load_epic_boards
click_first_issue_card
end
......@@ -116,6 +120,8 @@ RSpec.describe 'epics swimlanes sidebar', :js do
issue1.update!(time_estimate: 3600)
issue1.timelogs.create!(time_spent: 1800, user: user)
load_epic_boards
click_first_issue_card
end
......@@ -140,6 +146,8 @@ RSpec.describe 'epics swimlanes sidebar', :js do
# 3600+3600*24 = 1d 1h or 25h
issue1.timelogs.create!(time_spent: 3600 + 3600 * 24, user: user)
load_epic_boards
click_first_issue_card
end
......@@ -156,4 +164,13 @@ RSpec.describe 'epics swimlanes sidebar', :js do
first("[data-testid='board_card']").click
end
end
def load_epic_boards
page.within('.board-swimlanes-toggle-wrapper') do
page.find('.dropdown-toggle').click
page.find('.dropdown-item', text: 'Epic').click
end
wait_for_all_requests
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