Guest User

Untitled

a guest
Jul 19th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.29 KB | None | 0 0
  1. Testing started at 13:49 ...
  2. /Users/tester/Documents/GitHub/python_training_mantis/env/bin/python "/Applications/PyCharm CE.app/Contents/helpers/pycharm/_jb_pytest_runner.py" --path /Users/tester/Documents/GitHub/python_training_mantis/tests/test_add_project.py
  3. Launching py.test with arguments /Users/tester/Documents/GitHub/python_training_mantis/tests/test_add_project.py in /Users/tester/Documents/GitHub/python_training_mantis/tests
  4.  
  5. ============================= test session starts ==============================
  6. platform darwin -- Python 3.7.0, pytest-3.6.3, py-1.5.4, pluggy-0.6.0
  7. rootdir: /Users/tester/Documents/GitHub/python_training_mantis/tests, inifile:collected 1 item
  8.  
  9. test_add_project.py F
  10. test_add_project.py:5 (test_add_project[None, nameV0pTj, descT93iyehOrLoq2ScOO79])
  11. app = <fixture.application.Application object at 0x10792e128>
  12. project = None, nameV0pTj, descT93iyehOrLoq2ScOO79
  13.  
  14. @pytest.mark.parametrize("project", testdata, ids=[repr(x) for x in testdata])
  15. def test_add_project(app, project):
  16. app.session.login("administrator", "root")
  17. > old_projects = app.project.get_projects_list()
  18.  
  19. test_add_project.py:9:
  20. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  21. ../fixture/project.py:41: in get_projects_list
  22. name = wd.find_element_by_xpath("./td[1]/a").text
  23. ../env/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:393: in find_element_by_xpath
  24. return self.find_element(by=By.XPATH, value=xpath)
  25. ../env/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:966: in find_element
  26. 'value': value})['value']
  27. ../env/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:320: in execute
  28. self.error_handler.check_response(response)
  29. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  30.  
  31. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x106acb198>
  32. response = {'status': 500, 'value': '{"name":"findElement","sessionId":"8d80faab-bdd4-de4b-b350-ea8dc5f754a1","status":7,"value":...p8f6jqohk/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13335,"columnNumber":5}]}}'}
  33.  
  34. def check_response(self, response):
  35. """
  36. Checks that a JSON response from the WebDriver does not have an error.
  37.  
  38. :Args:
  39. - response - The JSON response from the WebDriver server as a dictionary
  40. object.
  41.  
  42. :Raises: If the response contains an error message.
  43. """
  44. status = response.get('status', None)
  45. if status is None or status == ErrorCode.SUCCESS:
  46. return
  47. value = None
  48. message = response.get("message", "")
  49. screen = response.get("screen", "")
  50. stacktrace = None
  51. if isinstance(status, int):
  52. value_json = response.get('value', None)
  53. if value_json and isinstance(value_json, basestring):
  54. import json
  55. try:
  56. value = json.loads(value_json)
  57. if len(value.keys()) == 1:
  58. value = value['value']
  59. status = value.get('error', None)
  60. if status is None:
  61. status = value["status"]
  62. message = value["value"]
  63. if not isinstance(message, basestring):
  64. value = message
  65. message = message.get('message')
  66. else:
  67. message = value.get('message', None)
  68. except ValueError:
  69. pass
  70.  
  71. exception_class = ErrorInResponseException
  72. if status in ErrorCode.NO_SUCH_ELEMENT:
  73. exception_class = NoSuchElementException
  74. elif status in ErrorCode.NO_SUCH_FRAME:
  75. exception_class = NoSuchFrameException
  76. elif status in ErrorCode.NO_SUCH_WINDOW:
  77. exception_class = NoSuchWindowException
  78. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  79. exception_class = StaleElementReferenceException
  80. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  81. exception_class = ElementNotVisibleException
  82. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  83. exception_class = InvalidElementStateException
  84. elif status in ErrorCode.INVALID_SELECTOR \
  85. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  86. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  87. exception_class = InvalidSelectorException
  88. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  89. exception_class = ElementNotSelectableException
  90. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  91. exception_class = ElementNotInteractableException
  92. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  93. exception_class = InvalidCookieDomainException
  94. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  95. exception_class = UnableToSetCookieException
  96. elif status in ErrorCode.TIMEOUT:
  97. exception_class = TimeoutException
  98. elif status in ErrorCode.SCRIPT_TIMEOUT:
  99. exception_class = TimeoutException
  100. elif status in ErrorCode.UNKNOWN_ERROR:
  101. exception_class = WebDriverException
  102. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  103. exception_class = UnexpectedAlertPresentException
  104. elif status in ErrorCode.NO_ALERT_OPEN:
  105. exception_class = NoAlertPresentException
  106. elif status in ErrorCode.IME_NOT_AVAILABLE:
  107. exception_class = ImeNotAvailableException
  108. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  109. exception_class = ImeActivationFailedException
  110. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  111. exception_class = MoveTargetOutOfBoundsException
  112. elif status in ErrorCode.JAVASCRIPT_ERROR:
  113. exception_class = JavascriptException
  114. elif status in ErrorCode.SESSION_NOT_CREATED:
  115. exception_class = SessionNotCreatedException
  116. elif status in ErrorCode.INVALID_ARGUMENT:
  117. exception_class = InvalidArgumentException
  118. elif status in ErrorCode.NO_SUCH_COOKIE:
  119. exception_class = NoSuchCookieException
  120. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  121. exception_class = ScreenshotException
  122. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  123. exception_class = ElementClickInterceptedException
  124. elif status in ErrorCode.INSECURE_CERTIFICATE:
  125. exception_class = InsecureCertificateException
  126. elif status in ErrorCode.INVALID_COORDINATES:
  127. exception_class = InvalidCoordinatesException
  128. elif status in ErrorCode.INVALID_SESSION_ID:
  129. exception_class = InvalidSessionIdException
  130. elif status in ErrorCode.UNKNOWN_METHOD:
  131. exception_class = UnknownMethodException
  132. else:
  133. exception_class = WebDriverException
  134. if value == '' or value is None:
  135. value = response['value']
  136. if isinstance(value, basestring):
  137. if exception_class == ErrorInResponseException:
  138. raise exception_class(response, value)
  139. raise exception_class(value)
  140. if message == "" and 'message' in value:
  141. message = value['message']
  142.  
  143. screen = None
  144. if 'screen' in value:
  145. screen = value['screen']
  146.  
  147. stacktrace = None
  148. if 'stackTrace' in value and value['stackTrace']:
  149. stacktrace = []
  150. try:
  151. for frame in value['stackTrace']:
  152. line = self._value_or_default(frame, 'lineNumber', '')
  153. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  154. if line:
  155. file = "%s:%s" % (file, line)
  156. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  157. if 'className' in frame:
  158. meth = "%s.%s" % (frame['className'], meth)
  159. msg = " at %s (%s)"
  160. msg = msg % (meth, file)
  161. stacktrace.append(msg)
  162. except TypeError:
  163. pass
  164. if exception_class == ErrorInResponseException:
  165. raise exception_class(response, message)
  166. elif exception_class == UnexpectedAlertPresentException:
  167. alert_text = None
  168. if 'data' in value:
  169. alert_text = value['data'].get('text')
  170. elif 'alert' in value:
  171. alert_text = value['alert'].get('text')
  172. raise exception_class(message, screen, stacktrace, alert_text)
  173. > raise exception_class(message, screen, stacktrace)
  174. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"./td[1]/a"}
  175. E Stacktrace:
  176. E at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/driver-component.js:11878)
  177. E at FirefoxDriver.prototype.findElement (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/driver-component.js:11887)
  178. E at DelayedCommand.prototype.executeInternal_/k (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/command-processor.js:13388)
  179. E at DelayedCommand.prototype.executeInternal_ (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/command-processor.js:13393)
  180. E at DelayedCommand.prototype.execute/< (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/command-processor.js:13335)
  181.  
  182. ../env/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:242: NoSuchElementException
  183. [100%]
  184.  
  185. =================================== FAILURES ===================================
  186. __________ test_add_project[None, nameV0pTj, descT93iyehOrLoq2ScOO79] __________
  187.  
  188. app = <fixture.application.Application object at 0x10792e128>
  189. project = None, nameV0pTj, descT93iyehOrLoq2ScOO79
  190.  
  191. @pytest.mark.parametrize("project", testdata, ids=[repr(x) for x in testdata])
  192. def test_add_project(app, project):
  193. app.session.login("administrator", "root")
  194. > old_projects = app.project.get_projects_list()
  195.  
  196. test_add_project.py:9:
  197. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  198. ../fixture/project.py:41: in get_projects_list
  199. name = wd.find_element_by_xpath("./td[1]/a").text
  200. ../env/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:393: in find_element_by_xpath
  201. return self.find_element(by=By.XPATH, value=xpath)
  202. ../env/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:966: in find_element
  203. 'value': value})['value']
  204. ../env/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:320: in execute
  205. self.error_handler.check_response(response)
  206. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  207.  
  208. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x106acb198>
  209. response = {'status': 500, 'value': '{"name":"findElement","sessionId":"8d80faab-bdd4-de4b-b350-ea8dc5f754a1","status":7,"value":...p8f6jqohk/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13335,"columnNumber":5}]}}'}
  210.  
  211. def check_response(self, response):
  212. """
  213. Checks that a JSON response from the WebDriver does not have an error.
  214.  
  215. :Args:
  216. - response - The JSON response from the WebDriver server as a dictionary
  217. object.
  218.  
  219. :Raises: If the response contains an error message.
  220. """
  221. status = response.get('status', None)
  222. if status is None or status == ErrorCode.SUCCESS:
  223. return
  224. value = None
  225. message = response.get("message", "")
  226. screen = response.get("screen", "")
  227. stacktrace = None
  228. if isinstance(status, int):
  229. value_json = response.get('value', None)
  230. if value_json and isinstance(value_json, basestring):
  231. import json
  232. try:
  233. value = json.loads(value_json)
  234. if len(value.keys()) == 1:
  235. value = value['value']
  236. status = value.get('error', None)
  237. if status is None:
  238. status = value["status"]
  239. message = value["value"]
  240. if not isinstance(message, basestring):
  241. value = message
  242. message = message.get('message')
  243. else:
  244. message = value.get('message', None)
  245. except ValueError:
  246. pass
  247.  
  248. exception_class = ErrorInResponseException
  249. if status in ErrorCode.NO_SUCH_ELEMENT:
  250. exception_class = NoSuchElementException
  251. elif status in ErrorCode.NO_SUCH_FRAME:
  252. exception_class = NoSuchFrameException
  253. elif status in ErrorCode.NO_SUCH_WINDOW:
  254. exception_class = NoSuchWindowException
  255. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  256. exception_class = StaleElementReferenceException
  257. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  258. exception_class = ElementNotVisibleException
  259. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  260. exception_class = InvalidElementStateException
  261. elif status in ErrorCode.INVALID_SELECTOR \
  262. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  263. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  264. exception_class = InvalidSelectorException
  265. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  266. exception_class = ElementNotSelectableException
  267. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  268. exception_class = ElementNotInteractableException
  269. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  270. exception_class = InvalidCookieDomainException
  271. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  272. exception_class = UnableToSetCookieException
  273. elif status in ErrorCode.TIMEOUT:
  274. exception_class = TimeoutException
  275. elif status in ErrorCode.SCRIPT_TIMEOUT:
  276. exception_class = TimeoutException
  277. elif status in ErrorCode.UNKNOWN_ERROR:
  278. exception_class = WebDriverException
  279. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  280. exception_class = UnexpectedAlertPresentException
  281. elif status in ErrorCode.NO_ALERT_OPEN:
  282. exception_class = NoAlertPresentException
  283. elif status in ErrorCode.IME_NOT_AVAILABLE:
  284. exception_class = ImeNotAvailableException
  285. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  286. exception_class = ImeActivationFailedException
  287. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  288. exception_class = MoveTargetOutOfBoundsException
  289. elif status in ErrorCode.JAVASCRIPT_ERROR:
  290. exception_class = JavascriptException
  291. elif status in ErrorCode.SESSION_NOT_CREATED:
  292. exception_class = SessionNotCreatedException
  293. elif status in ErrorCode.INVALID_ARGUMENT:
  294. exception_class = InvalidArgumentException
  295. elif status in ErrorCode.NO_SUCH_COOKIE:
  296. exception_class = NoSuchCookieException
  297. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  298. exception_class = ScreenshotException
  299. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  300. exception_class = ElementClickInterceptedException
  301. elif status in ErrorCode.INSECURE_CERTIFICATE:
  302. exception_class = InsecureCertificateException
  303. elif status in ErrorCode.INVALID_COORDINATES:
  304. exception_class = InvalidCoordinatesException
  305. elif status in ErrorCode.INVALID_SESSION_ID:
  306. exception_class = InvalidSessionIdException
  307. elif status in ErrorCode.UNKNOWN_METHOD:
  308. exception_class = UnknownMethodException
  309. else:
  310. exception_class = WebDriverException
  311. if value == '' or value is None:
  312. value = response['value']
  313. if isinstance(value, basestring):
  314. if exception_class == ErrorInResponseException:
  315. raise exception_class(response, value)
  316. raise exception_class(value)
  317. if message == "" and 'message' in value:
  318. message = value['message']
  319.  
  320. screen = None
  321. if 'screen' in value:
  322. screen = value['screen']
  323.  
  324. stacktrace = None
  325. if 'stackTrace' in value and value['stackTrace']:
  326. stacktrace = []
  327. try:
  328. for frame in value['stackTrace']:
  329. line = self._value_or_default(frame, 'lineNumber', '')
  330. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  331. if line:
  332. file = "%s:%s" % (file, line)
  333. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  334. if 'className' in frame:
  335. meth = "%s.%s" % (frame['className'], meth)
  336. msg = " at %s (%s)"
  337. msg = msg % (meth, file)
  338. stacktrace.append(msg)
  339. except TypeError:
  340. pass
  341. if exception_class == ErrorInResponseException:
  342. raise exception_class(response, message)
  343. elif exception_class == UnexpectedAlertPresentException:
  344. alert_text = None
  345. if 'data' in value:
  346. alert_text = value['data'].get('text')
  347. elif 'alert' in value:
  348. alert_text = value['alert'].get('text')
  349. raise exception_class(message, screen, stacktrace, alert_text)
  350. > raise exception_class(message, screen, stacktrace)
  351. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"./td[1]/a"}
  352. E Stacktrace:
  353. E at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/driver-component.js:11878)
  354. E at FirefoxDriver.prototype.findElement (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/driver-component.js:11887)
  355. E at DelayedCommand.prototype.executeInternal_/k (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/command-processor.js:13388)
  356. E at DelayedCommand.prototype.executeInternal_ (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/command-processor.js:13393)
  357. E at DelayedCommand.prototype.execute/< (file:///var/folders/vn/tgnn0bks58x41sym91rpszv00000gp/T/tmp8f6jqohk/extensions/fxdriver@googlecode.com/components/command-processor.js:13335)
  358.  
  359. ../env/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:242: NoSuchElementException
  360. ========================== 1 failed in 15.91 seconds ===========================
  361. Process finished with exit code 0
Add Comment
Please, Sign In to add comment