From 9e75e0e65c766deeb7c0f2eee11202ba906975fc Mon Sep 17 00:00:00 2001 From: shveikus Date: Mon, 22 Nov 2021 13:15:52 +0300 Subject: [PATCH] Add spec for logging using keyboard --- spec/support/request/ui_component_helper.rb | 6 ++++++ spec/system/consumer/authentication_spec.rb | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/spec/support/request/ui_component_helper.rb b/spec/support/request/ui_component_helper.rb index bfaee94a40..b48cfe16e0 100644 --- a/spec/support/request/ui_component_helper.rb +++ b/spec/support/request/ui_component_helper.rb @@ -109,4 +109,10 @@ module UIComponentHelper expand_active_table_node(name) page.find(".active_table_node a", text: name.to_s).click end + + def fill_in_using_keyboard + page.find('#email').send_keys(user.email, :tab, user.password, :tab, :space) + expect(page.find('#remember_me')).to be_checked + page.find('#remember_me').send_keys(:tab, :enter) + end end diff --git a/spec/system/consumer/authentication_spec.rb b/spec/system/consumer/authentication_spec.rb index 3d06ef7855..a28af792c0 100644 --- a/spec/system/consumer/authentication_spec.rb +++ b/spec/system/consumer/authentication_spec.rb @@ -48,6 +48,13 @@ describe "Authentication", js: true do expect(page).to be_logged_in_as user end + context "using keyboard" do + it "logging in successfully" do + fill_in_using_keyboard + expect(page).to be_logged_in_as user + end + end + describe "signing up" do before do select_login_tab "Sign up"