{"id":10969,"date":"2017-06-12T15:00:01","date_gmt":"2017-06-12T06:00:01","guid":{"rendered":"http:\/\/sitest.jp\/blog\/?p=10969"},"modified":"2017-06-12T10:16:32","modified_gmt":"2017-06-12T01:16:32","slug":"e2e%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e3%83%96%e3%83%a9%e3%82%a6%e3%82%b6%e3%81%af%e3%81%93%e3%82%8c%e3%81%a7%e6%b1%ba%e3%81%be%e3%82%8a%ef%bc%81%e3%83%98%e3%83%83%e3%83%89%e3%83%ac%e3%82%b9-chrome","status":"publish","type":"post","link":"https:\/\/sitest.jp\/blog\/?p=10969","title":{"rendered":"E2E\u30c6\u30b9\u30c8\u306e\u30d6\u30e9\u30a6\u30b6\u306f\u3053\u308c\u3067\u6c7a\u307e\u308a\uff01\u30d8\u30c3\u30c9\u30ec\u30b9 Chrome \u3092\u4f7f\u3063\u3066\u307f\u3088\u3046"},"content":{"rendered":"<p>\u307f\u306a\u3055\u3093\u306f E2E \u30c6\u30b9\u30c8\u3067\u3069\u306e\u3088\u3046\u306a\u30d6\u30e9\u30a6\u30b6\u3092\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u304b\uff1f<\/p>\n<p>\u591a\u304f\u306e\u65b9\u306f\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067 E2E \u30c6\u30b9\u30c8\u3092\u8d70\u3089\u305b\u3066\u3044\u308b\u3053\u3068\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u30b5\u30fc\u30d0\u30fc\u3067 E2E \u30c6\u30b9\u30c8\u3092\u8d70\u3089\u305b\u308b\u305f\u3081\u306b\u306f\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u304c\u3001\u73fe\u72b6\u306e\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u306f\u6700\u65b0\u306e\u30d6\u30e9\u30a6\u30b6\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306b\u8ffd\u3044\u3064\u304f\u3053\u3068\u304c\u51fa\u6765\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u3093\u306a\u4e2d\u3001Google Chrome 59 \u304b\u3089\u5f85\u671b\u306e\u30d8\u30c3\u30c9\u30ec\u30b9\u30e2\u30fc\u30c9\u304c\u5b9f\u88c5\u3055\u308c\u307e\u3057\u305f\uff01<br \/>\n\u4eca\u56de\u306f Node.js \u304b\u3089\u30d8\u30c3\u30c9\u30ec\u30b9\u30e2\u30fc\u30c9\u306e Chrome \u3092\u64cd\u4f5c\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\uff01<\/p>\n<p><!--more--><\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u305d\u3082\u305d\u3082 E2E \u30c6\u30b9\u30c8\u3068\u306f\uff1f<\/h3>\n<\/div>\n<p>E2E\uff08End to end\uff09\u30c6\u30b9\u30c8\u3068\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u5074\u306e UI \u3084 Ajax \u901a\u4fe1\u3092\u542b\u3081\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5168\u4f53\u3092\u901a\u3057\u305f\u30c6\u30b9\u30c8\u3067\u3059\u3002<br \/>\nSelenium \u306a\u3069\u306e\u30c6\u30b9\u30c8\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u30d6\u30e9\u30a6\u30b6\u3092\u81ea\u52d5\u64cd\u4f5c\u3057\u3001<br \/>\n\u30da\u30fc\u30b8\u9077\u79fb\u3084\u30da\u30fc\u30b8\u64cd\u4f5c\u3092\u30b3\u30fc\u30c9\u3067\u8a18\u8ff0\u3057\u30c6\u30b9\u30c8\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3057\u3001Selenium \u306a\u3069\u306e\u30c6\u30b9\u30c8\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306f\u3001\u5b9f\u969b\u306b\u30d6\u30e9\u30a6\u30b6\u3092\u8d77\u52d5\u3057\u3066\u30c6\u30b9\u30c8\u3092\u884c\u3046\u305f\u3081\u3001\u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30d6\u30e9\u30a6\u30b6\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30b5\u30fc\u30d0\u30fc\u3067\u3082 E2E \u30c6\u30b9\u30c8\u3092\u884c\u3046\u305f\u3081\u306b\u306f\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u3068\u3088\u3070\u308c\u308b\u30d6\u30e9\u30a6\u30b6\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u306fGUI\u304c\u5b58\u5728\u305b\u305a\u3001\u30b3\u30de\u30f3\u30c9\u3068\u3057\u3066\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3069\u306e\u3088\u3046\u306a\u74b0\u5883\u3067\u3082\u52d5\u4f5c\u3055\u305b\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br \/>\n\u6709\u540d\u306a\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u3068\u3057\u3066\u306f\u300c<a target=\"_blank\" rel=\"nofollow\" href=\"http:\/\/phantomjs.org\/\">PhantomJS<\/a>\u300d\u3068\u547c\u3070\u308c\u308b\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3001\u983b\u7e41\u306b\u884c\u308f\u308c\u308b\u30e2\u30c0\u30f3\u30d6\u30e9\u30a6\u30b6\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306b\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u304c\u8ffd\u3044\u3064\u304f\u3053\u3068\u304c\u3067\u304d\u305a\u3001\u306a\u304b\u306a\u304b\u96e3\u3057\u3044\u72b6\u6cc1\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3093\u306a\u4e2d\u3001\u30d8\u30c3\u30c9\u30ec\u30b9\u30e2\u30fc\u30c9\u304c\u5b9f\u88c5\u3055\u308c\u305f Google Chrome \u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u305f\u3053\u3068\u306b\u3088\u308a\u3001\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u6700\u65b0\u306b\u8fd1\u3044\u72b6\u614b\u306e\u30d6\u30e9\u30a6\u30b6\u30a8\u30f3\u30b8\u30f3\u3092\u4f7f\u7528\u3057 E2E \u30c6\u30b9\u30c8\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30d8\u30c3\u30c9\u30ec\u30b9\u30e2\u30fc\u30c9\u306e Chrome \u3092\u4f7f\u3063\u3066\u307f\u3088\u3046<\/h3>\n<\/div>\n<p>\u305d\u308c\u3067\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u30d8\u30c3\u30c9\u30ec\u30b9\u30e2\u30fc\u30c9\u306e Chrome \u3092\u4f7f\u7528\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff01<\/p>\n<p>\u307e\u305a\u306f\u3001<code>chrome<\/code> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u8cbc\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><code>alias chrome=\"\/Applications\/Google\\ Chrome.app\/Contents\/MacOS\/Google\\ Chrome\"<\/code><\/pre>\n<p><code>chrome<\/code> \u30b3\u30de\u30f3\u30c9\u3067 SiTest \u306e\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u3092\u64ae\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre><code>chrome --headless --disable-gpu --screenshot https:\/\/sitest.jp<\/code><\/pre>\n<p><a href=\"https:\/\/storage.googleapis.com\/sitest-wp\/blog\/wp-content\/uploads\/2017\/06\/screenshot.png\"><img loading=\"lazy\" src=\"https:\/\/storage.googleapis.com\/sitest-wp\/blog\/wp-content\/uploads\/2017\/06\/screenshot.png\" alt=\"\" width=\"1200\" height=\"1000\" class=\"alignnone size-full wp-image-10998\" \/><\/a><\/p>\n<p>\u4ed6\u306b\u3082 PDF \u3092\u4f5c\u6210\u3057\u305f\u308a\u3001<code>document.body.innerHTML<\/code> \u306e\u4e2d\u8eab\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b\u30d5\u30e9\u30b0\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u3067\u4f7f\u7528\u3067\u304d\u308b\u30d5\u30e9\u30b0\u30aa\u30d7\u30b7\u30e7\u30f3\u306f <a target=\"_blank\" rel=\"nofollow\" href=\"https:\/\/cs.chromium.org\/chromium\/src\/headless\/app\/headless_shell_switches.cc\">headless_shell_switches.cc &#8211; chromium<\/a> \u304b\u3089\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">Node.js \u304b\u3089\u64cd\u4f5c\u3057\u3066\u307f\u3088\u3046<\/h3>\n<\/div>\n<p>\u30d8\u30c3\u30c9\u30ec\u30b9\u30e2\u30fc\u30c9\u306e Chrome \u306f Node.js \u3067\u5236\u5fa1\u3059\u308b\u3053\u3068\u3082\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u5148\u307b\u3069\u306e\u30b3\u30de\u30f3\u30c9\u3068\u540c\u3058\u3088\u3046\u306a\u64cd\u4f5c\u3092 Node.js \u3067\u3084\u3063\u3066\u307f\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3044\u3084\u3059\u3044\u3088\u3046\u306b\u3057\u305f <a target=\"_blank\" rel=\"nofollow\" href=\"https:\/\/github.com\/OnetapInc\/chromy\">OnetapInc\/chromy<\/a> \u3068\u3044\u3046\u30e9\u30c3\u30d1\u30fc\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"es6\">const Chromy = require(\"chromy\")\nconst fs = require(\"fs\")\n\nasync function main() {\n  let driver = new Chromy({\n    additionalChromeFlags: [\"--window-size=1200,1000\"]\n  })\n  await driver.goto(\"https:\/\/sitest.jp\")\n  const capture = await driver.screenshot()\n  fs.writeFileSync(\".\/tmp\/capture.png\", capture)\n  await driver.close()\n}\n\nmain()\n<\/code><\/pre>\n<p>\u305f\u3063\u305f\u3053\u308c\u3060\u3051\u3067\u30ad\u30e3\u30d7\u30c1\u30e3\u3092\u64ae\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3057\u305f\u3002<br \/>\nGithub \u306b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u30a2\u30c3\u30d7\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u8a73\u3057\u3044\u69cb\u6210\u306f<a target=\"_blank\" rel=\"nofollow\" href=\"https:\/\/github.com\/glad-cube\/headless-chrome-sample\">\u3053\u3061\u3089<\/a>\u3092\u3054\u78ba\u8a8d\u4e0b\u3055\u3044\u3002<\/p>\n<p><code>chromy<\/code> \u306f\u6709\u5fd7\u306e\u65b9\u304c\u4f5c\u6210\u3055\u308c\u305f\u30e9\u30c3\u30d1\u30fc\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u305f\u3081\u3001<br \/>\n\u3082\u3063\u3068\u3044\u308d\u3044\u308d\u306a <a target=\"_blank\" rel=\"nofollow\" href=\"https:\/\/chromedevtools.github.io\/devtools-protocol\/\">DevTools Protocol<\/a> \u3092\u89e6\u308a\u305f\u3044\u65b9\u306f\u3001 <a target=\"_blank\" rel=\"nofollow\" href=\"https:\/\/github.com\/cyrus-and\/chrome-remote-interface\/\">chrome-remote-interface<\/a> \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3082\u3063\u3068\u591a\u304f\u306e\u64cd\u4f5c\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p><code>mocha<\/code> \u306a\u3069\u306e\u30c6\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001<br \/>\n\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u306e E2E \u30c6\u30b9\u30c8\u3092\u5b9f\u73fe\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u307e\u3068\u3081<\/h3>\n<\/div>\n<p>\u30d8\u30c3\u30c9\u30ec\u30b9\u30e2\u30fc\u30c9\u306e Chrome \u306f\u307e\u3060\u5b89\u5b9a\u7248\u306b\u5b9f\u88c5\u3055\u308c\u305f\u3070\u304b\u308a\u306a\u306e\u3067\u3001<br \/>\n\u3084\u306f\u308a\u3082\u3068\u304b\u3089\u3042\u308b\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u3088\u308a\u51fa\u6765\u308b\u3053\u3068\u306f\u9650\u3089\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\uff08\u305d\u308c\u3067\u3082\u3084\u308a\u305f\u3044\u4e8b\u306e\u5927\u534a\u306f\u5b9f\u73fe\u3067\u304d\u307e\u3059\u304c\u30fb\u30fb\u30fb\uff09<\/p>\n<p>\u305d\u308c\u3067\u3082\u6700\u65b0\u306e\u30e2\u30c0\u30f3\u30d6\u30e9\u30a6\u30b6\u3092\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067 E2E \u30c6\u30b9\u30c8\u304c\u5b9f\u65bd\u3067\u304d\u308b\u3068\u3044\u3046\u5229\u70b9\u306f\u3068\u3066\u3082\u5927\u304d\u3044\u3068\u611f\u3058\u307e\u3059\u3002<br \/>\nJenkins \u306a\u3069\u306e CI \u30c4\u30fc\u30eb\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u30d7\u30eb\u30ea\u30af\u30a8\u30b9\u30c8\u4f5c\u6210\u3057\u305f\u6bb5\u968e\u3067 E2E \u30c6\u30b9\u30c8\u3092\u81ea\u52d5\u7684\u306b\u8d70\u3089\u305b\u308b\u3001\u306a\u3093\u3066\u3053\u3068\u3082\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<br \/>\n\u4eca\u5f8c\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u304c\u697d\u3057\u307f\u3067\u3059\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u307f\u306a\u3055\u3093\u306f E2E \u30c6\u30b9\u30c8\u3067\u3069\u306e\u3088\u3046\u306a\u30d6\u30e9\u30a6\u30b6\u3092\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u304b\uff1f \u591a\u304f\u306e\u65b9\u306f\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067 E2E \u30c6\u30b9\u30c8\u3092\u8d70\u3089\u305b\u3066\u3044\u308b\u3053\u3068\u3068\u601d\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u3067 E2E \u30c6\u30b9\u30c8\u3092\u8d70\u3089\u305b\u308b\u305f\u3081\u306b\u306f\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u304c\u3001\u73fe\u72b6\u306e\u30d8\u30c3\u30c9\u30ec\u30b9\u30d6\u30e9\u30a6\u30b6\u306f\u6700\u65b0\u306e\u30d6\u30e9\u30a6\u30b6\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306b\u8ffd\u3044\u3064\u304f\u3053\u3068\u304c\u51fa\u6765\u3066\u3044\u307e\u305b\u3093\u3002 \u305d\u3093\u306a\u4e2d\u3001Google Chrome 59 \u304b\u3089\u5f85\u671b\u306e\u30d8\u30c3\u30c9\u30ec\u30b9\u30e2\u30fc\u30c9\u304c\u5b9f\u88c5\u3055\u308c\u307e\u3057\u305f\uff01  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11022,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[37,27],"tags":[],"acf":false,"_links":{"self":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/10969"}],"collection":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/comments?post=10969"}],"version-history":[{"count":5,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/10969\/revisions"}],"predecessor-version":[{"id":12177,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/10969\/revisions\/12177"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media\/11022"}],"wp:attachment":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media?parent=10969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/categories?post=10969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/tags?post=10969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}