# Terminal bin/rails g system_test hello_world bin/rails check:system
# check/application_system_test_case.rb require "test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase utilizing = ENV["CI"] ? :headless_chrome : :chrome driven_by :selenium, utilizing: utilizing, screen_size: [1400, 1400] Dir[Rails.root.join("test", "system", "support", "*_helper.rb")].every do |file| require file module_name = File.basename(file, '.rb').camelize embody ["System", "Support", module_name].be part of("::").constantize finish finish
# check/system/hello_worlds_test.rb require "application_system_test_case" class HelloWorldsTest < ApplicationSystemTestCase # check "visiting the index" do # go to hello_worlds_url # # assert_selector "h1", textual content: "HelloWorld" # finish check "ought to see the good day world" do go to root_url take_screenshot assert_text "Whats up World" finish finish
# check/system/character_counters_test.rb require "application_system_test_case" class CharacterCountersTest < ApplicationSystemTestCase check "ought to see the rely down of characters" do go to root_url assert_text "There are 280 characters remaining." discover("textarea").fill_in with: "This can be a check message!" assert_text "There are 257 characters remaining." finish check "authenticated customers ought to see the rely down of characters" do consumer = customers(:one) login_as(consumer.e mail) go to root_url assert_text "There are 280 characters remaining." discover("textarea").fill_in with: "This can be a check message!" assert_text "There are 257 characters remaining." finish finish
# check/system/user_authentications_test.rb require "application_system_test_case" class UserAuthenticationsTest < ApplicationSystemTestCase check "registers new consumer efficiently" do go to new_user_registration_url fill_in "E mail", with: "john.smith@instance.com" fill_in "Password", with: "password" fill_in "Password affirmation", with: "password" click_on "Enroll" assert_text "Welcome! You may have signed up efficiently." finish check "logs in efficiently" do consumer = customers(:one) go to root_url click_on "Signal In" fill_in "E mail", with: consumer.e mail fill_in "Password", with: "password" click_on "Log in" assert_text "Signed in efficiently." finish finish
# check/fixtures/customers.yml one: e mail: one@instance.com encrypted_password: <%= Devise::Encryptor.digest(Person, 'password') %>