{"action":"created","comment":{"url":"https://api.github.com/repos/Skyscanner/backpack/pulls/comments/200291346","pull_request_review_id":134576065,"id":200291346,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDI5MTM0Ng==","diff_hunk":"@@ -0,0 +1,47 @@\n+/*\n+ * Backpack - Skyscanner's Design System\n+ *\n+ * Copyright 2018 Skyscanner Ltd\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+const EventEmitter = require('events');\n+const { cleanFileName } = require('./utils');\n+\n+const AndroidRecorder = require('./recorders/android-recorder');\n+const IOSRecorder = require('./recorders/ios-recorder');\n+\n+const Recorder =\n+  process.env.BPK_PLATFORM === 'android' ? AndroidRecorder : IOSRecorder;\n+\n+module.exports = storybookController => async (\n+  kind,\n+  story,\n+  basePath,\n+  testFuction,\n+) => {\n+  const videoName = cleanFileName(story, kind);\n+  const recorder = new Recorder(`${basePath}/${videoName}`, videoName);\n+  const testEmitter = new EventEmitter();\n+\n+  testEmitter.on('test:started', () => recorder.startRecording());\n+  testEmitter.on('test:ended', async () => {});\n+\n+  await storybookController.start();\n+  await storybookController.activateStory(kind, story);\n+\n+  await testFuction(testEmitter);\n+\n+  await recorder.finishRecording();\n+  await storybookController.done();\n+};","path":"native/e2e/record.js","position":47,"original_position":47,"commit_id":"971cc688ae18cda296397209cd8a167273725691","original_commit_id":"971cc688ae18cda296397209cd8a167273725691","user":{"login":"matteo-hertel","id":3579758,"node_id":"MDQ6VXNlcjM1Nzk3NTg=","avatar_url":"https://avatars0.githubusercontent.com/u/3579758?v=4","gravatar_id":"","url":"https://api.github.com/users/matteo-hertel","html_url":"https://github.com/matteo-hertel","followers_url":"https://api.github.com/users/matteo-hertel/followers","following_url":"https://api.github.com/users/matteo-hertel/following{/other_user}","gists_url":"https://api.github.com/users/matteo-hertel/gists{/gist_id}","starred_url":"https://api.github.com/users/matteo-hertel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matteo-hertel/subscriptions","organizations_url":"https://api.github.com/users/matteo-hertel/orgs","repos_url":"https://api.github.com/users/matteo-hertel/repos","events_url":"https://api.github.com/users/matteo-hertel/events{/privacy}","received_events_url":"https://api.github.com/users/matteo-hertel/received_events","type":"User","site_admin":false},"body":"Quick note, the two functions above cannot be excuted as callback to an event, the origin implementation was\r\n\r\n```\r\nestEmitter.on('test:ended', async () => {\r\n    await recorder.finishRecording();\r\n    await storybookController.done();\r\n});\r\n```\r\n\r\nbut the process exits before that is completed and the result is videos are not saving and the test command hangs forever, so I've moved it and (a)waiting for it to complete\r\n\r\nI'll remove the test ended in the next commit, for now it's just a reference ","created_at":"2018-07-05T09:39:10Z","updated_at":"2018-07-05T09:39:11Z","html_url":"https://github.com/Skyscanner/backpack/pull/898#discussion_r200291346","pull_request_url":"https://api.github.com/repos/Skyscanner/backpack/pulls/898","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Skyscanner/backpack/pulls/comments/200291346"},"html":{"href":"https://github.com/Skyscanner/backpack/pull/898#discussion_r200291346"},"pull_request":{"href":"https://api.github.com/repos/Skyscanner/backpack/pulls/898"}}},"pull_request":{"url":"https://api.github.com/repos/Skyscanner/backpack/pulls/898","id":199199659,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MTk5NjU5","html_url":"https://github.com/Skyscanner/backpack/pull/898","diff_url":"https://github.com/Skyscanner/backpack/pull/898.diff","patch_url":"https://github.com/Skyscanner/backpack/pull/898.patch","issue_url":"https://api.github.com/repos/Skyscanner/backpack/issues/898","number":898,"state":"open","locked":false,"title":"[BPK-1682] videos on docs site","user":{"login":"matteo-hertel","id":3579758,"node_id":"MDQ6VXNlcjM1Nzk3NTg=","avatar_url":"https://avatars0.githubusercontent.com/u/3579758?v=4","gravatar_id":"","url":"https://api.github.com/users/matteo-hertel","html_url":"https://github.com/matteo-hertel","followers_url":"https://api.github.com/users/matteo-hertel/followers","following_url":"https://api.github.com/users/matteo-hertel/following{/other_user}","gists_url":"https://api.github.com/users/matteo-hertel/gists{/gist_id}","starred_url":"https://api.github.com/users/matteo-hertel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matteo-hertel/subscriptions","organizations_url":"https://api.github.com/users/matteo-hertel/orgs","repos_url":"https://api.github.com/users/matteo-hertel/repos","events_url":"https://api.github.com/users/matteo-hertel/events{/privacy}","received_events_url":"https://api.github.com/users/matteo-hertel/received_events","type":"User","site_admin":false},"body":"The original card was to add the Alert component video on the docsite but given this PR will be quite big I don't want to add too much noise and have the focus around the important files.\r\n\r\nsome if not most of the code has been ~stolen~ borrowed from the PR we made at the designer offsite (https://github.com/Skyscanner/backpack/compare/story-control?expand=1).\r\n\r\nOne important thing to notice is the different platforms recorders, the iOS one is pretty straightforward and because I need the same API to work seemlessly on testing iOS and Android the android one has some code stolen from my repo https://github.com/matteo-hertel/android-commander/blob/master/src/platforms/android.js\r\n\r\n*Note* the `adb` cli is needed for the android recording to work, to check if you have it installed run\r\n`adb --version` if it fails, install the cli with `brew cask install android-platform-tools` (thanks @shaundon for spotting this)\r\n\r\nTo test this:\r\n\r\n- run `npm install` or `npm run clean && npm i` if you're brave or you need a ☕️\r\n  - FYI this will add `puppeteer` which is roughly 70MB \r\n- run the native storybook `npm run native`\r\n- run the detox as before `npm run detox:test:android` (or `npm run detox:test:ios` if you're into it)\r\n- everything should succeed and you should not see any kind of error\r\n\r\nonce the above is done, to further prove your awesomeness and thoroughly test the whole thing you can run from the root\r\n- `rm  native/packages/react-native-bpk-component-switch/videos/android/*` or `rm  native/packages/react-native-bpk-component-switch/videos/ios/*`\r\n- re-run the test above\r\n- the video files should be back in place\r\n\r\nThe docs site can be tested by running `npm run docs` and once that is done visit (http://0.0.0.0:8080/components/switch?platform=native)[http://0.0.0.0:8080/components/switch?platform=native]\r\n\r\none maim thing to notice is the usage of `sleep(time)` across the board, all the times are made up (trying to be sensible) and they can potentially be changed if needed  ","created_at":"2018-07-04T10:02:48Z","updated_at":"2018-07-05T09:39:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"615c0400b94a15005be29d9d431bb22c56858afe","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Skyscanner/backpack/pulls/898/commits","review_comments_url":"https://api.github.com/repos/Skyscanner/backpack/pulls/898/comments","review_comment_url":"https://api.github.com/repos/Skyscanner/backpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Skyscanner/backpack/issues/898/comments","statuses_url":"https://api.github.com/repos/Skyscanner/backpack/statuses/971cc688ae18cda296397209cd8a167273725691","head":{"label":"Skyscanner:BPK-1682-videos-on-docs-site","ref":"BPK-1682-videos-on-docs-site","sha":"971cc688ae18cda296397209cd8a167273725691","user":{"login":"Skyscanner","id":522811,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyMjgxMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/522811?v=4","gravatar_id":"","url":"https://api.github.com/users/Skyscanner","html_url":"https://github.com/Skyscanner","followers_url":"https://api.github.com/users/Skyscanner/followers","following_url":"https://api.github.com/users/Skyscanner/following{/other_user}","gists_url":"https://api.github.com/users/Skyscanner/gists{/gist_id}","starred_url":"https://api.github.com/users/Skyscanner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Skyscanner/subscriptions","organizations_url":"https://api.github.com/users/Skyscanner/orgs","repos_url":"https://api.github.com/users/Skyscanner/repos","events_url":"https://api.github.com/users/Skyscanner/events{/privacy}","received_events_url":"https://api.github.com/users/Skyscanner/received_events","type":"Organization","site_admin":false},"repo":{"id":85820377,"node_id":"MDEwOlJlcG9zaXRvcnk4NTgyMDM3Nw==","name":"backpack","full_name":"Skyscanner/backpack","owner":{"login":"Skyscanner","id":522811,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyMjgxMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/522811?v=4","gravatar_id":"","url":"https://api.github.com/users/Skyscanner","html_url":"https://github.com/Skyscanner","followers_url":"https://api.github.com/users/Skyscanner/followers","following_url":"https://api.github.com/users/Skyscanner/following{/other_user}","gists_url":"https://api.github.com/users/Skyscanner/gists{/gist_id}","starred_url":"https://api.github.com/users/Skyscanner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Skyscanner/subscriptions","organizations_url":"https://api.github.com/users/Skyscanner/orgs","repos_url":"https://api.github.com/users/Skyscanner/repos","events_url":"https://api.github.com/users/Skyscanner/events{/privacy}","received_events_url":"https://api.github.com/users/Skyscanner/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Skyscanner/backpack","description":"Backpack Design System","fork":false,"url":"https://api.github.com/repos/Skyscanner/backpack","forks_url":"https://api.github.com/repos/Skyscanner/backpack/forks","keys_url":"https://api.github.com/repos/Skyscanner/backpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Skyscanner/backpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Skyscanner/backpack/teams","hooks_url":"https://api.github.com/repos/Skyscanner/backpack/hooks","issue_events_url":"https://api.github.com/repos/Skyscanner/backpack/issues/events{/number}","events_url":"https://api.github.com/repos/Skyscanner/backpack/events","assignees_url":"https://api.github.com/repos/Skyscanner/backpack/assignees{/user}","branches_url":"https://api.github.com/repos/Skyscanner/backpack/branches{/branch}","tags_url":"https://api.github.com/repos/Skyscanner/backpack/tags","blobs_url":"https://api.github.com/repos/Skyscanner/backpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Skyscanner/backpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Skyscanner/backpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Skyscanner/backpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Skyscanner/backpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Skyscanner/backpack/languages","stargazers_url":"https://api.github.com/repos/Skyscanner/backpack/stargazers","contributors_url":"https://api.github.com/repos/Skyscanner/backpack/contributors","subscribers_url":"https://api.github.com/repos/Skyscanner/backpack/subscribers","subscription_url":"https://api.github.com/repos/Skyscanner/backpack/subscription","commits_url":"https://api.github.com/repos/Skyscanner/backpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Skyscanner/backpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Skyscanner/backpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Skyscanner/backpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Skyscanner/backpack/contents/{+path}","compare_url":"https://api.github.com/repos/Skyscanner/backpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Skyscanner/backpack/merges","archive_url":"https://api.github.com/repos/Skyscanner/backpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Skyscanner/backpack/downloads","issues_url":"https://api.github.com/repos/Skyscanner/backpack/issues{/number}","pulls_url":"https://api.github.com/repos/Skyscanner/backpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Skyscanner/backpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Skyscanner/backpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Skyscanner/backpack/labels{/name}","releases_url":"https://api.github.com/repos/Skyscanner/backpack/releases{/id}","deployments_url":"https://api.github.com/repos/Skyscanner/backpack/deployments","created_at":"2017-03-22T11:34:41Z","updated_at":"2018-07-05T09:14:49Z","pushed_at":"2018-07-05T09:32:07Z","git_url":"git://github.com/Skyscanner/backpack.git","ssh_url":"git@github.com:Skyscanner/backpack.git","clone_url":"https://github.com/Skyscanner/backpack.git","svn_url":"https://github.com/Skyscanner/backpack","homepage":"https://backpack.github.io","size":74952,"stargazers_count":165,"watchers_count":165,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":57,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":57,"open_issues":13,"watchers":165,"default_branch":"master"}},"base":{"label":"Skyscanner:master","ref":"master","sha":"8f51c996574332274f74e422bd87c2c80dac1737","user":{"login":"Skyscanner","id":522811,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyMjgxMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/522811?v=4","gravatar_id":"","url":"https://api.github.com/users/Skyscanner","html_url":"https://github.com/Skyscanner","followers_url":"https://api.github.com/users/Skyscanner/followers","following_url":"https://api.github.com/users/Skyscanner/following{/other_user}","gists_url":"https://api.github.com/users/Skyscanner/gists{/gist_id}","starred_url":"https://api.github.com/users/Skyscanner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Skyscanner/subscriptions","organizations_url":"https://api.github.com/users/Skyscanner/orgs","repos_url":"https://api.github.com/users/Skyscanner/repos","events_url":"https://api.github.com/users/Skyscanner/events{/privacy}","received_events_url":"https://api.github.com/users/Skyscanner/received_events","type":"Organization","site_admin":false},"repo":{"id":85820377,"node_id":"MDEwOlJlcG9zaXRvcnk4NTgyMDM3Nw==","name":"backpack","full_name":"Skyscanner/backpack","owner":{"login":"Skyscanner","id":522811,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyMjgxMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/522811?v=4","gravatar_id":"","url":"https://api.github.com/users/Skyscanner","html_url":"https://github.com/Skyscanner","followers_url":"https://api.github.com/users/Skyscanner/followers","following_url":"https://api.github.com/users/Skyscanner/following{/other_user}","gists_url":"https://api.github.com/users/Skyscanner/gists{/gist_id}","starred_url":"https://api.github.com/users/Skyscanner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Skyscanner/subscriptions","organizations_url":"https://api.github.com/users/Skyscanner/orgs","repos_url":"https://api.github.com/users/Skyscanner/repos","events_url":"https://api.github.com/users/Skyscanner/events{/privacy}","received_events_url":"https://api.github.com/users/Skyscanner/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Skyscanner/backpack","description":"Backpack Design System","fork":false,"url":"https://api.github.com/repos/Skyscanner/backpack","forks_url":"https://api.github.com/repos/Skyscanner/backpack/forks","keys_url":"https://api.github.com/repos/Skyscanner/backpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Skyscanner/backpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Skyscanner/backpack/teams","hooks_url":"https://api.github.com/repos/Skyscanner/backpack/hooks","issue_events_url":"https://api.github.com/repos/Skyscanner/backpack/issues/events{/number}","events_url":"https://api.github.com/repos/Skyscanner/backpack/events","assignees_url":"https://api.github.com/repos/Skyscanner/backpack/assignees{/user}","branches_url":"https://api.github.com/repos/Skyscanner/backpack/branches{/branch}","tags_url":"https://api.github.com/repos/Skyscanner/backpack/tags","blobs_url":"https://api.github.com/repos/Skyscanner/backpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Skyscanner/backpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Skyscanner/backpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Skyscanner/backpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Skyscanner/backpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Skyscanner/backpack/languages","stargazers_url":"https://api.github.com/repos/Skyscanner/backpack/stargazers","contributors_url":"https://api.github.com/repos/Skyscanner/backpack/contributors","subscribers_url":"https://api.github.com/repos/Skyscanner/backpack/subscribers","subscription_url":"https://api.github.com/repos/Skyscanner/backpack/subscription","commits_url":"https://api.github.com/repos/Skyscanner/backpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Skyscanner/backpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Skyscanner/backpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Skyscanner/backpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Skyscanner/backpack/contents/{+path}","compare_url":"https://api.github.com/repos/Skyscanner/backpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Skyscanner/backpack/merges","archive_url":"https://api.github.com/repos/Skyscanner/backpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Skyscanner/backpack/downloads","issues_url":"https://api.github.com/repos/Skyscanner/backpack/issues{/number}","pulls_url":"https://api.github.com/repos/Skyscanner/backpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Skyscanner/backpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Skyscanner/backpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Skyscanner/backpack/labels{/name}","releases_url":"https://api.github.com/repos/Skyscanner/backpack/releases{/id}","deployments_url":"https://api.github.com/repos/Skyscanner/backpack/deployments","created_at":"2017-03-22T11:34:41Z","updated_at":"2018-07-05T09:14:49Z","pushed_at":"2018-07-05T09:32:07Z","git_url":"git://github.com/Skyscanner/backpack.git","ssh_url":"git@github.com:Skyscanner/backpack.git","clone_url":"https://github.com/Skyscanner/backpack.git","svn_url":"https://github.com/Skyscanner/backpack","homepage":"https://backpack.github.io","size":74952,"stargazers_count":165,"watchers_count":165,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":57,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":57,"open_issues":13,"watchers":165,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Skyscanner/backpack/pulls/898"},"html":{"href":"https://github.com/Skyscanner/backpack/pull/898"},"issue":{"href":"https://api.github.com/repos/Skyscanner/backpack/issues/898"},"comments":{"href":"https://api.github.com/repos/Skyscanner/backpack/issues/898/comments"},"review_comments":{"href":"https://api.github.com/repos/Skyscanner/backpack/pulls/898/comments"},"review_comment":{"href":"https://api.github.com/repos/Skyscanner/backpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Skyscanner/backpack/pulls/898/commits"},"statuses":{"href":"https://api.github.com/repos/Skyscanner/backpack/statuses/971cc688ae18cda296397209cd8a167273725691"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"matteo-hertel"}}