ããããï¼å¹´åããããRubyåãã®ãã©ã¦ã¶ãªã¼ãã¡ã¼ã·ã§ã³ãã¼ã«ããããã趣å³ã§éçºãã¦ããã
ç¹ã«ä¸èº«ã¯ãªãããããã¾ã§ãã£ã¦ãããã¨ãå°ããµããªã
ã¯ãã¾ãã¯Rubykaigi2020
æãã°ãéçºãå§ããåæ©ã¯é常ã«ä¸ç´ã§ããRubykaigi 2020ã«ãªãã§ãããããåºã¦ã¿ãããã ã£ããæªãè¨ãã°ããã ç®ç«ã¡ããã ããPuppeteerã¯ãªãã¨ãªã好ãã§è§¦ã£ã¦ãã®ã§ããRubyã«ç§»æ¤ããããªãããããããããï¼ããããã®æ°æã¡ã§å®è£ ãåãã¦ãæå¿ããããã°Rubykaigi2020ã®CFPãåºããã¨ãã¦ããã
ã¨ããããããã¯ç°¡åã«ãããªãã¦ãWebSocketã¨async/awaitã§å®å ¨ã«æè©°ã¾ãã¨ãªãã
ããã§ãconcurrent-rubyã¨ãåéã«ãªãæ©ã¿ç´ãã¦ãæåã®ãªãªã¼ã¹ã¯2020/04/05ã ã£ããå ¨ç¶CFPã«éã«åã£ã¦ããªãã
puppeteer-rubyã¨æ©ãã 9ã¶æ
ããã§ããä½ã£ã¦ãããã®ã«ã ãã ãã¨æå³ãæãå§ããã®ã§ãå°ããã¤puppeteer-rubyã®å質ãé«ãã¦ãããã¾ãã¯SEOç®çã§å°ãããã°è¨äºãæ¸ããã
ãã®é ã¯ããããã¾ã ã¢ã¼ãªã¼ã¢ããã¿ã¼çãªã¦ã¼ã¶ã¯èª°ãããªããã¨ã¯ãããSeleniumãããFerrumãããï¼å®å®æ§ã¨ãã観ç¹ã§ã¯ï¼æå©ãªç¢ºä¿¡ã¯ãã£ãã®ã§ãã©ãã©ãåºãã¦ãããã¨ã«ããã
åãã¦ã®ç»å£: ã¦ããã¼ãã¼ãã¢ãã#2
ã¾ãã¯èªåãã¹ãã®éã¾ãããã£ãã®ã§ãããã§ç»å£ããã¦ããã£ãããããããããã¨ã³ã¸ãã¢ã¨ãã¦ã®äººçåç»å£ã
第13åãã¯ãªã«Ruby大è³
æã£ããããå ±æãããã ãããããã§ä¸æ°ã«èª¿åãã¤ããã
Playwrightã«æµ®æ°ãå§ãã
ãã¯ãªã«Ruby大è³ã®å®è£ ããã¦ããã¨ãã«ãã©ããã¦ãPlaywrightãæ°ã«ãªã£ãã®ã§ããã®RubyçãPoCããã®ãå§ã¾ãã
- ãã¥ã¢Ruby Implementationãªpuppeteer-rubyã¨æ¯è¼ããã¨ãPlaywrightã¯Ruby"ã¯ã©ã¤ã¢ã³ã"ã§ãããªãããµã¼ãã¼ãµã¤ãã¯Node.jsã§åãã¦ãããã¤ã¾ããSeleniumã¨åæ§ã«Ruby以å¤ã®ãã®ãã»ããã¢ããããå¿ è¦ããããå°å ¥ãããã¾ã§ç°¡åã§ã¯ãªãã
- Playwrightã¯1ã¶æã«1åãã¼ã¹ã§ç ´å£çå¤æ´ãå«ãã¢ãããã¼ãã次ã ããããJSã¦ã¼ã¶ã追å¾ããã ãã§ã大å¤ãªã®ã«ãRubyã¯ã©ã¤ã¢ã³ãã追å¾ããã¦æ´ã«Rubyã¯ã©ã¤ã¢ã³ãã®ã¦ã¼ã¶ã«è¿½å¾ãã¦ãããã£ã¦ãªããªãã«å³ããã®ã§ã¯ï¼ã¨æããã
ãªã©ã®çç±ããããã£ã¡ã¯puppeteer-rubyã»ã©å¸æãã¦ããªãã£ãã
Playwrightã¸ã®æ³¨å
2021å¹´ã«ãªãã¨ãæ¬å®¶Puppeteerã¨Playwrightã®éçºã¹ãã¼ãã®å·®ãé常ã«é¡èã«ãªã£ã¦ãããããããPuppeteerä¸æ¬ã§è¡ãã®ã¯ãªã¹ãã¼ã ã¨æãå§ããã
Playwrightã®Rubyã¯ã©ã¤ã¢ã³ãã¯ãå®ã¯puppeteer-rubyã«æ¯ã¹ã¦ã¡ã³ããã³ã¹ã³ã¹ããå°ãªãããµã¼ãã¼å´ã¯ã¨ãã«éçºããªãã¦ããã¯ã©ã¤ã¢ã³ãã¤ã³ã¿ã¼ãã§ã¼ã¹ï¼Î±ã ãå°ãå®è£ ããã°ãPlaywrightã®æ§ã ãªæ©è½ã使ããããã®ãããéçºã®ã³ã¹ããpuppeteer-rubyãããã ãã¶ããã
åé¡ã¯ãPlaywrightã¯èªåã§èµ·åãããã©ã¦ã¶ããèªåæä½ã§ããªããã¨ããã¨ããã ã£ãããCapybaraãã©ã¤ããä½ã£ã¦ãã¾ãã°System Specãã使ãããããããªãã«éè¦ã¯ããããããªããã¨æ³åããã
ãã®æ¹éãããã°ã§å®£è¨ãã¦ãPlaywrightãRailsãã使ããããã«ããããã®éçºã«æ³¨åãå§ããã
Capybaraãã©ã¤ãã®éçºã¨ããè¦è¡
PlaywrightãRailsãã使ãã¹ãã¼ãªã«æ¬ ãããªãã®ãCapybaraãPlaywrightãã¼ã¹ã®ãã©ã¤ããã¤ãããããCapybara DSLã®æ¸ãæ¹ããªãã¨ãªã調ã¹ãã
ããã¦ãå®éã«Capybaraãã©ã¤ããä½ã£ãã
ããã°ã®æ¹ã«ã¯capybara-playwright-driverãæåããä½ã£ãããã«æ¸ããããå®ã¯ãã¯ãªã«Ruby大è³ã®å®è£ æ¤è¨¼ã§capybara-puppeteer-driverã¨ããã®ãä½ã£ã¦ããã(å®æã¯ãã¦ããªãã£ã)
DSLã®ããã¯ã¨ã³ãã¨ãã¦å®è£ ãã¹ãã¡ã½ãããå¤ããä½ãã©ãå®è£ ãã¹ããã¯ç¾ç¶ã³ããããã°ã©ãã³ã°ãããããªãã®ã§ããªããªãã«é¢åãªãã¨ã¯æ³åãã¦ãããæ¡ã®å®ãcapybara-playwright-driverã¯ã ãã¶è¦è¡ã ã£ãã
ãã¨ãæã£ããããCapybaraã¯é©å½ã«ä½ããã¦ããé¨åããããã¨ãããã£ãã
Playwrightã®Rubyã¯ã©ã¤ã¢ã³ãã®å¸æ
2021å¹´4æé ããããã playwright-ruby-clientãå®ä½¿ç¨ã«èããå質ã«ãªã£ã¦ããããªï¼ã¨ããã®ã¨ãããã¹ãä¸ã®åç»ãæ®ããã®ã§ãç»é¢ã®åã§ãã£ã¨è¦å¼µã£ã¦ç¡ãã¦ããããã ãï¼ãã£ã¦ããã¤ã³ãã¯ããä¸ããããããªæ©è½ã移æ¤ãæ¸ãã ã
playwright.devãã¾ãã¦ãDocusaurus2ã§ããã¥ã¡ã³ãã¼ã·ã§ã³ãµã¤ããæ§ç¯ãã¦ã使ã£ã¦ãããããã®æºåãæ´ããã
playwright-ruby-client.vercel.app
ï¼ãã¤ã¯ãã½ããã¯Rubyã«å¯¾ãã¦æè³ããªãä¼ç¤¾ãªã®ã§å¯è½æ§ã¯ã¼ãã ãwï¼playwright-ruby-clientããã¤ã¯ãã½ããé ä¸ã«ãªã£ã¦ããããããã®ã¬ãã«ã§ããã¥ã¡ã³ãã¯æ´åããããã«å¿ãããã
ã§ãããã¾ã§ãã£ãã®ã§ãä¸æ¦ãã£ã¼ãããã¯ã欲ããã
ä¸å®å®ãªE2Eãã¹ãã¨æ¦ãé¸æè¢ã¨ãã¦ãplaywright-ruby-clientããããï¼ã¨ããã®ãç¥ã£ã¦ããããã¨æããé座Rails#34ã§ç»å£ããã¦ããã£ãã
6/18(é)éå¬ã®é座Rails#34ãå ¬åæ ãã®2㯠@yi01imagination ãRailsã®system specããPlaywrightã使ããã«æ±ºã¾ãã¾ããï¼
— é座Rails (@GinzaRails) 2021å¹´5æ31æ¥
å¼ãç¶ãåå è åéä¸ã§ããhttps://t.co/AYgOj0R89c
ãªã¢ã¼ããªã®ã§ãTwitterãéãã¦ãããããåå¿ãã¿ããªãã®ã ãã©ãããããããªã®ãããã ããããã«ã¯èªç¥ãããããããªãããªããã¹ã©ã¤ãã®æå¾ã«ã¯æ¸ãã¦ããã ãã©ãå®éç¨ã§ã©ã®ãããã®å®åãããã®ãæªç¥æ°ãªã®ã§ãèªåãã¹ãéç¨ãã¦ã人ã«ã¯ãã²Playwrightå°å ¥ãã¦ã»ãããªw
ããã¦ããããã
JavaScriptçéã§ã¯Cypressãã¯ããã¨ãã¦ãåªç§ãªE2Eãã¹ããã¬ã¼ã ã¯ã¼ã¯ããã©ã¦ã¶èªåæä½ã©ã¤ãã©ãªãããããRubyã¯ã¨ããã¨ç¾å®çã«ã¯Seleniumãããªãã¿ãããªç¶æ³ããã£ã¨ç¶ãã¦ããã
ãã ãIEãã»ã¼æ» ãã ä»ã¨ãªã£ã¦ã¯Rubyã§ãPlaywrightã¯Seleniumã¨åæ§ã«ä½¿ã£ã¦ãããã¯ãã
ããããOSSéçºã¯ãã¦ããããããããSeleniumãå¯ä¸ç¡äºã®é¸æè¢ã¿ãããªç¶æ³ã«ã¯çµæ¢ç¬¦ãã¡ã«è¡ããããªã¨æã£ã¦ããããã°ããã¯ãå¸ææ´»åã®æ¯çãé«ãã¦ãããã¨æãã