Skip to content

Commit

Permalink
first tweaks in 24
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwp committed Jan 29, 2025
1 parent 8d03055 commit 870d6b4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
48 changes: 29 additions & 19 deletions chapter_24_outside_in.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ on which to build the next layer out.

But working inside-out like this also has some weaknesses.

=== Why Prefer "Outside-In"?

=== Why Prefer "Outside-In"?

((("Outside-In TDD", "vs. inside-out", secondary-sortas="inside-out")))
((("inside-out TDD")))
Expand Down Expand Up @@ -81,13 +81,14 @@ Let's see it in action.
=== The FT for "My Lists"

((("functional tests (FTs)", "outside-in technique")))
As we work through the following functional test, we start with the most
outward-facing (presentation layer), through to the view functions (or
"controllers"), and lastly the innermost layers, which in this case will be
model code.
As we work through the following functional test,
we start with the most outward-facing (presentation layer),
through to the view functions (or "controllers"),
and lastly the innermost layers, which in this case will be model code.

We know our `create_pre_authenticated_session` code works now, so we can just
write our FT to look for a "My Lists" page:
We know our `create_pre_authenticated_session` code works now,
so we can just fill out the actual body of our FT
to look for a "My Lists" page:


[role="sourcecode"]
Expand Down Expand Up @@ -127,12 +128,13 @@ from selenium.webdriver.common.by import By
//TODO: add a check for email in my lists page header, reflow logic
// to fit better with workshops..

We create a list with a couple of items, and then we check that this list
appears on a new "My Lists" page, and that it's "named" after the first item
in the list.
We create a list with a couple of items,
then we check that this list appears on a new "My Lists" page,
and that it's "named" after the first item in the list.

Let's validate that it really works by creating a second list, and seeing that
appear on the My Lists page as well. The FT continues, and while we're at it,
Let's validate that it really works by creating a second list,
and seeing that appear on the My Lists page as well.
The FT continues, and while we're at it,
we check that only logged-in users can see the "My Lists" page:

[role="sourcecode"]
Expand Down Expand Up @@ -169,8 +171,9 @@ we check that only logged-in users can see the "My Lists" page:
----
====

Our FT uses a new helper method, `add_list_item`, which abstracts away entering
text into the right input box. We define it in 'base.py':
Our FT uses a new helper method, `add_list_item`,
which abstracts away entering text into the right input box.
We define it in 'base.py':


[role="sourcecode small-code"]
Expand All @@ -191,15 +194,22 @@ from selenium.webdriver.common.keys import Keys
====


And while we're at it we can use it in a few of the other FTs, like this:
And while we're at it we can use it in a few of the other FTs,
like this for example:


[role="sourcecode currentcontents dofirst-ch22l004"]
.src/functional_tests/test_list_item_validation.py
[role="sourcecode dofirst-ch22l004-1"]
.src/functional_tests/test_layout_and_styling.py (ch22l004-2)
====
[source,python]
[source,diff]
----
self.add_list_item("Buy wellies")
# She starts a new list and sees the input is nicely
# centered there too
- inputbox.send_keys("testing")
- inputbox.send_keys(Keys.ENTER)
- self.wait_for_row_in_list_table("1: testing")
+ self.add_list_item("testing")
+
----
====

Expand Down
2 changes: 1 addition & 1 deletion source/chapter_24_outside_in/superlists
Submodule superlists updated 0 files
1 change: 0 additions & 1 deletion tests/test_chapter_24_outside_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def test_listings_and_commands_and_output(self):
# sanity checks
self.assertEqual(self.listings[0].type, "code listing with git ref")
self.assertEqual(self.listings[1].type, "code listing with git ref")
self.assertEqual(self.listings[3].type, "code listing currentcontents")

# skips
# self.skip_with_check(22, 'switch back to master') # comment
Expand Down

0 comments on commit 870d6b4

Please sign in to comment.