Prepare system testing

This commit is contained in:
cryptogopher 2023-04-11 20:50:13 +02:00
parent 7c77d87213
commit 51985bc88e
6 changed files with 31 additions and 59 deletions

2
.gitignore vendored
View File

@ -33,3 +33,5 @@
/.lesshst /.lesshst
/.local /.local
/.viminfo /.viminfo
/.webdrivers
*.swp

View File

@ -21,13 +21,10 @@ gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
gem "devise" gem "devise"
group :development, :test do group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem gem "byebug"
gem "debug", platforms: %i[ mri mingw x64_mingw ]
end end
group :development do group :development do
gem "byebug"
# Use console on exceptions pages [https://github.com/rails/web-console] # Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console" gem "web-console"

View File

@ -66,13 +66,13 @@ GEM
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
addressable (2.8.2) addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0) public_suffix (>= 2.0.2, < 6.0)
bcrypt (3.1.18) bcrypt (3.1.18)
bindex (0.8.1) bindex (0.8.1)
builder (3.2.4) builder (3.2.4)
byebug (11.1.3) byebug (11.1.3)
capybara (3.38.0) capybara (3.39.0)
addressable addressable
matrix matrix
mini_mime (>= 0.1.3) mini_mime (>= 0.1.3)
@ -84,10 +84,7 @@ GEM
concurrent-ruby (1.2.2) concurrent-ruby (1.2.2)
crass (1.0.6) crass (1.0.6)
date (3.3.3) date (3.3.3)
debug (1.7.2) devise (4.9.2)
irb (>= 1.5.0)
reline (>= 0.3.1)
devise (4.9.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 4.1.0) railties (>= 4.1.0)
@ -102,9 +99,6 @@ GEM
importmap-rails (1.1.5) importmap-rails (1.1.5)
actionpack (>= 6.0.0) actionpack (>= 6.0.0)
railties (>= 6.0.0) railties (>= 6.0.0)
io-console (0.6.0)
irb (1.6.3)
reline (>= 0.3.0)
loofah (2.20.0) loofah (2.20.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
@ -128,8 +122,8 @@ GEM
timeout timeout
net-smtp (0.3.3) net-smtp (0.3.3)
net-protocol net-protocol
nio4r (2.5.8) nio4r (2.5.9)
nokogiri (1.14.2-x86_64-linux) nokogiri (1.14.3-x86_64-linux)
racc (~> 1.4) racc (~> 1.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
public_suffix (5.0.1) public_suffix (5.0.1)
@ -167,8 +161,6 @@ GEM
zeitwerk (~> 2.5) zeitwerk (~> 2.5)
rake (13.0.6) rake (13.0.6)
regexp_parser (2.7.0) regexp_parser (2.7.0)
reline (0.3.3)
io-console (~> 0.5)
responders (3.1.0) responders (3.1.0)
actionpack (>= 5.2) actionpack (>= 5.2)
railties (>= 5.2) railties (>= 5.2)
@ -227,7 +219,6 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
byebug byebug
capybara capybara
debug
devise devise
importmap-rails importmap-rails
mysql2 (~> 0.5) mysql2 (~> 0.5)

View File

@ -1,5 +1,8 @@
require "test_helper" require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400] # NOTE: remove when capabilities no longer used by Rails
Selenium::WebDriver.logger.ignore(:capabilities)
driven_by :selenium, using: :headless_firefox, screen_size: [1600, 900]
end end

View File

@ -1,9 +1,3 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html admin:
email: admin@dev27.fixin.me
one: status: admin
email: MyString
status: 1
two:
email: MyString
status: 1

View File

@ -2,42 +2,27 @@ require "application_system_test_case"
class UsersTest < ApplicationSystemTestCase class UsersTest < ApplicationSystemTestCase
setup do setup do
@user = users(:one) @admin = users(:admin)
end end
test "visiting the index" do test "sign in" do
visit users_url visit new_user_session_url
assert_selector "h1", text: "Users"
end end
test "should create user" do #test "visiting the index" do
visit users_url # visit users_url
click_on "New user" # assert_selector "h1", text: "Users"
#end
fill_in "Email", with: @user.email #test "should create user" do
fill_in "Status", with: @user.status # visit users_url
click_on "Create User" # click_on "New user"
assert_text "User was successfully created" # fill_in "Email", with: @user.email
click_on "Back" # fill_in "Status", with: @user.status
end # click_on "Create User"
test "should update User" do # assert_text "User was successfully created"
visit user_url(@user) # click_on "Back"
click_on "Edit this user", match: :first #end
fill_in "Email", with: @user.email
fill_in "Status", with: @user.status
click_on "Update User"
assert_text "User was successfully updated"
click_on "Back"
end
test "should destroy User" do
visit user_url(@user)
click_on "Destroy this user", match: :first
assert_text "User was successfully destroyed"
end
end end