Commit ce223b2b authored by Arnaud Fontaine's avatar Arnaud Fontaine

Implement Extensions for Functional Test to be able to check whether a report has been generated.

parent 10538c49
...@@ -40,3 +40,34 @@ def appendTestToWebPage(text, test_text): ...@@ -40,3 +40,34 @@ def appendTestToWebPage(text, test_text):
else: else:
root.replace(table_list[0], tutorial_test) root.replace(table_list[0], tutorial_test)
return lxml.html.tostring(root).replace('\n','').replace("\'","'") return lxml.html.tostring(root).replace('\n','').replace("\'","'")
from App.config import getConfiguration
import os
def prepareReportDirectory(self, expected_filename):
"""
Remove existing report with the given filename if any. This must be called
before a report button is clicked
"""
filename_path = os.path.join(getConfiguration().instancehome, 'var',
expected_filename)
if os.path.exists(filename_path):
os.remove(filename_path)
return 'Done'
def isReportGenerated(self, expected_filename):
"""
Check that the report has been generated. Firefox will not prompt for PDF
files as defined in ERP5Type.tests.ERP5TypeFunctionalTestCase.Firefox in
getPrefJs() method
"""
filename_path = os.path.join(getConfiguration().instancehome, 'var',
expected_filename)
if os.path.isfile(filename_path):
os.remove(filename_path)
return 'Done'
return 'Report not generated!'
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>isReportGenerated</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_isReportGenerated</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Zuite_isReportGenerated</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>prepareReportDirectory</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_prepareReportDirectory</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Zuite_prepareReportDirectory</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2013-04-05 arnaud.fontaine
* Implement Extensions to be able to check whether a report has been generated.
2011-10-11 Xavier 2011-10-11 Xavier
* Selenium core updated (2.6.0) * Selenium core updated (2.6.0)
* captureEntirePageScreenshot is available to take screenshots with Selenium (Firefox only) * captureEntirePageScreenshot is available to take screenshots with Selenium (Firefox only)
......
60 61
\ No newline at end of file \ No newline at end of file
...@@ -187,6 +187,7 @@ class Firefox(Browser): ...@@ -187,6 +187,7 @@ class Firefox(Browser):
os.environ['MOZ_NO_REMOTE'] = '0' os.environ['MOZ_NO_REMOTE'] = '0'
def getPrefJs(self): def getPrefJs(self):
from App.config import getConfiguration
return """ return """
// Don't ask if we want to switch default browsers // Don't ask if we want to switch default browsers
user_pref("browser.shell.checkDefaultBrowser", false); user_pref("browser.shell.checkDefaultBrowser", false);
...@@ -224,7 +225,15 @@ user_pref("capability.principal.codebase.p1.subjectName", ""); ...@@ -224,7 +225,15 @@ user_pref("capability.principal.codebase.p1.subjectName", "");
// For debugging, do not waste space on screen // For debugging, do not waste space on screen
user_pref("browser.tabs.autoHide", true); user_pref("browser.tabs.autoHide", true);
""" % (self.host, self.port)
// This is required to download reports without requiring user interaction
// (See ERP5UpgradeUtils for corresponding Extensions)
user_pref("browser.download.folderList", 2);
user_pref("browser.download.manager.showWhenStarting", false);
user_pref("browser.download.dir", "%s");
user_pref("browser.helperApps.neverAsk.saveToDisk", "application/pdf");
""" % (self.host, self.port,
os.path.join(getConfiguration().instancehome, 'var'))
class PhantomJS(Browser): class PhantomJS(Browser):
def _createRunJS(self): def _createRunJS(self):
......
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