Simplify system tests using a small window
This commit is contained in:
@@ -98,6 +98,15 @@ RSpec.configure do |config|
|
|||||||
Delayed::Worker.delay_jobs = false
|
Delayed::Worker.delay_jobs = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.before(:each, :small_window) do
|
||||||
|
@window_size = Capybara.current_window.size
|
||||||
|
Capybara.current_window.resize_to(639, 479)
|
||||||
|
end
|
||||||
|
|
||||||
|
config.after(:each, :small_window) do
|
||||||
|
Capybara.current_window.resize_to(*@window_size)
|
||||||
|
end
|
||||||
|
|
||||||
config.before(:each, :remote_translations) do
|
config.before(:each, :remote_translations) do
|
||||||
allow(RemoteTranslations::Microsoft::AvailableLocales)
|
allow(RemoteTranslations::Microsoft::AvailableLocales)
|
||||||
.to receive(:available_locales).and_return(I18n.available_locales.map(&:to_s))
|
.to receive(:available_locales).and_return(I18n.available_locales.map(&:to_s))
|
||||||
|
|||||||
@@ -103,17 +103,7 @@ describe "Debates" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "On small devices" do
|
context "On small devices", :small_window do
|
||||||
let!(:window_size) { Capybara.current_window.size }
|
|
||||||
|
|
||||||
before do
|
|
||||||
Capybara.current_window.resize_to(639, 479)
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
Capybara.current_window.resize_to(*window_size)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Shows links to share on telegram and whatsapp too" do
|
scenario "Shows links to share on telegram and whatsapp too" do
|
||||||
visit debate_path(create(:debate))
|
visit debate_path(create(:debate))
|
||||||
|
|
||||||
|
|||||||
@@ -148,17 +148,7 @@ describe "Proposals" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "On small devices" do
|
context "On small devices", :small_window do
|
||||||
let!(:window_size) { Capybara.current_window.size }
|
|
||||||
|
|
||||||
before do
|
|
||||||
Capybara.current_window.resize_to(639, 479)
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
Capybara.current_window.resize_to(*window_size)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Shows links to share on telegram and whatsapp too" do
|
scenario "Shows links to share on telegram and whatsapp too" do
|
||||||
visit proposal_path(create(:proposal))
|
visit proposal_path(create(:proposal))
|
||||||
|
|
||||||
@@ -253,17 +243,7 @@ describe "Proposals" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Show sticky support button on mobile screens" do
|
describe "Show sticky support button on small screens", :small_window do
|
||||||
let!(:window_size) { Capybara.current_window.size }
|
|
||||||
|
|
||||||
before do
|
|
||||||
Capybara.current_window.resize_to(640, 480)
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
Capybara.current_window.resize_to(*window_size)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "On a first visit" do
|
scenario "On a first visit" do
|
||||||
proposal = create(:proposal)
|
proposal = create(:proposal)
|
||||||
visit proposal_path(proposal)
|
visit proposal_path(proposal)
|
||||||
|
|||||||
Reference in New Issue
Block a user