Commit a3a1f72d authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeFunctionalTestCase: use <details> for test results

fold test results for easier navigation
parent b6c3df7c
...@@ -44,7 +44,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase ...@@ -44,7 +44,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.runUnitTest import log_directory from Products.ERP5Type.tests.runUnitTest import log_directory
from Products.ERP5Type.Utils import stopProcess, PR_SET_PDEATHSIG from Products.ERP5Type.Utils import stopProcess, PR_SET_PDEATHSIG
from lxml import etree from lxml import etree
from lxml.html import builder as E from lxml.html.builder import E
import certifi import certifi
import urllib3 import urllib3
from selenium import webdriver from selenium import webdriver
...@@ -386,26 +386,28 @@ class FunctionalTestRunner: ...@@ -386,26 +386,28 @@ class FunctionalTestRunner:
# XXX replace status_failed classes by an inline style supported by gadget_html_viewer # XXX replace status_failed classes by an inline style supported by gadget_html_viewer
for test_tr in test_table.xpath('.//tr[contains(@class, "status_failed")]'): for test_tr in test_table.xpath('.//tr[contains(@class, "status_failed")]'):
test_tr.set('style', 'background-color: red;') test_tr.set('style', 'background-color: red;')
details_attribute_dict = {}
if etree.tostring(test_table).find("expected failure") != -1: if etree.tostring(test_table).find("expected failure") != -1:
expected_failure_amount += 1 expected_failure_amount += 1
else: else:
failure_amount += 1 failure_amount += 1
error_title_list.append(test_name) error_title_list.append(test_name)
detail_element = E.DIV() details_attribute_dict['open'] = 'true'
detail_element.append(E.DIV(E.P(test_name), E.BR, test_table)) detail_element = E.div()
detail_element.append(E.details(E.summary(test_name), test_table, **details_attribute_dict))
detail += etree.tostring(detail_element) detail += etree.tostring(detail_element)
tr_count += 1 tr_count += 1
sucess_amount = tr_count - 1 - failure_amount - expected_failure_amount success_amount = tr_count - 1 - failure_amount - expected_failure_amount
if detail: if detail:
detail = '''<html> detail = '''<html>
<head> <body>
<style type="text/css">tr.status_failed { background-color:red };</style> <h3>Failed Zelenium Test Details</h3>
</head> %s
<body>%s</body> </body>
</html>''' % detail </html>''' % detail
# When return fix output for handle unicode issues. # When return fix output for handle unicode issues.
return detail, sucess_amount, failure_amount, expected_failure_amount, \ return detail, success_amount, failure_amount, expected_failure_amount, \
error_title_list error_title_list
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment