{"action":"created","comment":{"url":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/comments/27598942","id":27598942,"diff_hunk":"@@ -0,0 +1,301 @@\n+# coding=utf-8\n+# charset utf-8\n+\n+import urlparse\n+from selenium.webdriver.common.keys import Keys\n+from selenium.webdriver.support.ui import WebDriverWait\n+from selenium.webdriver import ActionChains\n+from selenium.webdriver.common.alert import Alert\n+from os import getcwd\n+\n+__author__ = 'kic'\n+\n+LINK_TO_HABR = 'http://habrahabr.ru/post/114772/'\n+LINK_TO_KITTY = 'http://wpapers.ru/wallpapers/animals/Cats/8597/PREV_%D0%A1%D0%B5%D1%80%D1%8B%D0%B9-%D0%BA%D0%BE%D1%82%D1%91%D0%BD%D0%BE%D0%BA.jpg'\n+USER_NAME_FOR_LINK = u'Господин Губернатор'\n+\n+\n+def down_keys(driver, text):\n+        ActionChains(driver).send_keys(text).perform()\n+\n+\n+class Page(object):\n+    BASE_URL = 'http://ftest.stud.tech-mail.ru/'\n+    PATH = ''\n+    USERNAME = '//a[@class=\"username\"]'\n+\n+    def __init__(self, driver):\n+        self.driver = driver\n+\n+    def open(self):\n+        url = urlparse.urljoin(self.BASE_URL, self.PATH)\n+        self.driver.get(url)\n+\n+    def get_username_from_settings(self):\n+        return WebDriverWait(self.driver, 10, 0.1).until(\n+            lambda d: d.find_element_by_xpath(self.USERNAME).text\n+        )\n+\n+    def get_user_href_from_settings(self):\n+        return WebDriverWait(self.driver, 10, 0.1).until(\n+            lambda d: d.find_element_by_xpath(self.USERNAME).get_attribute('href')\n+        )\n+\n+\n+class Topic(Page):\n+\n+    FIRST_LINK_IN_CONTENT = '//div[@class=\"topic-content text\"]/p/a'\n+\n+    DELETE_BUTTON = '//a[@class=\"actions-delete\"]'\n+    DELETE_BUTTON_CONFIRM = '//input[@value=\"Удалить\"]'\n+\n+    def get_link_text(self):\n+        return self.driver.find_element_by_xpath(self.FIRST_LINK_IN_CONTENT).text\n+\n+    def get_link_href(self):\n+        return self.driver.find_element_by_xpath(self.FIRST_LINK_IN_CONTENT).get_attribute('href')\n+\n+    def delete(self):\n+        self.driver.find_element_by_xpath(self.DELETE_BUTTON).click()\n+        WebDriverWait(self.driver, 10, 0.1).until(\n+            lambda d: d.find_element_by_xpath(self.DELETE_BUTTON_CONFIRM)\n+        )\n+        self.driver.find_element_by_xpath(self.DELETE_BUTTON_CONFIRM).click()\n+\n+\n+class AuthPage(Page):\n+    PATH = ''\n+    LOGIN = '//input[@name=\"login\"]'\n+    PASSWORD = '//input[@name=\"password\"]'\n+    SUBMIT = '//span[text()=\"Войти\"]'\n+    LOGIN_BUTTON = '//a[text()=\"Вход для участников\"]'\n+\n+    def open_auth_form(self):\n+        self.driver.find_element_by_xpath(self.LOGIN_BUTTON).click()\n+\n+    def set_login(self, login):\n+        self.driver.find_element_by_xpath(self.LOGIN).clear()\n+        self.driver.find_element_by_xpath(self.LOGIN).send_keys(login)\n+\n+    def set_password(self, pwd):\n+        self.driver.find_element_by_xpath(self.PASSWORD).clear()\n+        self.driver.find_element_by_xpath(self.PASSWORD).send_keys(pwd)\n+\n+    def submit(self):\n+        self.driver.find_element_by_xpath(self.SUBMIT).click()\n+\n+\n+class CreateTopicPage(Page):\n+    PATH = '/blog/topic/create/'\n+    BLOGSELECT = '//a[@class=\"chzn-single\"]'\n+    OPTION = '//li[text()=\"{}\"]'\n+    TITLE = '//input[@name=\"title\"]'\n+    CREATE_BUTTON = '//button[contains(text(),\"Создать\")]'\n+\n+    AREA_SHORT_AROUND_CLC = '(//div[@class=\"CodeMirror-sizer\"])[1]'\n+    AREA_MAIN_AROUND_CLC = '(//div[@class=\"CodeMirror-sizer\"])[2]'\n+\n+    QUIZ_CHECK = '//*[@id=\"content\"]/div/div[1]/form/div/p[7]/label'  # //input[@name=\"add_pool\"] not work","path":"tests/page_object.py","position":98,"original_position":98,"commit_id":"76dab39ec55e89f803ca87e5bd9000c1a68b7912","original_commit_id":"76dab39ec55e89f803ca87e5bd9000c1a68b7912","user":{"login":"dkotegov","id":11413412,"avatar_url":"https://avatars.githubusercontent.com/u/11413412?v=3","gravatar_id":"","url":"https://api.github.com/users/dkotegov","html_url":"https://github.com/dkotegov","followers_url":"https://api.github.com/users/dkotegov/followers","following_url":"https://api.github.com/users/dkotegov/following{/other_user}","gists_url":"https://api.github.com/users/dkotegov/gists{/gist_id}","starred_url":"https://api.github.com/users/dkotegov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkotegov/subscriptions","organizations_url":"https://api.github.com/users/dkotegov/orgs","repos_url":"https://api.github.com/users/dkotegov/repos","events_url":"https://api.github.com/users/dkotegov/events{/privacy}","received_events_url":"https://api.github.com/users/dkotegov/received_events","type":"User","site_admin":false},"body":"Как минимум, селектор QUIZ_CHECK ведет на label, а //input[@name=\"add_pool\"] на input ;)","created_at":"2015-04-01T18:45:53Z","updated_at":"2015-04-01T18:45:53Z","html_url":"https://github.com/dkotegov/home-assignment-2/pull/6#discussion_r27598942","pull_request_url":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/comments/27598942"},"html":{"href":"https://github.com/dkotegov/home-assignment-2/pull/6#discussion_r27598942"},"pull_request":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/6","id":32438030,"html_url":"https://github.com/dkotegov/home-assignment-2/pull/6","diff_url":"https://github.com/dkotegov/home-assignment-2/pull/6.diff","patch_url":"https://github.com/dkotegov/home-assignment-2/pull/6.patch","issue_url":"https://api.github.com/repos/dkotegov/home-assignment-2/issues/6","number":6,"state":"open","locked":false,"title":"ДЗ #2 Обеспечение качества","user":{"login":"kic2512","id":8811088,"avatar_url":"https://avatars.githubusercontent.com/u/8811088?v=3","gravatar_id":"","url":"https://api.github.com/users/kic2512","html_url":"https://github.com/kic2512","followers_url":"https://api.github.com/users/kic2512/followers","following_url":"https://api.github.com/users/kic2512/following{/other_user}","gists_url":"https://api.github.com/users/kic2512/gists{/gist_id}","starred_url":"https://api.github.com/users/kic2512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kic2512/subscriptions","organizations_url":"https://api.github.com/users/kic2512/orgs","repos_url":"https://api.github.com/users/kic2512/repos","events_url":"https://api.github.com/users/kic2512/events{/privacy}","received_events_url":"https://api.github.com/users/kic2512/received_events","type":"User","site_admin":false},"body":"Кравцов Илья","created_at":"2015-04-01T16:53:05Z","updated_at":"2015-04-01T18:45:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"218867af507d90506a9a499d957fe03d47e668aa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/6/commits","review_comments_url":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/6/comments","review_comment_url":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dkotegov/home-assignment-2/issues/6/comments","statuses_url":"https://api.github.com/repos/dkotegov/home-assignment-2/statuses/76dab39ec55e89f803ca87e5bd9000c1a68b7912","head":{"label":"kic2512:master","ref":"master","sha":"76dab39ec55e89f803ca87e5bd9000c1a68b7912","user":{"login":"kic2512","id":8811088,"avatar_url":"https://avatars.githubusercontent.com/u/8811088?v=3","gravatar_id":"","url":"https://api.github.com/users/kic2512","html_url":"https://github.com/kic2512","followers_url":"https://api.github.com/users/kic2512/followers","following_url":"https://api.github.com/users/kic2512/following{/other_user}","gists_url":"https://api.github.com/users/kic2512/gists{/gist_id}","starred_url":"https://api.github.com/users/kic2512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kic2512/subscriptions","organizations_url":"https://api.github.com/users/kic2512/orgs","repos_url":"https://api.github.com/users/kic2512/repos","events_url":"https://api.github.com/users/kic2512/events{/privacy}","received_events_url":"https://api.github.com/users/kic2512/received_events","type":"User","site_admin":false},"repo":{"id":33025493,"name":"home-assignment-2","full_name":"kic2512/home-assignment-2","owner":{"login":"kic2512","id":8811088,"avatar_url":"https://avatars.githubusercontent.com/u/8811088?v=3","gravatar_id":"","url":"https://api.github.com/users/kic2512","html_url":"https://github.com/kic2512","followers_url":"https://api.github.com/users/kic2512/followers","following_url":"https://api.github.com/users/kic2512/following{/other_user}","gists_url":"https://api.github.com/users/kic2512/gists{/gist_id}","starred_url":"https://api.github.com/users/kic2512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kic2512/subscriptions","organizations_url":"https://api.github.com/users/kic2512/orgs","repos_url":"https://api.github.com/users/kic2512/repos","events_url":"https://api.github.com/users/kic2512/events{/privacy}","received_events_url":"https://api.github.com/users/kic2512/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kic2512/home-assignment-2","description":"","fork":true,"url":"https://api.github.com/repos/kic2512/home-assignment-2","forks_url":"https://api.github.com/repos/kic2512/home-assignment-2/forks","keys_url":"https://api.github.com/repos/kic2512/home-assignment-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kic2512/home-assignment-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kic2512/home-assignment-2/teams","hooks_url":"https://api.github.com/repos/kic2512/home-assignment-2/hooks","issue_events_url":"https://api.github.com/repos/kic2512/home-assignment-2/issues/events{/number}","events_url":"https://api.github.com/repos/kic2512/home-assignment-2/events","assignees_url":"https://api.github.com/repos/kic2512/home-assignment-2/assignees{/user}","branches_url":"https://api.github.com/repos/kic2512/home-assignment-2/branches{/branch}","tags_url":"https://api.github.com/repos/kic2512/home-assignment-2/tags","blobs_url":"https://api.github.com/repos/kic2512/home-assignment-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kic2512/home-assignment-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kic2512/home-assignment-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/kic2512/home-assignment-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kic2512/home-assignment-2/statuses/{sha}","languages_url":"https://api.github.com/repos/kic2512/home-assignment-2/languages","stargazers_url":"https://api.github.com/repos/kic2512/home-assignment-2/stargazers","contributors_url":"https://api.github.com/repos/kic2512/home-assignment-2/contributors","subscribers_url":"https://api.github.com/repos/kic2512/home-assignment-2/subscribers","subscription_url":"https://api.github.com/repos/kic2512/home-assignment-2/subscription","commits_url":"https://api.github.com/repos/kic2512/home-assignment-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/kic2512/home-assignment-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/kic2512/home-assignment-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/kic2512/home-assignment-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/kic2512/home-assignment-2/contents/{+path}","compare_url":"https://api.github.com/repos/kic2512/home-assignment-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kic2512/home-assignment-2/merges","archive_url":"https://api.github.com/repos/kic2512/home-assignment-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kic2512/home-assignment-2/downloads","issues_url":"https://api.github.com/repos/kic2512/home-assignment-2/issues{/number}","pulls_url":"https://api.github.com/repos/kic2512/home-assignment-2/pulls{/number}","milestones_url":"https://api.github.com/repos/kic2512/home-assignment-2/milestones{/number}","notifications_url":"https://api.github.com/repos/kic2512/home-assignment-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kic2512/home-assignment-2/labels{/name}","releases_url":"https://api.github.com/repos/kic2512/home-assignment-2/releases{/id}","created_at":"2015-03-28T07:49:47Z","updated_at":"2015-04-01T16:55:01Z","pushed_at":"2015-04-01T16:51:13Z","git_url":"git://github.com/kic2512/home-assignment-2.git","ssh_url":"git@github.com:kic2512/home-assignment-2.git","clone_url":"https://github.com/kic2512/home-assignment-2.git","svn_url":"https://github.com/kic2512/home-assignment-2","homepage":null,"size":35259,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"dkotegov:master","ref":"master","sha":"4b61194ff06e0df05440c884d512a395639ddedb","user":{"login":"dkotegov","id":11413412,"avatar_url":"https://avatars.githubusercontent.com/u/11413412?v=3","gravatar_id":"","url":"https://api.github.com/users/dkotegov","html_url":"https://github.com/dkotegov","followers_url":"https://api.github.com/users/dkotegov/followers","following_url":"https://api.github.com/users/dkotegov/following{/other_user}","gists_url":"https://api.github.com/users/dkotegov/gists{/gist_id}","starred_url":"https://api.github.com/users/dkotegov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkotegov/subscriptions","organizations_url":"https://api.github.com/users/dkotegov/orgs","repos_url":"https://api.github.com/users/dkotegov/repos","events_url":"https://api.github.com/users/dkotegov/events{/privacy}","received_events_url":"https://api.github.com/users/dkotegov/received_events","type":"User","site_admin":false},"repo":{"id":31986215,"name":"home-assignment-2","full_name":"dkotegov/home-assignment-2","owner":{"login":"dkotegov","id":11413412,"avatar_url":"https://avatars.githubusercontent.com/u/11413412?v=3","gravatar_id":"","url":"https://api.github.com/users/dkotegov","html_url":"https://github.com/dkotegov","followers_url":"https://api.github.com/users/dkotegov/followers","following_url":"https://api.github.com/users/dkotegov/following{/other_user}","gists_url":"https://api.github.com/users/dkotegov/gists{/gist_id}","starred_url":"https://api.github.com/users/dkotegov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkotegov/subscriptions","organizations_url":"https://api.github.com/users/dkotegov/orgs","repos_url":"https://api.github.com/users/dkotegov/repos","events_url":"https://api.github.com/users/dkotegov/events{/privacy}","received_events_url":"https://api.github.com/users/dkotegov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dkotegov/home-assignment-2","description":"","fork":false,"url":"https://api.github.com/repos/dkotegov/home-assignment-2","forks_url":"https://api.github.com/repos/dkotegov/home-assignment-2/forks","keys_url":"https://api.github.com/repos/dkotegov/home-assignment-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dkotegov/home-assignment-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dkotegov/home-assignment-2/teams","hooks_url":"https://api.github.com/repos/dkotegov/home-assignment-2/hooks","issue_events_url":"https://api.github.com/repos/dkotegov/home-assignment-2/issues/events{/number}","events_url":"https://api.github.com/repos/dkotegov/home-assignment-2/events","assignees_url":"https://api.github.com/repos/dkotegov/home-assignment-2/assignees{/user}","branches_url":"https://api.github.com/repos/dkotegov/home-assignment-2/branches{/branch}","tags_url":"https://api.github.com/repos/dkotegov/home-assignment-2/tags","blobs_url":"https://api.github.com/repos/dkotegov/home-assignment-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dkotegov/home-assignment-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dkotegov/home-assignment-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/dkotegov/home-assignment-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dkotegov/home-assignment-2/statuses/{sha}","languages_url":"https://api.github.com/repos/dkotegov/home-assignment-2/languages","stargazers_url":"https://api.github.com/repos/dkotegov/home-assignment-2/stargazers","contributors_url":"https://api.github.com/repos/dkotegov/home-assignment-2/contributors","subscribers_url":"https://api.github.com/repos/dkotegov/home-assignment-2/subscribers","subscription_url":"https://api.github.com/repos/dkotegov/home-assignment-2/subscription","commits_url":"https://api.github.com/repos/dkotegov/home-assignment-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/dkotegov/home-assignment-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/dkotegov/home-assignment-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/dkotegov/home-assignment-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/dkotegov/home-assignment-2/contents/{+path}","compare_url":"https://api.github.com/repos/dkotegov/home-assignment-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dkotegov/home-assignment-2/merges","archive_url":"https://api.github.com/repos/dkotegov/home-assignment-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dkotegov/home-assignment-2/downloads","issues_url":"https://api.github.com/repos/dkotegov/home-assignment-2/issues{/number}","pulls_url":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls{/number}","milestones_url":"https://api.github.com/repos/dkotegov/home-assignment-2/milestones{/number}","notifications_url":"https://api.github.com/repos/dkotegov/home-assignment-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dkotegov/home-assignment-2/labels{/name}","releases_url":"https://api.github.com/repos/dkotegov/home-assignment-2/releases{/id}","created_at":"2015-03-10T22:53:25Z","updated_at":"2015-03-11T00:15:40Z","pushed_at":"2015-04-01T17:41:05Z","git_url":"git://github.com/dkotegov/home-assignment-2.git","ssh_url":"git@github.com:dkotegov/home-assignment-2.git","clone_url":"https://github.com/dkotegov/home-assignment-2.git","svn_url":"https://github.com/dkotegov/home-assignment-2","homepage":null,"size":35892,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":3,"forks":16,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/6"},"html":{"href":"https://github.com/dkotegov/home-assignment-2/pull/6"},"issue":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/issues/6"},"comments":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/dkotegov/home-assignment-2/statuses/76dab39ec55e89f803ca87e5bd9000c1a68b7912"}}}}