mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
First pass at a system test (#305)
This commit is contained in:
parent
0922a7cbd6
commit
e812b715d3
4 changed files with 33 additions and 3 deletions
|
@ -31,14 +31,14 @@
|
||||||
<%= render "accounts/#{permitted_accountable_partial(@account.accountable_type)}", f: f %>
|
<%= 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">
|
<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">
|
<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" %>
|
<%= 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>
|
</div>
|
||||||
|
|
||||||
<div class="absolute right-5 bottom-5">
|
<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') %>
|
<%= inline_svg_tag('icn-check.svg', class: 'text-white fill-current') %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
<div class="flex flex-col mt-6">
|
<div class="flex flex-col mt-6">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<span class="text-xs">Accounts</span>
|
<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') %>
|
<%= inline_svg_tag('icon-add.svg', class: 'text-gray-500 fill-current') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,4 +2,16 @@ require "test_helper"
|
||||||
|
|
||||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||||
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
|
driven_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"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
18
test/system/accounts_test.rb
Normal file
18
test/system/accounts_test.rb
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue