Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Commit

Permalink
Add system test
Browse files Browse the repository at this point in the history
  • Loading branch information
triszt4n committed Dec 8, 2020
1 parent 46a629a commit 76f898d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 107 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ end

group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'capybara'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ PLATFORMS
DEPENDENCIES
bootsnap (>= 1.4.2)
byebug
capybara (>= 2.15)
capybara
faker (~> 2.14)
haml (~> 5.2.0)
haml-rails (~> 2.0)
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/_navbar.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
= link_to 'Change password', change_pw_path(@current_user), class: 'dropdown-item'
= link_to 'My Followings', follows_path(@current_user), class: 'dropdown-item'
.dropdown-divider
= link_to 'Log out', logout_path, class: 'dropdown-item'
= link_to 'Log out', logout_path, class: 'dropdown-item', id: 'logout'
- else
%li.nav-item
= link_to 'Log in', auth_path, class: current_controller?('sessions')? 'nav-link active' : 'nav-link'
= link_to 'Log in', auth_path, class: current_controller?('sessions')? 'nav-link active' : 'nav-link', id: 'login'
2 changes: 1 addition & 1 deletion test/application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "test_helper"

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
driven_by :selenium, using: :firefox, screen_size: [1280, 1080]
end
55 changes: 0 additions & 55 deletions test/system/events_test.rb

This file was deleted.

25 changes: 25 additions & 0 deletions test/system/logins_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require "application_system_test_case"

class LoginsTest < ApplicationSystemTestCase
setup do
@user = users(:snape)
end

test "log in wrong pw then good" do
visit auth_url

assert_selector "a#login", text: "Log in"
fill_in "Email address", with: @user.email
fill_in "Password", with: "wwrong"
click_button "Log in"

assert_selector "div", class: "alert", text: "No match in database with these credentials"
fill_in "Email address", with: @user.email
fill_in "Password", with: 'titok'
click_button "Log in"

assert_selector "a", text: @user.name
click_on @user.name
assert_selector "a#logout", text: "Log out"
end
end
47 changes: 0 additions & 47 deletions test/system/posts_test.rb

This file was deleted.

0 comments on commit 76f898d

Please sign in to comment.