{"id":701,"date":"2019-03-03T18:41:28","date_gmt":"2019-03-03T09:41:28","guid":{"rendered":"https:\/\/ito-u-oti.com\/?p=701"},"modified":"2019-03-07T16:23:38","modified_gmt":"2019-03-07T07:23:38","slug":"post-701","status":"publish","type":"post","link":"https:\/\/ito-u-oti.com\/?p=701","title":{"rendered":"\u3010Nightwatch.js\u3011\u30d5\u30a1\u30a4\u30eb\u9078\u629e\u30dc\u30bf\u30f3\u3067\u9078\u629e\u3055\u305b\u308b"},"content":{"rendered":"<h2 id=\"outline__1\">\u30d5\u30a1\u30a4\u30eb\u9078\u629e\u30dc\u30bf\u30f3\u3067\u9078\u629e\u3055\u305b\u308b<\/h2>\n<p>\u666e\u6bb5\u30d6\u30e9\u30a6\u30b6\u3067\u306e\u64cd\u4f5c\u306b\u304a\u3044\u3066\u306f\u30d5\u30a1\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u30dc\u30bf\u30f3\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u629e\u3059\u308b\u6642\u306b\u3001<br \/>\n\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3059\u308b\u3068\u30a8\u30af\u30b9\u30d7\u30ed\u30fc\u30e9\u30fc\u304c\u958b\u3044\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3059\u308b\u3088\u3046\u306b\u8a98\u5c0e\u3055\u308c\u307e\u3059\u3002<br \/>\nnightwatch\u3067\u306f\u30a8\u30af\u30b9\u30d7\u30ed\u30fc\u30e9\u30fc\u306e\u64cd\u4f5c\u306f\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u76f4\u63a5\u5024\u3092\u6e21\u3057\u3066\uff08setValue\uff09\u3042\u3052\u307e\u3059\u3002<\/p>\n<h2 id=\"outline__2\">\u30c6\u30b9\u30c8\u5bfe\u8c61\u753b\u9762<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/03\/nightwatch_fileselect.png\" alt=\"\" width=\"497\" height=\"89\" class=\"alignnone size-full wp-image-757\" \/><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html lang=&quot;ja&quot;&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=&quot;utf-8&quot;&gt;\r\n        &lt;title&gt;test fileSelect&lt;\/title&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;table width=&quot;100%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;2&quot; border=&quot;1&quot;&gt;\r\n            &lt;tbody&gt;\r\n                &lt;tr&gt;\r\n                    &lt;td colspan=&quot;1&quot;&gt;File select test&lt;\/td&gt;\r\n                &lt;\/tr&gt;\r\n                &lt;tr&gt;\r\n                    &lt;td&gt;\r\n                        &lt;input id=&quot;file_button&quot; type=&quot;file&quot; \/&gt;\r\n                    &lt;\/td&gt;\r\n                &lt;\/tr&gt;\r\n            &lt;\/tbody&gt;\r\n        &lt;\/table&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h2 id=\"outline__3\">\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nconst path = require('path');\r\n\r\nvar url = path.resolve(__dirname,&quot;fileSelectTest.html&quot;);\r\nvar file = path.resolve(__dirname,&quot;..\/file\/hoge.txt&quot;);\r\n\r\nmodule.exports = {\r\n\r\n  '@disabled': false,\r\n\r\n  'file selection' : function (client) {\r\n    client\r\n      .url(url)\r\n      .waitForElementPresent('body', 6000)\r\n      .pause(3000)\r\n      .useXpath()\r\n      .setValue('\/\/*&#x5B;@id=&quot;file_button&quot;]', file)\r\n      .pause(3000)\r\n      .end();\r\n  }\r\n};\r\n<\/pre>\n<h2 id=\"outline__4\">nightwatch.json<\/h2>\n<p>\u7279\u5225\u306a\u6307\u5b9a\u3068\u304b\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u666e\u901a\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{\r\n\t&quot;src_folders&quot;: &#x5B;\r\n\t\t&quot;tests&quot;\r\n\t],\r\n\t&quot;output_folder&quot;: &quot;reports&quot;,\r\n\t&quot;webdriver&quot;: {\r\n\t\t&quot;start_process&quot;: true,\r\n\t\t&quot;server_path&quot;: &quot;.\/lib\/chromedriver_2.45&quot;,\r\n\t\t&quot;cli_args&quot;: &#x5B;\r\n\t\t\t&quot;--verbose&quot;\r\n\t\t],\r\n\t\t&quot;port&quot;: 9515\r\n\t},\r\n\t&quot;test_settings&quot;: {\r\n\t\t&quot;default&quot;: {\r\n\t\t\t&quot;desiredCapabilities&quot;: {\r\n\t\t\t\t&quot;browserName&quot;: &quot;chrome&quot;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<h2 id=\"outline__5\">\u53c2\u8003<\/h2>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/25919673\/file-upload-testing-in-nightwatch-js\">File Upload Testing in Nightwatch.js<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d5\u30a1\u30a4\u30eb\u9078\u629e\u30dc\u30bf\u30f3\u3067\u9078\u629e\u3055\u305b\u308b \u666e\u6bb5\u30d6\u30e9\u30a6\u30b6\u3067\u306e\u64cd\u4f5c\u306b\u304a\u3044\u3066\u306f\u30d5\u30a1\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u30dc\u30bf\u30f3\u304b\u3089\u30d5\u30a1\u30a4\u30eb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":717,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[168],"tags":[176,169,177],"class_list":["post-701","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nightwatch-js","tag-file","tag-nightwatch-js","tag-upload"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=701"}],"version-history":[{"count":9,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/701\/revisions"}],"predecessor-version":[{"id":753,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/701\/revisions\/753"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/media\/717"}],"wp:attachment":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}