Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bryan Kaperick
erp5
Commits
a651b394
Commit
a651b394
authored
Jul 21, 2015
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XXX erp5_run_my_doc: Remove extension and test template
parent
9ef6a126
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
482 deletions
+0
-482
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
+0
-164
bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py
bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py
+0
-316
bt5/erp5_run_my_doc/bt/template_extension_id_list
bt5/erp5_run_my_doc/bt/template_extension_id_list
+0
-1
bt5/erp5_run_my_doc/bt/template_test_id_list
bt5/erp5_run_my_doc/bt/template_test_id_list
+0
-1
No files found.
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
deleted
100644 → 0
View file @
9ef6a126
"""
Parse the test report
"""
def
parseTestReport
(
text
):
from
lxml
import
etree
parser
=
etree
.
HTMLParser
(
remove_comments
=
True
)
parser
.
feed
(
text
)
root
=
parser
.
close
()
table
=
root
.
xpath
(
'//table[@id="SELENIUM-TEST"]'
)[
0
]
report
=
{}
header
=
table
[
0
][
0
]
report
[
'status'
]
=
header
.
attrib
[
'class'
].
find
(
'passed'
)
>
-
1
report
[
'name'
]
=
header
[
0
].
text
report
[
"row_list"
]
=
[]
report
[
"column_list"
]
=
[
0
,
0
,
0
]
i
=
0
for
row
in
table
[
1
]:
report
[
"row_list"
].
append
(
dict
(
cell_list
=
[],
passed
=
False
,
failed
=
False
,
done
=
False
,
not_done
=
False
))
row_report
=
report
[
"row_list"
][
i
]
if
row
.
attrib
[
'class'
].
find
(
'failed'
)
>
-
1
:
row_report
[
'failed'
]
=
True
elif
row
.
attrib
[
'class'
].
find
(
'done'
)
>
-
1
:
row_report
[
'done'
]
=
True
elif
row
.
attrib
[
'class'
].
find
(
'passed'
)
>
-
1
:
row_report
[
'passed'
]
=
True
else
:
row_report
[
'not_done'
]
=
True
for
column
in
row
:
row_report
[
"cell_list"
].
append
(
column
.
text
)
i
+=
1
return
report
"""
title = table.xpath('//td')[0].text
html[0][1].text = title
# Insert completly the first table
html[1].append(table)
# Insert only the content of tbody
for table in table_list[1:]:
for row in table[-1]:
html[1][-1].append(row)
stack = [html[1]]
# Let's display everything in the test by removing the style attributes (they're not supposed to have any style attributes at all during the tests)
while stack:
element = stack.pop()
if element.attrib.has_key('style'):
del element.attrib['style']
for child in element:
stack.append(child)
return dict(title = title, text = lxml.html.tostring(html))
"""
"""
Parse a HTML page and return a list of dictionnaries with the chapters and the tests they contain
"""
def
parseTutorial
(
text
):
from
Products.ERP5Type.Document
import
newTempBase
from
lxml
import
etree
parser
=
etree
.
HTMLParser
(
remove_comments
=
True
)
parser
.
feed
(
text
)
root
=
parser
.
close
()
table_list
=
root
.
xpath
(
'//table[@id="SELENIUM-TEST"]'
)
table
=
table_list
[
0
]
listbox
=
[]
i
=
0
# Insert only the content of tbody
for
table
in
table_list
:
listbox
.
append
(
newTempBase
(
context
.
getPortalObject
(),
''
,
title
=
"Tested Chapter "
+
str
(
i
),
tag
=
'h1'
))
if
len
(
table
)
>
0
:
for
row
in
table
[
-
1
]:
if
(
row
.
tag
.
lower
()
==
'tr'
):
listbox
.
append
(
newTempBase
(
context
.
getPortalObject
(),
''
,
title
=
row
[
0
][
0
].
text
,
tag
=
'tr'
,
arg0
=
row
[
0
][
1
].
text
,
arg1
=
row
[
0
][
2
].
text
))
else
:
listbox
.
append
(
newTempBase
(
context
.
getPortalObject
(),
''
,
title
=
row
[
0
][
0
].
text
,
tag
=
'tr'
,
arg0
=
row
[
0
][
1
].
text
,
arg1
=
row
[
0
][
2
].
text
))
stack
=
[
html
[
1
]]
# Let's display everything in the test by removing the style attributes (they're not supposed to have any style attributes at all during the tests)
while
stack
:
element
=
stack
.
pop
()
if
element
.
attrib
.
has_key
(
'style'
):
del
element
.
attrib
[
'style'
]
for
child
in
element
:
stack
.
append
(
child
)
return
dict
(
title
=
title
,
text
=
lxml
.
html
.
tostring
(
html
))
"""
Return the content of a web page
"""
def
urlread
(
url
):
import
urllib
return
urllib
.
urlopen
(
url
).
read
()
"""
Remove everything but the test in a webpage
"""
def
extractTest
(
text
):
import
lxml.html
from
lxml
import
etree
root
=
lxml
.
html
.
fromstring
(
text
)
table_list
=
root
.
xpath
(
'//test'
)
testcode
=
""
for
table
in
table_list
:
table
=
table
[
0
]
if
len
(
table
)
>
0
:
for
row
in
table
[
-
1
]:
if
len
(
row
)
==
1
:
# Include Macros as it is defined by the user.
testcode
+=
row
[
0
].
text
else
:
testcode
+=
lxml
.
html
.
tostring
(
row
)
return
testcode
"""
HTML5 Presentation validador
"""
def
validateHTML5Document
(
text
):
import
lxml.html
from
lxml
import
etree
root
=
lxml
.
html
.
fromstring
(
text
)
section_list
=
root
.
xpath
(
'//section'
)
count
=
0
error_list
=
[]
# XXX Lack of translation support here.
for
section
in
section_list
:
count
+=
1
if
section
.
xpath
(
"h1"
)
==
[]:
error_list
.
append
(
"Section %s had no h1."
%
count
)
if
section
.
get
(
"class"
)
in
[
"screenshot"
,
"illustration"
]:
if
section
.
xpath
(
"img"
)
==
[]:
error_list
.
append
(
"Section %s has class %s but it doesn't have any image."
%
(
count
,
section
.
get
(
"class"
)))
else
:
if
section
.
xpath
(
"img"
)[
0
].
get
(
"title"
)
==
None
:
error_list
.
append
(
"At section %s, img has no title attribute."
%
count
)
if
section
.
xpath
(
"img"
)[
0
].
get
(
"alt"
)
==
None
:
error_list
.
append
(
"At section %s, img has no alt attribute."
%
count
)
if
section
.
xpath
(
"details"
)
==
[]:
error_list
.
append
(
"Section %s has no details tag."
%
(
count
))
return
error_list
bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py
deleted
100644 → 0
View file @
9ef6a126
This diff is collapsed.
Click to expand it.
bt5/erp5_run_my_doc/bt/template_extension_id_list
deleted
100644 → 0
View file @
9ef6a126
ERP5RunMyDocs
\ No newline at end of file
bt5/erp5_run_my_doc/bt/template_test_id_list
deleted
100644 → 0
View file @
9ef6a126
testRunMyDoc
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment