Write Browser Tests for Devise Sign Up @StatelessCode
Write Browser Tests for Devise Sign Up  @StatelessCode
Uploaded November 2022 | Updated November 2026, 3 hours ago
Now that we've taken care of fixing Devise so that it works with Turbo and Tailwind, we can get to work writing tests to validate that our vital user authentication flows are working as intended.

We start by manually executing and demonstrating the flow we intend to automate. Then we generate our test class and implement the system test.

We test the "happy path" of sign up working correctly for the user as well as error scenarios like a user with a bad email address or a password that's too short.

After we get all of the positive and negative scenarios working as intended, we refactor our code to move any repeated assertions or other code into smaller methods that can be invoked from multiple different methods.

This video covers:
00:00:12 Introduction
00:03:37 Demonstration of the functionality to be tested
00:06:15 Generate the test case and move it to match what we want for a name.
00:11:08 Happy path test for user sign up
00:22:09 Demonstration of a purposely failed test and ability to use debugger to inspect current state of test
00:26:04 Figure out error scenarios
00:28:18 Invalid email format test and troubleshooting how to test the built-in HTML form validation
00:34:44 Skip the email format one for now and implement scenarios for email already taken, password too short and password confirmation mismatch
00:45:27 Invalid confirmation token test
00:49:06 Fix for HTML5 error message by using query selector and inspecting validity of form.
00:54:09 Run RuboCop and auto-correct errors
00:55:12 Refactor repeated code into smaller re-usable methods
01:28:44 Commit and push code, update project

#ruby #rails7 #rails #rubyonrails #rubygems #codecast #screencast #github #opensource #minitest #TDD #agile #NerdDice #DnD #roleplaying #softwaredevelopment #learntocode #tailwind #postgresql #rubocop #devise #turbo #controllers #views #selenium #capybara #systemtest

See other related StatelessCode videos:
- Overview of Authentication Epic and Choosing Devise youtu.be/FbBDmiqRFzI

Resources that we relied upon for this solution:
- Testing HTML5 Messages with RSpec/Selenium medium.com/@tmikeschu/testing-html5-messages-with-rspec-selenium-5f5834c5af10

This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.
Write Browser Tests for Devise Sign UpSet up a GitHub Profile README for an OrganizationCodecast: statelesscode.com WordPress 11: Backlog priority, and Footer Link StylingCodecast: statelesscode.com WordPress 16: Move the Footer Widget Back to the FooterMediocre Karaoke - Better Now by Collective SoulThe Path to Rails 8 - Update the GitHub Actions to include Rails 8 EnhancementsExploring My Table Top Role-Playing User PersonaCreate a RubyGem 89: Add Ruby 3.2 to GitHub Actions and Update RSpec to a compatible versionAdd UUID Support and Generate the Devise User ModelAn INCONCEIVABLE RetrospectiveMigrate from SFDX CLI version 7.x to Salesforce CLI version 2.xAdd Code Climate to Project and Allow for Browser Test Driver Options
Stateless Code |

Write Browser Tests for Devise Sign Up

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER