Skip to content

Commit

Permalink
Remove mention of be_on_page since that method no longer exists. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoertink committed Jul 21, 2024
1 parent 30c7eb6 commit f3007a5
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/actions/guides/testing/html_and_interactivity.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class Guides::Testing::HtmlAndInteractivity < GuideAction
When writing flow specs, it’s best to *write the spec as a full flow that a
user might take*. For example, here is a flow for publishing an article:
When writing flow specs, your flow object will handle all of the interactions,
and should read as a step-by-step guide that a user will take flowing from point A to B.
Each of your spec assertions can remain in the spec for transparency.
```crystal
# spec/flows/publish_post_spec.cr
describe "Publish post flow" do
Expand All @@ -65,10 +69,12 @@ class Guides::Testing::HtmlAndInteractivity < GuideAction
flow.start_draft
flow.create_draft
flow.draft_should_be_saved
flow.should have_element("@draft-title")
flow.open_draft
flow.publish_post
flow.post_should_be_published
flow.should have_element("@post-title")
flow.should have_text("Published Post")
end
end
```
Expand All @@ -92,10 +98,6 @@ class Guides::Testing::HtmlAndInteractivity < GuideAction
click "@save-draft"
end
def draft_should_be_created
draft_title.should be_on_page
end
def open_draft
draft_title.click
end
Expand All @@ -109,10 +111,6 @@ class Guides::Testing::HtmlAndInteractivity < GuideAction
title: "Published Post"
click "@publish-post"
end
def post_should_be_published
el("@post-title", text: "Published Post").should be_on_page
end
end
```
Expand Down Expand Up @@ -320,11 +318,12 @@ class Guides::Testing::HtmlAndInteractivity < GuideAction
### Asserting elements are on the page
You can use `el` combined with the `be_on_page` matcher to assert that an
element is on the page:
You can use the `have_element` and `have_text` expectations to check for specific elements using CSS
selectors, or elements containing specific text.
```crystal
el("@post-title", text: "My post").should be_on_page
flow.should have_element(%(span[data-arg="4"]))
flow.should have_text("Welcome")
```
### Asserting the current URL path
Expand Down

0 comments on commit f3007a5

Please sign in to comment.