{"action":"created","comment":{"url":"https://api.github.com/repos/MobileWorks/summa-test/pulls/comments/56051996","id":56051996,"diff_hunk":"@@ -157,36 +158,60 @@ def get_protractor_params(self):\n         }\n \n \n-def discover_protractor_dirs():\n-    return os.listdir('./{}'.format(BASE_TEST_DIR))\n-\n-\n def element_explorer_test(self):\n     print \"Pausing for element explorer... \"\n     print \"Relevant params:\\n{}\".format(pformat(self.get_protractor_params()))\n     subprocess.call(\"protractor --elementExplorer\", shell=True)\n \n \n+# Optional TODO: This method can be refactored to use os.walk.\n+def find_directories(path, base=\"\"):\n+    cwd = os.path.join(base, path)\n+\n+    if not cwd or not os.path.isdir(cwd):\n+        return []\n+\n+    dirs = [d for d in os.listdir(cwd) if os.path.isdir(os.path.join(cwd, d))]\n+    dirs = filter(lambda d: len(os.listdir(os.path.join(cwd, d))) > 0, dirs)\n+    results = [cwd]\n+\n+    if len(dirs) > 0:\n+        for dir in map(lambda d: find_directories(d, cwd), dirs):\n+            results += filter(lambda d: d, dir)\n+\n+    return results\n+\n+\n def get_test_methods(test_class):\n     if ELEMENT_EXPLORER:  # don't run tests if elementExplorer flag was passed\n         setattr(test_class, 'test_fake', element_explorer_test)\n-    else:\n-        dirs = discover_protractor_dirs()\n-        dirs_from_env = os.environ.get('TEST_SPEC_DIRS')  # comma separated list\n-        if dirs_from_env:\n-            dirs_from_env = dirs_from_env.replace(' ', '').split(',')\n-            for dir in dirs_from_env:\n-                if not dir in dirs:\n-                    raise Exception(\"Looks like you passed an invalid spec directory <{}>. \"\n-                                    \"The available options are {}\".format(dir, dirs))\n-            print \"Heads up: We're running only these specs (read from $TEST_SPEC_DIRS):\"\n-            for dir in dirs_from_env:\n-                print \"- \", dir\n-            dirs = dirs_from_env\n-\n-        # Create one test method on the TestCase class for each directory of Protractor tests\n-        for dir in dirs:\n-            specs = ['{}{}/*.spec.js'.format(BASE_TEST_DIR, dir), ]\n-            def test_method(specs):\n-                return lambda self: self.run_protractor_with_specs(specs)\n-            setattr(test_class, 'test_{}'.format(dir), test_method(specs))\n+        return\n+\n+    dirs = base_dirs = find_directories(BASE_TEST_DIR)\n+    env_dirs = (os.environ.get('TEST_SPEC_DIRS') or \"\").replace(' ', '').split(',')\n+    env_dirs = filter(lambda d: d, env_dirs)\n+\n+    if len(env_dirs) is not 0:","path":"integration_tests.py","position":72,"original_position":72,"commit_id":"e5a92a7499863b690ae20efb81eb9f86556bbe0a","original_commit_id":"e5a92a7499863b690ae20efb81eb9f86556bbe0a","user":{"login":"aschriner","id":5503560,"avatar_url":"https://avatars.githubusercontent.com/u/5503560?v=3","gravatar_id":"","url":"https://api.github.com/users/aschriner","html_url":"https://github.com/aschriner","followers_url":"https://api.github.com/users/aschriner/followers","following_url":"https://api.github.com/users/aschriner/following{/other_user}","gists_url":"https://api.github.com/users/aschriner/gists{/gist_id}","starred_url":"https://api.github.com/users/aschriner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschriner/subscriptions","organizations_url":"https://api.github.com/users/aschriner/orgs","repos_url":"https://api.github.com/users/aschriner/repos","events_url":"https://api.github.com/users/aschriner/events{/privacy}","received_events_url":"https://api.github.com/users/aschriner/received_events","type":"User","site_admin":false},"body":"one more thing i noticed here which is just a python niggle... you should probably be testing equality, not same-object-ness.  i.e. `len(foo) == 0` (subtly different than comparing to the object)","created_at":"2016-03-14T18:33:11Z","updated_at":"2016-03-14T18:33:11Z","html_url":"https://github.com/MobileWorks/summa-test/pull/7#discussion_r56051996","pull_request_url":"https://api.github.com/repos/MobileWorks/summa-test/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/MobileWorks/summa-test/pulls/comments/56051996"},"html":{"href":"https://github.com/MobileWorks/summa-test/pull/7#discussion_r56051996"},"pull_request":{"href":"https://api.github.com/repos/MobileWorks/summa-test/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/MobileWorks/summa-test/pulls/7","id":61328126,"html_url":"https://github.com/MobileWorks/summa-test/pull/7","diff_url":"https://github.com/MobileWorks/summa-test/pull/7.diff","patch_url":"https://github.com/MobileWorks/summa-test/pull/7.patch","issue_url":"https://api.github.com/repos/MobileWorks/summa-test/issues/7","number":7,"state":"closed","locked":false,"title":"Test directory resolution","user":{"login":"divmgl","id":5452298,"avatar_url":"https://avatars.githubusercontent.com/u/5452298?v=3","gravatar_id":"","url":"https://api.github.com/users/divmgl","html_url":"https://github.com/divmgl","followers_url":"https://api.github.com/users/divmgl/followers","following_url":"https://api.github.com/users/divmgl/following{/other_user}","gists_url":"https://api.github.com/users/divmgl/gists{/gist_id}","starred_url":"https://api.github.com/users/divmgl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divmgl/subscriptions","organizations_url":"https://api.github.com/users/divmgl/orgs","repos_url":"https://api.github.com/users/divmgl/repos","events_url":"https://api.github.com/users/divmgl/events{/privacy}","received_events_url":"https://api.github.com/users/divmgl/received_events","type":"User","site_admin":false},"body":"In order for `test.sh` to work, it required a subdirectory with tests to be placed within `testing/e2e`. For instance:\r\n\r\n```\r\n.\r\n├── conf.js\r\n├── e2e\r\n│   └── 01-base\r\n│       ├── 01-base-expectations.spec.js\r\n│       ├── 02-create-user.spec.js\r\n│       └── 03-submit-form.spec.js\r\n├── helpers.js\r\n├── params.js\r\n├── test_ui.py\r\n└── test_ui.pyc\r\n```\r\n\r\nAdditionally, tests in subdirectories are ignored. This pull request recursively traverses `testing/e2e`, picks up `*.spec.js` files in the base directory, as well as all subdirectories. It also grabs subdirectories in paths exported by `TEST_SPEC_DIRS`.\r\n\r\n**This needs to be tested with MailGenius and Dashboard.**","created_at":"2016-03-01T23:39:32Z","updated_at":"2016-03-14T18:33:11Z","closed_at":"2016-03-14T18:30:56Z","merged_at":"2016-03-14T18:30:56Z","merge_commit_sha":"46a302708db53a22b6a2ae8b8a37e4a602778e3c","assignee":{"login":"aschriner","id":5503560,"avatar_url":"https://avatars.githubusercontent.com/u/5503560?v=3","gravatar_id":"","url":"https://api.github.com/users/aschriner","html_url":"https://github.com/aschriner","followers_url":"https://api.github.com/users/aschriner/followers","following_url":"https://api.github.com/users/aschriner/following{/other_user}","gists_url":"https://api.github.com/users/aschriner/gists{/gist_id}","starred_url":"https://api.github.com/users/aschriner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschriner/subscriptions","organizations_url":"https://api.github.com/users/aschriner/orgs","repos_url":"https://api.github.com/users/aschriner/repos","events_url":"https://api.github.com/users/aschriner/events{/privacy}","received_events_url":"https://api.github.com/users/aschriner/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/MobileWorks/summa-test/pulls/7/commits","review_comments_url":"https://api.github.com/repos/MobileWorks/summa-test/pulls/7/comments","review_comment_url":"https://api.github.com/repos/MobileWorks/summa-test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MobileWorks/summa-test/issues/7/comments","statuses_url":"https://api.github.com/repos/MobileWorks/summa-test/statuses/e5a92a7499863b690ae20efb81eb9f86556bbe0a","head":{"label":"MobileWorks:dir-resolve","ref":"dir-resolve","sha":"e5a92a7499863b690ae20efb81eb9f86556bbe0a","user":{"login":"MobileWorks","id":796558,"avatar_url":"https://avatars.githubusercontent.com/u/796558?v=3","gravatar_id":"","url":"https://api.github.com/users/MobileWorks","html_url":"https://github.com/MobileWorks","followers_url":"https://api.github.com/users/MobileWorks/followers","following_url":"https://api.github.com/users/MobileWorks/following{/other_user}","gists_url":"https://api.github.com/users/MobileWorks/gists{/gist_id}","starred_url":"https://api.github.com/users/MobileWorks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobileWorks/subscriptions","organizations_url":"https://api.github.com/users/MobileWorks/orgs","repos_url":"https://api.github.com/users/MobileWorks/repos","events_url":"https://api.github.com/users/MobileWorks/events{/privacy}","received_events_url":"https://api.github.com/users/MobileWorks/received_events","type":"Organization","site_admin":false},"repo":{"id":43785787,"name":"summa-test","full_name":"MobileWorks/summa-test","owner":{"login":"MobileWorks","id":796558,"avatar_url":"https://avatars.githubusercontent.com/u/796558?v=3","gravatar_id":"","url":"https://api.github.com/users/MobileWorks","html_url":"https://github.com/MobileWorks","followers_url":"https://api.github.com/users/MobileWorks/followers","following_url":"https://api.github.com/users/MobileWorks/following{/other_user}","gists_url":"https://api.github.com/users/MobileWorks/gists{/gist_id}","starred_url":"https://api.github.com/users/MobileWorks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobileWorks/subscriptions","organizations_url":"https://api.github.com/users/MobileWorks/orgs","repos_url":"https://api.github.com/users/MobileWorks/repos","events_url":"https://api.github.com/users/MobileWorks/events{/privacy}","received_events_url":"https://api.github.com/users/MobileWorks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MobileWorks/summa-test","description":"Integration test framework for LG apps","fork":false,"url":"https://api.github.com/repos/MobileWorks/summa-test","forks_url":"https://api.github.com/repos/MobileWorks/summa-test/forks","keys_url":"https://api.github.com/repos/MobileWorks/summa-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MobileWorks/summa-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MobileWorks/summa-test/teams","hooks_url":"https://api.github.com/repos/MobileWorks/summa-test/hooks","issue_events_url":"https://api.github.com/repos/MobileWorks/summa-test/issues/events{/number}","events_url":"https://api.github.com/repos/MobileWorks/summa-test/events","assignees_url":"https://api.github.com/repos/MobileWorks/summa-test/assignees{/user}","branches_url":"https://api.github.com/repos/MobileWorks/summa-test/branches{/branch}","tags_url":"https://api.github.com/repos/MobileWorks/summa-test/tags","blobs_url":"https://api.github.com/repos/MobileWorks/summa-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MobileWorks/summa-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MobileWorks/summa-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/MobileWorks/summa-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MobileWorks/summa-test/statuses/{sha}","languages_url":"https://api.github.com/repos/MobileWorks/summa-test/languages","stargazers_url":"https://api.github.com/repos/MobileWorks/summa-test/stargazers","contributors_url":"https://api.github.com/repos/MobileWorks/summa-test/contributors","subscribers_url":"https://api.github.com/repos/MobileWorks/summa-test/subscribers","subscription_url":"https://api.github.com/repos/MobileWorks/summa-test/subscription","commits_url":"https://api.github.com/repos/MobileWorks/summa-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/MobileWorks/summa-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/MobileWorks/summa-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/MobileWorks/summa-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/MobileWorks/summa-test/contents/{+path}","compare_url":"https://api.github.com/repos/MobileWorks/summa-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MobileWorks/summa-test/merges","archive_url":"https://api.github.com/repos/MobileWorks/summa-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MobileWorks/summa-test/downloads","issues_url":"https://api.github.com/repos/MobileWorks/summa-test/issues{/number}","pulls_url":"https://api.github.com/repos/MobileWorks/summa-test/pulls{/number}","milestones_url":"https://api.github.com/repos/MobileWorks/summa-test/milestones{/number}","notifications_url":"https://api.github.com/repos/MobileWorks/summa-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MobileWorks/summa-test/labels{/name}","releases_url":"https://api.github.com/repos/MobileWorks/summa-test/releases{/id}","deployments_url":"https://api.github.com/repos/MobileWorks/summa-test/deployments","created_at":"2015-10-06T23:57:55Z","updated_at":"2016-02-24T17:01:28Z","pushed_at":"2016-03-14T18:30:56Z","git_url":"git://github.com/MobileWorks/summa-test.git","ssh_url":"git@github.com:MobileWorks/summa-test.git","clone_url":"https://github.com/MobileWorks/summa-test.git","svn_url":"https://github.com/MobileWorks/summa-test","homepage":null,"size":22,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"MobileWorks:master","ref":"master","sha":"46c3247cfdcd6f86579a8c1e6214c2c1c6b82905","user":{"login":"MobileWorks","id":796558,"avatar_url":"https://avatars.githubusercontent.com/u/796558?v=3","gravatar_id":"","url":"https://api.github.com/users/MobileWorks","html_url":"https://github.com/MobileWorks","followers_url":"https://api.github.com/users/MobileWorks/followers","following_url":"https://api.github.com/users/MobileWorks/following{/other_user}","gists_url":"https://api.github.com/users/MobileWorks/gists{/gist_id}","starred_url":"https://api.github.com/users/MobileWorks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobileWorks/subscriptions","organizations_url":"https://api.github.com/users/MobileWorks/orgs","repos_url":"https://api.github.com/users/MobileWorks/repos","events_url":"https://api.github.com/users/MobileWorks/events{/privacy}","received_events_url":"https://api.github.com/users/MobileWorks/received_events","type":"Organization","site_admin":false},"repo":{"id":43785787,"name":"summa-test","full_name":"MobileWorks/summa-test","owner":{"login":"MobileWorks","id":796558,"avatar_url":"https://avatars.githubusercontent.com/u/796558?v=3","gravatar_id":"","url":"https://api.github.com/users/MobileWorks","html_url":"https://github.com/MobileWorks","followers_url":"https://api.github.com/users/MobileWorks/followers","following_url":"https://api.github.com/users/MobileWorks/following{/other_user}","gists_url":"https://api.github.com/users/MobileWorks/gists{/gist_id}","starred_url":"https://api.github.com/users/MobileWorks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobileWorks/subscriptions","organizations_url":"https://api.github.com/users/MobileWorks/orgs","repos_url":"https://api.github.com/users/MobileWorks/repos","events_url":"https://api.github.com/users/MobileWorks/events{/privacy}","received_events_url":"https://api.github.com/users/MobileWorks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MobileWorks/summa-test","description":"Integration test framework for LG apps","fork":false,"url":"https://api.github.com/repos/MobileWorks/summa-test","forks_url":"https://api.github.com/repos/MobileWorks/summa-test/forks","keys_url":"https://api.github.com/repos/MobileWorks/summa-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MobileWorks/summa-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MobileWorks/summa-test/teams","hooks_url":"https://api.github.com/repos/MobileWorks/summa-test/hooks","issue_events_url":"https://api.github.com/repos/MobileWorks/summa-test/issues/events{/number}","events_url":"https://api.github.com/repos/MobileWorks/summa-test/events","assignees_url":"https://api.github.com/repos/MobileWorks/summa-test/assignees{/user}","branches_url":"https://api.github.com/repos/MobileWorks/summa-test/branches{/branch}","tags_url":"https://api.github.com/repos/MobileWorks/summa-test/tags","blobs_url":"https://api.github.com/repos/MobileWorks/summa-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MobileWorks/summa-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MobileWorks/summa-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/MobileWorks/summa-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MobileWorks/summa-test/statuses/{sha}","languages_url":"https://api.github.com/repos/MobileWorks/summa-test/languages","stargazers_url":"https://api.github.com/repos/MobileWorks/summa-test/stargazers","contributors_url":"https://api.github.com/repos/MobileWorks/summa-test/contributors","subscribers_url":"https://api.github.com/repos/MobileWorks/summa-test/subscribers","subscription_url":"https://api.github.com/repos/MobileWorks/summa-test/subscription","commits_url":"https://api.github.com/repos/MobileWorks/summa-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/MobileWorks/summa-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/MobileWorks/summa-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/MobileWorks/summa-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/MobileWorks/summa-test/contents/{+path}","compare_url":"https://api.github.com/repos/MobileWorks/summa-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MobileWorks/summa-test/merges","archive_url":"https://api.github.com/repos/MobileWorks/summa-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MobileWorks/summa-test/downloads","issues_url":"https://api.github.com/repos/MobileWorks/summa-test/issues{/number}","pulls_url":"https://api.github.com/repos/MobileWorks/summa-test/pulls{/number}","milestones_url":"https://api.github.com/repos/MobileWorks/summa-test/milestones{/number}","notifications_url":"https://api.github.com/repos/MobileWorks/summa-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MobileWorks/summa-test/labels{/name}","releases_url":"https://api.github.com/repos/MobileWorks/summa-test/releases{/id}","deployments_url":"https://api.github.com/repos/MobileWorks/summa-test/deployments","created_at":"2015-10-06T23:57:55Z","updated_at":"2016-02-24T17:01:28Z","pushed_at":"2016-03-14T18:30:56Z","git_url":"git://github.com/MobileWorks/summa-test.git","ssh_url":"git@github.com:MobileWorks/summa-test.git","clone_url":"https://github.com/MobileWorks/summa-test.git","svn_url":"https://github.com/MobileWorks/summa-test","homepage":null,"size":22,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MobileWorks/summa-test/pulls/7"},"html":{"href":"https://github.com/MobileWorks/summa-test/pull/7"},"issue":{"href":"https://api.github.com/repos/MobileWorks/summa-test/issues/7"},"comments":{"href":"https://api.github.com/repos/MobileWorks/summa-test/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/MobileWorks/summa-test/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/MobileWorks/summa-test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MobileWorks/summa-test/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/MobileWorks/summa-test/statuses/e5a92a7499863b690ae20efb81eb9f86556bbe0a"}}}}