Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Railsの
システムテスト解剖学

Yusuke Iwaki
October 22, 2021

 Railsの
システムテスト解剖学

Kaigi on Rails 2021 Day1 14:00-14:30 @YusukeIwaki
「Railsの
システムテスト解剖学」の発表資料です

Yusuke Iwaki

October 22, 2021
Tweet

More Decks by Yusuke Iwaki

Other Decks in Technology

Transcript

  1. 3BJMTͱςετ PEFM JFX POUSPMMFS . 7 $ .PEFMTQFD ϏδωεϩδοΫΛ٧ΊࠐΜͰɺ୯ମࢼݧ͠Α͏ ͳΔ΂͘ബ͘ɻ

    ϦμΠϨΫτͷڍಈͳͲ͸$POUSPMMFSTQFDͰɻ "1*Ͱ͋Ε͹3FRVFTUTQFDΛ࢖͓͏ɻ ʁʁʁ
  2. 4IBSJOH%#DPOOFDUJPO w "DUJWF3FDPSE5FTU'JYUVSFTʹमਖ਼͕ೖ͓ͬͯΓɺ 
 ҟͳΔεϨου͔ΒͷΞΫηεͰ΋%#ίωΫγϣϯΛڞ༗͢Δɻ w ʮϢʔβ͕ਓ͍Δঢ়ଶʯΛ'BDUPSZ#PUͰ࡞Ε͹ 
 ϒϥ΢β͔Β΋ͦΕΛഈΊΔΑ͏ʹͳͬͨʂ w

    τϥϯβΫγϣϯɾϩʔϧόοΫͳͷͰɺ 
 ʢ*/4&35536/$"5&ʹൺ΂Δͱʣಈ࡞͕ߴ଎ʂ w ҟͳΔzϓϩηεzͰ8FCαʔόʔ͕ىಈ͍ͯ͠Δ৔߹ʹ͸ 
 %#ίωΫγϣϯ͸ผͳͷͰɺ͜ͷػೳ͕࢖͑ͳ͍ɻ %BUBCBTF$MFBOFSͷUSVODBUJPOετϥςδ
  3. $BQZCBSBͷओͳ໾ׂ w ֤छςετϥϯφʔͷηοτΞοϓΛ͢Δ w DBQZCBSBSTQFD DBQZCBSBNJOJUFTU DBQZCBSBDVDVNCFS w )551αʔόʔΛىಈ͢Δ w

    DBQZCBSBSBJMT $BQZCBSB4FSWFS w ϒϥ΢βΛࣗಈૢ࡞͢Δ w $BQZCBSB%4- $BQZCBSB%SJWFS
  4. )551αʔόʔͷىಈλΠϛϯά IUUQTHJUIVCDPNUFBNDBQZCBSBDBQZCBSBCMPCNBTUFSMJCDBQZCBSBTFTTJPOSC $ bundle exec ruby run.rb [1] pry(main)> Capybara.current_sessio

    n Capybara starting Puma.. . * Version 5.5.0 , codename: Zawgy i * Min threads: 0, max threads: 4 * Listening on http://127.0.0.1:4918 9 => #<Capybara::Session> $BQZCBSB4FTTJPOJOJUJBMJ[F $BQZCBSBDVSSFOU@TFTTJPOͷॳճࢀর࣌ ʹ$BQZCBSB4FTTJPO͕࡞ΒΕͯɺ ͦ͜Ͱ)551αʔόʔ͕ىಈ͢Δ
  5. ࣗಈૢ࡞ͷͨΊͷϝιου ϒϥ΢βυΩϡϝϯτશମ ʹର͢Δૢ࡞Λߦ͏ϝιου $BQZCBSB4FTTJPO  %0.ཁૉʹର͢Δɹʏ $BQZCBSB/PEF&MFNFOU BMM fi STUBUUBDI@

    fi MFUFYUDIFDLDIPPTFTDSPMM@UPTDSPMM@CZ DMJDL@MJOL@PS@CVUUPODMJDL@CVUUPODMJDL@MJOL fi MM@JO fi OE fi OE@BMM fi OE@CVUUPO fi OE@CZ@JE fi OE@ fi FME fi OE@MJOL UJUMFCPEZIUNMTPVSDF DVSSFOU@VSM DVSSFOU@IPTUDVSSFOU@QBUI FYFDVUF@TDSJQUFWBMVBUF@TDSJQU WJTJUSFGSFTI HP@CBDLHP@GPSXBSE TFOE@LFZTXJUIJOXJUIJO@FMFNFOUXJUIJO@ fi FMETFUXJUIJO@UBCMFXJUIJO@GSBNF TXJUDI@UP@GSBNFDVSSFOU@XJOEPXXJOEPXTPQFO@OFX@XJOEPX TXJUDI@UP@XJOEPXXJUIJO@XJOEPXXJOEPX@PQFOFE@CZTBWF@QBHFTBWF@BOE@PQFO@QBHF TBWF@TDSFFOTIPUTBWF@BOE@PQFO@TDSFFOTIPUSFTFU@TFTTJPO SFTQPOTF@IFBEFST TUBUVT@DPEFDVSSFOU@TDPQF <>BMMPX@SFMPBEDIFDLFE  DMJDLEJTBCMFE EPVCMF@DMJDL ESBH@UPESPQFWBMVBUF@BTZOD@TDSJQUFWBMVBUF@TDSJQU FYFDVUF@TDSJQU fl BTI IPWFSJOJUJBM@DBDIFJOTQFDUNVMUJQMF OBUJWF PCTDVSFE QBUISFBEPOMZ SFDUSFMPBESJHIU@DMJDLTDSPMM@UP TFMFDU@PQUJPOTFMFDUFE  TFOE@LFZTTFUTUZMFUBH@OBNFUFYU USJHHFSVOTFMFDU@PQUJPOWBMVF WJTJCMF
  6. %0.ཁૉͷऔಘ ˠ$BQZCBSB4FTTJPO fi OE ɹ$BQZCBSB4FTTJPOBMM ˠ$BQZCBSB/PEF#BTF fi OE ɹ$BQZCBSB/PEF#BTFBMM ࡉ͔͍Φϓγϣϯͷॲཧ

    RVFSZ4FMFDUPS"MMతͳಈ࡞Λ͢Δ΋ͷ IUUQTHJUIVCDPNUFBNDBQZCBSBDBQZCBSBCMPCNBTUFSMJCDBQZCBSBOPEF fi OEFSTSC RVFSZ4FMFDUPS"MMతͳΫΤϦΛ࣮ߦ ࡉ͔͍Φϓγϣϯͷॲཧ ࡉ͔͍Φϓγϣϯͷॲཧ ݁ՌΛશ෦ฦ͢
  7. %0.ཁૉͷऔಘ ˠ$BQZCBSB4FTTJPO fi OE ɹ$BQZCBSB4FTTJPOBMM ˠ$BQZCBSB/PEF#BTF fi OE ɹ$BQZCBSB/PEF#BTFBMM IUUQTHJUIVCDPNUFBNDBQZCBSBDBQZCBSBCMPCNBTUFSMJCDBQZCBSBOPEF

    fi OEFSTSC ˠTZODISPOJ[F\EPDVNFOURVFSZ4FMFDUPS"MMతͳ fi STU^ ɹTZODISPOJ[F\EPDVNFOURVFSZ4FMFDUPS"MMతͳBMM^ ͜Ε͸Կʁ
  8. %0.ཁૉͷऔಘ ˠ$BQZCBSB4FTTJPO fi OE ɹ$BQZCBSB4FTTJPOBMM ˠ$BQZCBSB/PEF#BTF fi OE ɹ$BQZCBSB/PEF#BTFBMM IUUQTHJUIVCDPNUFBNDBQZCBSBDBQZCBSBCMPCNBTUFSMJCDBQZCBSBOPEF

    fi OEFSTSC ˠ࠷େ̎ඵ͸ϙʔϦϯά\EPDVNFOURVFSZ4FMFDUPS"MMతͳ fi STU^ ɹ࠷େ̎ඵ͸ϙʔϦϯά\EPDVNFOURVFSZ4FMFDUPS"MMతͳBMM^
  9. จࣈೖྗ ˠ$BQZCBSB4FTTJPO fi MM@JO IUUQTHJUIVCDPNUFBNDBQZCBSBDBQZCBSBCMPCNBTUFSMJCDBQZCBSBTFMFDUPSEF fi OJUJPO fi MMBCMF@ fi

    FMESC fill_in('name’, with: 'YusukeIwaki') ˠ$BQZCBSB/PEF#BTF fi MM@JO ˠ fi OE@YQBUI lEFTDFOEBOU <TFMGJOQVUcTFMGUFYUBSFB><OPU !UZQFTVCNJU PS !UZQF JNBHF PS !UZQFSBEJP PS !UZQFDIFDLCPY PS !UZQFIJEEFO PS !UZQF  fi MF >< !JEOBNF PS !OBNFOBNF PS !QMBDFIPMEFSOBNF PS !JE MBCFM< OPSNBMJ[FTQBDF TUSJOH  OBNF >!GPS >cMBCFM< OPSNBMJ[FTQBDF TUSJOH   OBNF >EFTDFOEBOU <TFMGJOQVUcTFMGUFYUBSFB><OPU !UZQFTVCNJU PS !UZQF JNBHF PS !UZQFSBEJP PS !UZQFDIFDLCPY PS !UZQFIJEEFO PS !UZQF b fi MF` >z ˠ fi OE  fi MMBCMF@ fi FME bOBNF`  TFU b:VTVLF*XBLJ` Ϣʔβ͕໨ࢹՄೳͳ΋ͷΛฒ΂ͨɺ ΋ͷ͍͢͝91BUIΫΤϦʜʢۤসʣ
  10. ϒϥοΫϘοΫεςετͱ։ൃऀͷςετ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ %"4)#0"3% 8IBU`TOFX -PBEJOHʜ

    MPDBMIPTUEBTICPBSE 2"తͳ؍఺ 3BJMT։ൃऀ͕஌͍ͬͯΔ͜ͱ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO 63-ભҠ ॳظඳը͸-PBEJOH %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ (&5OFXT +40/ EJWOFXT@DPOUBJOFS ·Εʹඵ͘Β͍͔͔Δ ·Εʹඵ͘Β͍͔͔Δ JOQVUUZQFUFYU OBNFVTFSOBNF ࡉ͔͍࣮૷͸ؾʹ͠ͳ͍ ௨ৗͰ͋Ε͹ඵ͘Β͍ͰऴΘΔ͸ͣɻ શମΛ௨ͯ͠ඵ΋͔͔ͬͨΒɺͳʹ͔͓͔͍͠ ΋͠ଞͷ৔ॴʹ ͓஌Β͕ͤग़͍ͯΔͱ͢Ε͹ ͦΕ͸ෆ۩߹
  11. ϒϥοΫϘοΫεςετͱ։ൃऀͷςετ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ %"4)#0"3% 8IBU`TOFX -PBEJOHʜ

    MPDBMIPTUEBTICPBSE 2"తͳ؍఺ 3BJMT։ൃऀ͕஌͍ͬͯΔ͜ͱ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO 63-ભҠ ॳظඳը͸-PBEJOH %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ (&5OFXT +40/ EJWOFXT@DPOUBJOFS ·Εʹඵ͘Β͍͔͔Δ ·Εʹඵ͘Β͍͔͔Δ JOQVUUZQFUFYU OBNFVTFSOBNF ࡉ͔͍࣮૷͸ؾʹ͠ͳ͍ ௨ৗͰ͋Ε͹ඵ͘Β͍ͰऴΘΔ͸ͣɻ શମΛ௨ͯ͠ඵ΋͔͔ͬͨΒɺͳʹ͔͓͔͍͠ ΋͠ଞͷ৔ॴʹ ͓஌Β͕ͤग़͍ͯΔͱ͢Ε͹ ͦΕ͸ෆ۩߹
  12. $BQZCBSBͷςετ؍఺ࢥ૝ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ %"4)#0"3% 8IBU`TOFX -PBEJOHʜ

    MPDBMIPTUEBTICPBSE 2"తͳ؍఺ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO 63-ભҠ ॳظඳը͸-PBEJOH %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ (&5OFXT +40/ EJWOFXT@DPOUBJOFS ·Εʹඵ͘Β͍͔͔Δ ·Εʹඵ͘Β͍͔͔Δ JOQVUUZQFUFYU OBNFVTFSOBNF ࡉ͔͍࣮૷͸ؾʹ͠ͳ͍ ௨ৗͰ͋Ε͹ඵ͘Β͍ͰऴΘΔ͸ͣɻ શମΛ௨ͯ͠ඵ΋͔͔ͬͨΒɺͳʹ͔͓͔͍͠ ΋͠ଞͷ৔ॴʹ ͓஌Β͕ͤग़͍ͯΔͱ͢Ε͹ ͦΕ͸ෆ۩߹ fill_in('name’, with: 'YusukeIwaki') $BQZCBSBΛ࢖ͬͨίʔυ 3BJMT։ൃऀ͕஌͍ͬͯΔ͜ͱ ίϯτϩʔϥ΍ϑΥʔϜΦϒδΣΫτͷ࣮૷͕มΘΒͳ͍ݶΓ 
 OBNFଐੑ͸มΘΒͳ͍͠ɺ 
 OBNFଐੑ͕มΘΔͳΒผʹ$*͕མͪͯ͘Ε͍͍ͯ ແବʹDIFDLCPY΍SBEJPϘλϯΛ୳͠ʹߦͬͯ΄͘͠ͳ͍ɻ JOQVU<OBNFbVTFSOBNF`>Ͱඞཁे෼
  13. $BQZCBSBͷςετ؍఺ࢥ૝ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ %"4)#0"3% 8IBU`TOFX -PBEJOHʜ

    MPDBMIPTUEBTICPBSE 2"తͳ؍఺ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO 63-ભҠ ॳظඳը͸-PBEJOH %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ (&5OFXT +40/ EJWOFXT@DPOUBJOFS ·Εʹඵ͘Β͍͔͔Δ ·Εʹඵ͘Β͍͔͔Δ JOQVUUZQFUFYU OBNFVTFSOBNF ࡉ͔͍࣮૷͸ؾʹ͠ͳ͍ ௨ৗͰ͋Ε͹ඵ͘Β͍ͰऴΘΔ͸ͣɻ શମΛ௨ͯ͠ඵ΋͔͔ͬͨΒɺͳʹ͔͓͔͍͠ ΋͠ଞͷ৔ॴʹ ͓஌Β͕ͤग़͍ͯΔͱ͢Ε͹ ͦΕ͸ෆ۩߹ fill_in('name’, with: 'YusukeIwaki') $BQZCBSBΛ࢖ͬͨίʔυ 3BJMT։ൃऀ͕஌͍ͬͯΔ͜ͱ ίϯτϩʔϥ΍ϑΥʔϜΦϒδΣΫτͷ࣮૷͕มΘΒͳ͍ݶΓ 
 OBNFଐੑ͸มΘΒͳ͍͠ɺ 
 OBNFଐੑ͕มΘΔͳΒผʹ$*͕མͪͯ͘Ε͍͍ͯ ෳࡶͳ91BUIΫΤϦͰɺҙਤ͠ͳ͍΋ͷΛरͬͯ΄͘͠ͳ͍ɻ JOQVU<OBNFbVTFSOBNF`>Ͱඞཁे෼
  14. $BQZCBSBͷςετ؍఺ࢥ૝ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ %"4)#0"3% 8IBU`TOFX -PBEJOHʜ

    MPDBMIPTUEBTICPBSE 2"తͳ؍఺ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO 63-ભҠ ॳظඳը͸-PBEJOH %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ (&5OFXT +40/ EJWOFXT@DPOUBJOFS ·Εʹඵ͘Β͍͔͔Δ ·Εʹඵ͘Β͍͔͔Δ JOQVUUZQFUFYU OBNFVTFSOBNF ࡉ͔͍࣮૷͸ؾʹ͠ͳ͍ ௨ৗͰ͋Ε͹ඵ͘Β͍ͰऴΘΔ͸ͣɻ શମΛ௨ͯ͠ඵ΋͔͔ͬͨΒɺͳʹ͔͓͔͍͠ ΋͠ଞͷ৔ॴʹ ͓஌Β͕ͤग़͍ͯΔͱ͢Ε͹ ͦΕ͸ෆ۩߹ 3BJMT։ൃऀ͕஌͍ͬͯΔ͜ͱ click_button(‘Login') expect(page).to have_text('͓͠Βͤ) $BQZCBSBΛ࢖ͬͨίʔυ
  15. 3BJMT։ൃऀʹͱͬͯඞཁͳػೳ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ %"4)#0"3% 8IBU`TOFX -PBEJOHʜ

    MPDBMIPTUEBTICPBSE 2"తͳ؍఺ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO 63-ભҠ ॳظඳը͸-PBEJOH %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ (&5OFXT +40/ EJWOFXT@DPOUBJOFS ·Εʹඵ͘Β͍͔͔Δ ·Εʹඵ͘Β͍͔͔Δ ࡉ͔͍࣮૷͸ؾʹ͠ͳ͍ ௨ৗͰ͋Ε͹ඵ͘Β͍ͰऴΘΔ͸ͣɻ શମΛ௨ͯ͠ඵ΋͔͔ͬͨΒɺͳʹ͔͓͔͍͠ 3BJMT։ൃऀ͕஌͍ͬͯΔ͜ͱ $BQZCBSBΛ࢖ͬͨίʔυ ݻఆͰ࠷େ˓ඵɺΈ͍ͨͳͷ͸ࠔΔɻ ௨৴ʹ·Εʹ͔͔࣌ؒΔ͔΋͠Εͳ͍ͷ͔ͩΒɺ ʮ˓˓͕׬ྃ͢Δ·Ͱ଴ͭʯͬͯॻ͖ํΛ͍ͨ͠ɻ
  16. 3BJMT։ൃऀʹͱͬͯඞཁͳػೳ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ %"4)#0"3% 8IBU`TOFX -PBEJOHʜ

    MPDBMIPTUEBTICPBSE 2"తͳ؍఺ MPDBMIPTUMPHJO :VTVLF*XBLJ -PHJO 63-ભҠ ॳظඳը͸-PBEJOH %"4)#0"3% 8IBU`TOFX ͓͠Β͕ͤ͋Γ·͢ (&5OFXT +40/ EJWOFXT@DPOUBJOFS ·Εʹඵ͘Β͍͔͔Δ ·Εʹඵ͘Β͍͔͔Δ ࡉ͔͍࣮૷͸ؾʹ͠ͳ͍ ௨ৗͰ͋Ε͹ඵ͘Β͍ͰऴΘΔ͸ͣɻ શମΛ௨ͯ͠ඵ΋͔͔ͬͨΒɺͳʹ͔͓͔͍͠ 3BJMT։ൃऀ͕஌͍ͬͯΔ͜ͱ $BQZCBSBΛ࢖ͬͨίʔυ ݻఆͰ࠷େ˓ඵɺΈ͍ͨͳͷ͸ࠔΔɻ ௨৴ʹ·Εʹ͔͔࣌ؒΔ͔΋͠Εͳ͍ͷ͔ͩΒɺ ʮ˓˓͕׬ྃ͢Δ·Ͱ଴ͭʯͬͯॻ͖ํΛ͍ͨ͠ɻ click_button(‘Login’) ը໘ભҠ͢Δ·Ͱ଴ͭ << GET /news ͷϨεϙϯε͕ऴΘΔ·Ͱ଴ͭ >> << div#news_container ͷLoading͕ফ͑Δ·Ͱ଴ͭ >> expect(<< div#news_container >>).to have_text('͓͠Βͤ) Ͱ΋$BQZCBSB%4-ʹ ͦͷػೳ͕ແ͍ΑͶʔ
  17. $BQZCBSB%4-Λ࢖Θͣʹࣗಈૢ࡞ click_button(‘Login’) ը໘ભҠ͢Δ·Ͱ଴ͭ << GET /news ͷϨεϙϯε͕ऴΘΔ·Ͱ଴ͭ >> << div#news_container

    ͷLoading͕ফ͑Δ·Ͱ଴ͭ >> expect(<< div#news_container >>).to have_text('͓͠Βͤ) $BQZCBSB%4-࢖ΘͣʹͲ͏΍ͬͯϒϥ΢βΛಈ͔ͤ͹͍͍ͷʁ
  18. $BQZCBSB%4-Λ࢖Θͣʹࣗಈૢ࡞ click_button(‘Login’) ը໘ભҠ͢Δ·Ͱ଴ͭ << GET /news ͷϨεϙϯε͕ऴΘΔ·Ͱ଴ͭ >> << div#news_container

    ͷLoading͕ফ͑Δ·Ͱ଴ͭ >> expect(<< div#news_container >>).to have_text('͓͠Βͤ) 4FMFOJVNΛ௚઀࢖͑͹͍͍͡ΌΜɻ ͋ͱ͸ɺ1VQQFUFFS΍1MBZXSJHIUͳͲɺ ࠷ۙͷπʔϧͩͬͨΒ΋ͬͱ؆୯ʹॻ͚ΔΑɻ XBJU'PS/BWJHBUJPO XBJU'PS3FTQPOTF XBJU'PS4FMFDUPS
  19. $BQZCBSB%4-Λ࢖Θͣʹࣗಈૢ࡞ click_button(‘Login’) ը໘ભҠ͢Δ·Ͱ଴ͭ << GET /news ͷϨεϙϯε͕ऴΘΔ·Ͱ଴ͭ >> << div#news_container

    ͷLoading͕ফ͑Δ·Ͱ଴ͭ >> expect(<< div#news_container >>).to have_text('͓͠Βͤ) Ͱ΋ɺ͢ͰʹҎ্ͷςετ࡞ͬͪΌͬͯΔΑʁʁ ҰؾʹҠߦ͢Δͷ͠ΜͲ͍ʔʔ XBJU'PS/BWJHBUJPO XBJU'PS3FTQPOTF XBJU'PS4FMFDUPS
  20. $BQZCBSB%4-Λ࢖Θͣʹࣗಈૢ࡞ click_button(‘Login’) ը໘ભҠ͢Δ·Ͱ଴ͭ << GET /news ͷϨεϙϯε͕ऴΘΔ·Ͱ଴ͭ >> << div#news_container

    ͷLoading͕ফ͑Δ·Ͱ଴ͭ >> expect(<< div#news_container >>).to have_text('͓͠Βͤ) ҰؾʹҠߦ͢ΔඞཁͳΜͯແ͍ɻ ෆ҆ఆͳςετ͔Βॱʹɺஈ֊తʹҠߦ͠Α͏ XBJU'PS/BWJHBUJPO XBJU'PS3FTQPOTF XBJU'PS4FMFDUPS 4UFQෆ҆ఆͳςετͷෆ҆ఆͳ෦෼͚ͩิڧ͢Δ 4UFQෆ҆ఆͳςετ͚ͩɺ$BQZCBSB%4-Λ࢖Θͳ͘͢Δ 4UFQ׬શʹ$BQZCBSBΛ࢖Θͳ͘͢Δ
  21. 4UFQɿऑ͍ͱ͜ΖΛϐϯϙΠϯτͰิڧ͢Δ click_button(‘Login’) ը໘ભҠ͢Δ·Ͱ଴ͭ << GET /news ͷϨεϙϯε͕ऴΘΔ·Ͱ଴ͭ >> << div#news_container

    ͷLoading͕ফ͑Δ·Ͱ଴ͭ >> expect(<< div#news_container >>).to have_text('͓͠Βͤ) puppeteer_page.wait_for_navigation do end puppeteer_page.wait_for_request(‘/news.json’) puppeteer_page.wait_for_selector(‘div#news_container’) ෆ҆ఆͳςετͷෆ҆ఆͳ෦෼͚ͩิڧ͢Δ