{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/comments/25879116","id":25879116,"diff_hunk":"@@ -0,0 +1,140 @@\n+# This Source Code Form is subject to the terms of the Mozilla Public\n+# License, v. 2.0. If a copy of the MPL was not distributed with this file,\n+# You can obtain one at http://mozilla.org/MPL/2.0/.\n+\n+from datetime import datetime\n+\n+from marionette_driver import By, Wait\n+\n+from ..windows import BaseWindow\n+from ...api.software_update import SoftwareUpdate\n+from deck import Deck\n+\n+\n+class AboutWindow(BaseWindow):\n+    \"\"\"Representation of the About window.\"\"\"\n+\n+    TIMEOUT_UPDATE_APPLY = 300\n+    TIMEOUT_UPDATE_CHECK = 30\n+    TIMEOUT_UPDATE_DOWNLOAD = 360\n+\n+    window_type = 'Browser:About'\n+\n+    def __init__(self, marionette_getter, window_handle):\n+        BaseWindow.__init__(self, marionette_getter, window_handle)\n+\n+        self.software_update = SoftwareUpdate(marionette_getter)\n+        self.download_duration = -1\n+\n+    @property\n+    def deck(self):\n+        \"\"\"The :class:`Deck` instance which represents the deck.\n+\n+        :returns: Reference to the deck.\n+        \"\"\"\n+        deck = self.window_element.find_element(By.ID, 'updateDeck')\n+        return Deck(lambda: self.marionette, self, deck)\n+\n+    @property\n+    def patch_info(self):\n+        \"\"\" Returns information about the active update in the queue.\n+\n+        :returns: A dictionary with information about the active patch\n+        \"\"\"\n+        patch = self.software_update.patch_info\n+        patch['download_duration'] = self.download_duration\n+        return patch\n+\n+    @property\n+    def updates_found(self):\n+        \"\"\" Checks if updates were found.\n+\n+        :returns: True if updates were found\n+        \"\"\"\n+        return self.wizard_state != 'noUpdatesFound'\n+\n+    @property\n+    def wizard_state(self):\n+        \"\"\" Returns the current state of the update wizard.\"\"\"\n+        return self.deck.wizard_state\n+\n+    def check_for_updates(self):\n+        \"\"\"Clicks on \"Check for Updates\" button, and waits for check to complete\"\"\"\n+        Wait(self.marionette).until(\n+            lambda _: self.wizard_state == 'checkForUpdates')\n+        self.deck.click_check_for_updates_button()\n+\n+        # Wait for the update checking to finish\n+        Wait(self.marionette, self.TIMEOUT_UPDATE_CHECK).until(\n+            lambda _: self.wizard_state != 'checkingForUpdates')\n+\n+    def download(self, wait_for_finish=True, timeout=TIMEOUT_UPDATE_DOWNLOAD):\n+        \"\"\" Download the update\n+\n+        :param wait_for_finish: Optional, True, if the function has to wait\n+        for the download to be finished, default to `True`\n+        :param timeout: How long to wait for the download to finish\n+        \"\"\"\n+        assert self.software_update.update_channel.default_channel ==\\\n+            self.software_update.update_channel.channel,\\\n+            'The update channel has been set correctly.'\n+\n+        if self.wizard_state == 'downloadAndInstall':\n+            self.deck.click_download_button()\n+\n+            # Wait for the download to start\n+            Wait(self.marionette).until(\n+                lambda _: self.wizard_state != 'downloadAndInstall')\n+\n+        # If there are incompatible addons we fallback on old software update dialog for updating\n+        if self.wizard_state == 'applyBillboard':\n+            self.deck.click_update_button()\n+\n+            # The rest of the code inside this `if` uses the update wizard which is\n+            # not being converted yet, so raise a NotImplementedError.\n+            raise NotImplementedError('Fallback dialog logic not yet implemented.')\n+\n+            #\n+            # The current JS code is:\n+            #\n+            #     var wizard = updateWizard.handleUpdateWizardDialog();\n+            #     wizard.waitForWizardPage(updateWizard.WIZARD_PAGES.updatesfoundbasic);\n+            #     wizard.download();\n+            #     wizard.close();\n+            #     this._downloadDuration = wizard._downloadDuration;\n+            #\n+            #     return;\n+\n+        if wait_for_finish:\n+            start_time = datetime.now()\n+            self.wait_for_download_finished(timeout)\n+            self.download_duration = datetime.now() - start_time\n+\n+    def wait_for_download_finished(self, timeout):\n+        \"\"\" Waits until download is completed\n+\n+        :param timeout: How long to wait for the download to complete\n+        \"\"\"\n+\n+        Wait(self.marionette, timeout).until(\n+            lambda _: self.wizard_state != 'downloading',\n+            message='Download has been completed.')\n+\n+        assert self.wizard_state != 'downloadFailed'","path":"firefox_puppeteer/ui/about_window/window.py","position":123,"original_position":123,"commit_id":"4558cf179619bc2c5c44b984662b2e650d43bc7b","original_commit_id":"4558cf179619bc2c5c44b984662b2e650d43bc7b","user":{"login":"whimboo","id":129603,"avatar_url":"https://avatars.githubusercontent.com/u/129603?v=3","gravatar_id":"","url":"https://api.github.com/users/whimboo","html_url":"https://github.com/whimboo","followers_url":"https://api.github.com/users/whimboo/followers","following_url":"https://api.github.com/users/whimboo/following{/other_user}","gists_url":"https://api.github.com/users/whimboo/gists{/gist_id}","starred_url":"https://api.github.com/users/whimboo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whimboo/subscriptions","organizations_url":"https://api.github.com/users/whimboo/orgs","repos_url":"https://api.github.com/users/whimboo/repos","events_url":"https://api.github.com/users/whimboo/events{/privacy}","received_events_url":"https://api.github.com/users/whimboo/received_events","type":"User","site_admin":false},"body":"Same here as above and for all the other asserts.","created_at":"2015-03-05T16:48:28Z","updated_at":"2015-03-05T16:48:28Z","html_url":"https://github.com/mozilla/firefox-ui-tests/pull/107#discussion_r25879116","pull_request_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/107","_links":{"self":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/comments/25879116"},"html":{"href":"https://github.com/mozilla/firefox-ui-tests/pull/107#discussion_r25879116"},"pull_request":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/107"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/107","id":30098342,"html_url":"https://github.com/mozilla/firefox-ui-tests/pull/107","diff_url":"https://github.com/mozilla/firefox-ui-tests/pull/107.diff","patch_url":"https://github.com/mozilla/firefox-ui-tests/pull/107.patch","issue_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/issues/107","number":107,"state":"open","locked":false,"title":"Bug 1133753 - Convert Mozmill about-window.js library to Python/Marionette","user":{"login":"bobsilverberg","id":142755,"avatar_url":"https://avatars.githubusercontent.com/u/142755?v=3","gravatar_id":"","url":"https://api.github.com/users/bobsilverberg","html_url":"https://github.com/bobsilverberg","followers_url":"https://api.github.com/users/bobsilverberg/followers","following_url":"https://api.github.com/users/bobsilverberg/following{/other_user}","gists_url":"https://api.github.com/users/bobsilverberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bobsilverberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobsilverberg/subscriptions","organizations_url":"https://api.github.com/users/bobsilverberg/orgs","repos_url":"https://api.github.com/users/bobsilverberg/repos","events_url":"https://api.github.com/users/bobsilverberg/events{/privacy}","received_events_url":"https://api.github.com/users/bobsilverberg/received_events","type":"User","site_admin":false},"body":"This includes the current commits from PR #90 as `AboutWindow` depends on `SoftwareUpdate`. All of the changes for `AboutWindow` are included in a single commit.","created_at":"2015-02-26T17:32:20Z","updated_at":"2015-03-05T16:48:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f74066c20db52b4d3c165df7b25fe706f7faad46","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/107/commits","review_comments_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/107/comments","review_comment_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/issues/107/comments","statuses_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/statuses/4558cf179619bc2c5c44b984662b2e650d43bc7b","head":{"label":"bobsilverberg:about_window","ref":"about_window","sha":"4558cf179619bc2c5c44b984662b2e650d43bc7b","user":{"login":"bobsilverberg","id":142755,"avatar_url":"https://avatars.githubusercontent.com/u/142755?v=3","gravatar_id":"","url":"https://api.github.com/users/bobsilverberg","html_url":"https://github.com/bobsilverberg","followers_url":"https://api.github.com/users/bobsilverberg/followers","following_url":"https://api.github.com/users/bobsilverberg/following{/other_user}","gists_url":"https://api.github.com/users/bobsilverberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bobsilverberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobsilverberg/subscriptions","organizations_url":"https://api.github.com/users/bobsilverberg/orgs","repos_url":"https://api.github.com/users/bobsilverberg/repos","events_url":"https://api.github.com/users/bobsilverberg/events{/privacy}","received_events_url":"https://api.github.com/users/bobsilverberg/received_events","type":"User","site_admin":false},"repo":{"id":30254558,"name":"firefox-ui-tests","full_name":"bobsilverberg/firefox-ui-tests","owner":{"login":"bobsilverberg","id":142755,"avatar_url":"https://avatars.githubusercontent.com/u/142755?v=3","gravatar_id":"","url":"https://api.github.com/users/bobsilverberg","html_url":"https://github.com/bobsilverberg","followers_url":"https://api.github.com/users/bobsilverberg/followers","following_url":"https://api.github.com/users/bobsilverberg/following{/other_user}","gists_url":"https://api.github.com/users/bobsilverberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bobsilverberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobsilverberg/subscriptions","organizations_url":"https://api.github.com/users/bobsilverberg/orgs","repos_url":"https://api.github.com/users/bobsilverberg/repos","events_url":"https://api.github.com/users/bobsilverberg/events{/privacy}","received_events_url":"https://api.github.com/users/bobsilverberg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bobsilverberg/firefox-ui-tests","description":"","fork":true,"url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests","forks_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/forks","keys_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/teams","hooks_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/hooks","issue_events_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/issues/events{/number}","events_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/events","assignees_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/assignees{/user}","branches_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/branches{/branch}","tags_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/tags","blobs_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/languages","stargazers_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/stargazers","contributors_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/contributors","subscribers_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/subscribers","subscription_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/subscription","commits_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/contents/{+path}","compare_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/merges","archive_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/downloads","issues_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/issues{/number}","pulls_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/labels{/name}","releases_url":"https://api.github.com/repos/bobsilverberg/firefox-ui-tests/releases{/id}","created_at":"2015-02-03T17:13:42Z","updated_at":"2015-02-03T17:13:43Z","pushed_at":"2015-03-05T12:49:43Z","git_url":"git://github.com/bobsilverberg/firefox-ui-tests.git","ssh_url":"git@github.com:bobsilverberg/firefox-ui-tests.git","clone_url":"https://github.com/bobsilverberg/firefox-ui-tests.git","svn_url":"https://github.com/bobsilverberg/firefox-ui-tests","homepage":null,"size":463,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"2c3c1df786fe8843fb89c3c85f3eab7e8ecb73cc","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":25004372,"name":"firefox-ui-tests","full_name":"mozilla/firefox-ui-tests","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/firefox-ui-tests","description":"","fork":false,"url":"https://api.github.com/repos/mozilla/firefox-ui-tests","forks_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/forks","keys_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/teams","hooks_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/hooks","issue_events_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/events","assignees_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/tags","blobs_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/languages","stargazers_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/stargazers","contributors_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/contributors","subscribers_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/subscribers","subscription_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/subscription","commits_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/merges","archive_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/downloads","issues_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/firefox-ui-tests/releases{/id}","created_at":"2014-10-09T19:09:05Z","updated_at":"2015-03-04T15:39:49Z","pushed_at":"2015-03-04T15:39:49Z","git_url":"git://github.com/mozilla/firefox-ui-tests.git","ssh_url":"git@github.com:mozilla/firefox-ui-tests.git","clone_url":"https://github.com/mozilla/firefox-ui-tests.git","svn_url":"https://github.com/mozilla/firefox-ui-tests","homepage":null,"size":2158,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":15,"forks":18,"open_issues":15,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/107"},"html":{"href":"https://github.com/mozilla/firefox-ui-tests/pull/107"},"issue":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/issues/107"},"comments":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/issues/107/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/107/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/pulls/107/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/firefox-ui-tests/statuses/4558cf179619bc2c5c44b984662b2e650d43bc7b"}}}}