October 2025
Intermediate to advanced
712 pages
9h 46m
Japanese
この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com
「今や全てがソーシャルでなければならない」というジョークは少し時代遅れか? ああ、ハリー。お前がこの本を書き始めた10年前には既に古臭かった。 今では完全に石器時代の遺物だ。 ともあれ、リストは共有した方が良い場合が多いとしよう。 ユーザ同士がリストを共同編集できるようにすべきだ。
その過程で、いわゆる「ページオブジェクトパターン」の実装を始めることで、 我々のFTを改善していく。次に、具体的な手順を明示的に示す代わりに、 単体テストとアプリケーションコードを自分で書いてもらう。 心配するな、合計独りぼっちになるわけじゃない! 取るべき手順の概要と、いくつかのヒントやコツは示す。
とはいえ、まだ経験がないなら、 この章こそが羽ばたくチャンスだ。 楽しんでくれ!
さあ始めよう。このFTには2人のユーザが必要だ:
src/functional_tests/test_sharing.py (ch26l001)
fromseleniumimportwebdriverfromselenium.webdriver.common.byimportByfrom.baseimportFunctionalTestdefquit_if_possible(browser):try:browser.quit()except:passclassSharingTest(FunctionalTest):deftest_can_share_a_list_with_another_user(self):# Edith is a logged-in userself.create_pre_authenticated_session("edith@example.com")edith_browser=self.browserself.addCleanup(lambda:quit_if_possible(edith_browser))# Her friend Onesiphorus is also hanging out on the lists siteoni_browser=webdriver.Firefox()self.addCleanup(lambda:quit_if_possible(oni_browser))self.browser=oni_browserself.create_pre_authenticated_session("onesiphorus@example.com")# Edith goes to the home page and starts a listself.browser=edith_browserself.browser.get(self.live_server_url)self.add_list_item("Get help")# She notices a "Share this list" optionshare_box=self.browser.find_element(By.CSS_SELECTOR,'input[name="sharee"]')self.assertEqual ...
Read now
Unlock full access