Test Against Default Markup and Content Initially
Learn about testing against the markup and content for our Rails application.
We'll cover the following
We’ll use the DOM to locate content that allows us to confidently assert the page is working. As a first pass, we’ll use the DOM as it is. That means we’ll expect two <li>
s in a <ul>
that have our widget names in them. We’ll click an <a>
inside one and expect to see the widget’s name in an <h1>
with its formatted ID in an <h2>
.
We’ll assert on regular expressions instead of exact content so that trivial changes in copy won’t break our test. Also, note that we’re using case insensitive regular expressions (they end with /i
) to further insulate our tests from trivial content changes.
Get hands-on with 1400+ tech skills courses.