Writing Declarative, Maintainable Integration Tests Using Page Objects
summary
Argues that page objects make RSpec + Capybara integration tests declarative, DRY and far less brittle, and demonstrates by building page objects for product → cart → checkout flows against Amazon-style pages so tests read like high-level steps rather than CSS fiddling. Shows red/green/refactor cycle working, extracts reusable component objects, and ships a 30-line error helper that makes Capybara failures show useful diffs. Uses plain Ruby classes including Capybara DSL, keeps assertions in specs, and reports the helper is tiny, practical and effective.
AI-written summary · about
chapters (25)
- 0:00Intro
- 1:04Goals
- 1:36Integration Tests
- 2:09Problems with Integration Tests
- 3:19The Tools
- 3:38Natural Language
- 4:42Integration Testing
- 5:23TDD Cycle
- 6:14Example
- 6:39Page Objects
- 7:59Why Use Page Objects
- 8:22How to Write Page Objects
- 10:14Example Application
- 14:07Running the Test
- 14:44Implementing the Test
- 15:56Reusable Page Objects
- 16:26Error Messages
- 17:51Feedback
- 18:04Best Practices
- 18:24Predicate Methods
- 18:45User Language
- 19:08One Page
- 19:31Notable Libraries
- 19:53Conclusion
- 20:09Refactor Integration Tests
related talks
16mBlack Box Testing with RSpec and Capybara
01h 19mBDD and Acceptance Testing with RSpec & Capybara
29mMinitest with Capybara: Tips, Tricks and Lessons Learned
41mOutside-In Testing
52mStory Driven Development: The Next Generation of Rails Functional Testing
49mFront End Testing Frontier
27mSOLID principles through tests
34mEliminating Inconsistent Test Failures
