diff --git a/app/views/admin_users/sessions/new.html.slim b/app/views/admin_users/sessions/new.html.slim index 7da678a92..b8f24d829 100644 --- a/app/views/admin_users/sessions/new.html.slim +++ b/app/views/admin_users/sessions/new.html.slim @@ -18,11 +18,11 @@ .c-form .c-form--group = f.label :email, "Email Address" - = f.email_field :email, autofocus: true, autocomplete: "email", class:"c-input rounded-md" + = f.email_field :email, autofocus: true, autocomplete: "email", class:"c-input rounded-md", data: { test_id: "admin_login_email_input"} .c-form--group class="mb-3" = f.label :password - = f.password_field :password, autocomplete: "current-password", class:"c-input rounded-md" + = f.password_field :password, autocomplete: "current-password", class:"c-input rounded-md", data: { test_id: "admin_login_password_input"} - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' = link_to "Forgot your password?", new_password_path(resource_name), class:'font-bold flex self-end md:self-center' .c-form--action class="mt-12" - = f.submit "Sign in", class:"c-button" + = f.submit "Sign in", class:"c-button", data: { test_id: "admin_login_submit_btn"} diff --git a/spec/system/administrate_system_spec.rb b/spec/system/administrate_system_spec.rb new file mode 100644 index 000000000..bd0896379 --- /dev/null +++ b/spec/system/administrate_system_spec.rb @@ -0,0 +1,21 @@ +require "system_helper" + +RSpec.describe "Administrate", type: :system do + before do + @admin = create(:admin_user) + end + + it "can log in" do + visit admin_root_path + + find(:test_id, "admin_login_email_input").fill_in with: @admin.email + find(:test_id, "admin_login_password_input").fill_in with: "wrong password" + click_button "admin_login_submit_btn" + expect(page).to have_content("Invalid Email or password.") + + find(:test_id, "admin_login_password_input").fill_in with: @admin.password + click_button "admin_login_submit_btn" + + expect(page).to have_content("Signed in successfully.") + end +end