The personal finance app for everyone
First pass at a system test (#305)
Dwight Watsone812b715d310
diff --git a/app/views/accounts/new.html.erb b/app/views/accounts/new.html.erbindex a7556f27..2e6e7ddf 100644--- a/app/views/accounts/new.html.erb+++ b/app/views/accounts/new.html.erb@@ -31,14 +31,14 @@<%= render "accounts/#{permitted_accountable_partial(@account.accountable_type)}", f: f %><div class="relative p-4 border border-gray-100 bg-offwhite rounded-xl focus-within:bg-white focus-within:shadow focus-within:opacity-100">- <label for="account_name" class="block text-sm font-medium opacity-50 focus-within:opacity-100">Balance</label>+ <label for="account_balance" class="block text-sm font-medium opacity-50 focus-within:opacity-100">Balance</label><div class="flex"><%= f.number_field :balance, placeholder: "$0.00", in: 0.00..100000000.00, required: 'required', class: "p-0 mt-1 bg-transparent border-none opacity-50 focus:outline-none focus:ring-0 focus-within:opacity-100" %></div></div><div class="absolute right-5 bottom-5">- <button type="submit" class="flex items-center justify-center w-12 h-12 mb-2 bg-black rounded-full shrink-0 grow-0 hover:bg-gray-600">+ <button type="submit" class="flex items-center justify-center w-12 h-12 mb-2 bg-black rounded-full shrink-0 grow-0 hover:bg-gray-600" title="Submit"><%= inline_svg_tag('icn-check.svg', class: 'text-white fill-current') %></button></div>diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erbindex f028840d..f8bd7290 100644--- a/app/views/layouts/application.html.erb+++ b/app/views/layouts/application.html.erb@@ -57,7 +57,7 @@<div class="flex flex-col mt-6"><div class="flex items-center justify-between"><span class="text-xs">Accounts</span>- <%= link_to new_account_path, class: 'block hover:bg-gray-100 p-2 text-sm font-semibold text-gray-900 flex items-center rounded' do %>+ <%= link_to new_account_path, class: 'block hover:bg-gray-100 p-2 text-sm font-semibold text-gray-900 flex items-center rounded', title: "New account" do %><%= inline_svg_tag('icon-add.svg', class: 'text-gray-500 fill-current') %><% end %></div>diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rbindex cee29fd2..42eb8460 100644--- a/test/application_system_test_case.rb+++ b/test/application_system_test_case.rb@@ -2,4 +2,16 @@ require "test_helper"class ApplicationSystemTestCase < ActionDispatch::SystemTestCasedriven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]++ private++ def sign_in(user)+ visit new_session_path+ within "form" do+ fill_in "Email", with: user.email+ fill_in "Password", with: "password"+ click_button "Log in"+ end+ assert_text "Dashboard"+ endenddiff --git a/test/system/accounts_test.rb b/test/system/accounts_test.rbnew file mode 100644index 00000000..42cd1195--- /dev/null+++ b/test/system/accounts_test.rb@@ -0,0 +1,18 @@+require "application_system_test_case"++class AccountsTest < ApplicationSystemTestCase+ setup do+ sign_in @user = users(:bob)+ end++ test "should create account" do+ click_on "New account"+ click_on "Credit Card"+ within "form" do+ fill_in "Name", with: "VISA"+ fill_in "Balance", with: "1000"+ click_on "Submit"+ end+ assert_text "$1,000.00"+ end+end