From 5c9bd269be3475132577c76667a984cbc11739ae Mon Sep 17 00:00:00 2001 From: Daria Mayorova Date: Tue, 15 Oct 2024 14:49:43 +0200 Subject: [PATCH] Resize browser width with a hook --- features/provider/dashboard.feature | 2 +- features/step_definitions/window_steps.rb | 6 ------ features/support/hooks.rb | 9 +++++++++ 3 files changed, 10 insertions(+), 7 deletions(-) delete mode 100644 features/step_definitions/window_steps.rb diff --git a/features/provider/dashboard.feature b/features/provider/dashboard.feature index 939acdc7a6..5915263038 100644 --- a/features/provider/dashboard.feature +++ b/features/provider/dashboard.feature @@ -25,7 +25,7 @@ Feature: Dashboard And they follow "Quick starts" Then the current page is the quick start catalog page + @narrow-screen Scenario: Quick start button is not displayed on narrow screens When they go to the dashboard - And they set the screen width to "1190" pixels Then they should not see "Quick starts" diff --git a/features/step_definitions/window_steps.rb b/features/step_definitions/window_steps.rb deleted file mode 100644 index e28b3e2e5f..0000000000 --- a/features/step_definitions/window_steps.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -And "(they )set the screen width to {string} pixels" do |width| - height = page.driver.browser.manage.window.size.height - page.driver.browser.manage.window.resize_to(width.to_i, height) -end diff --git a/features/support/hooks.rb b/features/support/hooks.rb index 8d499bb048..c7a352b72d 100644 --- a/features/support/hooks.rb +++ b/features/support/hooks.rb @@ -39,6 +39,15 @@ end end +Before '@narrow-screen' do + @browser_width, @browser_height = page.driver.browser.manage.window.size.to_a + page.driver.browser.manage.window.resize_to(1190, @browser_height) +end + +After '@narrow-screen' do + page.driver.browser.manage.window.resize_to(@browser_width, @browser_height) +end + Before do begin Backend::Storage.instance.flushdb