Commit 290fc0b5 authored by Sven Franck's avatar Sven Franck

erp5_corporate_identity_test: add tests with pdf conversions

parent 291b2aeb
......@@ -707,8 +707,1415 @@ Note:
<td>Data updated.</td>
<td></td>
</tr>
<!-- CASE 1 (pdf) - template_test_slideshow_input_001_en_pdf -->
<tr>
<td>echo</td>
<td>CASE 1 (pdf) => template_test_slideshow_input_001_en_pdf</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_page_module/</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>001</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Export Slideshow</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>name=field_format</td>
<td>index=1</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_callDialogMethod:method</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<!-- PDF viewer has no document.title, wait for "" means pdf is loaded -->
<tr>
<td>waitForTitle</td>
<td></td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- Store this location for re-requesting -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${url}</td>
<td></td>
</tr>
<!-- Can't access pdf source inside iframe, so request page again -->
<tr>
<td>storeEval</td>
<td>function ajax(url) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("GET", url, true); xhr.responseType = "blob"; xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); xhr.send(); }, function() { xhr.abort(); }); }; ajax(storedVars["url"].split("#")[0] + "&amp;batch_mode=True");</td>
<td>pdf_source</td>
</tr>
<!-- pause to let the ajax request finish. now if the table was a async, queue
that would be nice 3/6/9/12/15000 not enough -->
<tr>
<td>pause</td>
<td>18000</td>
<td></td>
</tr>
</tal:block>
<tr>
<td>goBackAndWait</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Web Pages</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'ERP5')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>001</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- manual form submit -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<!-- only handle pdf_source (a promise!) here, because it needs to be set on
the iframe and a page-reload resets all (bad) parameters manually set -->
<tr>
<td>storeEval</td>
<td>storedVars["pdf_source"].then(function (evt) {document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter = new Blob([evt.target.response || evt.target.responseText], {"type": evt.target.getResponseHeader("Content-Type")});});</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter</td>
<td>pdf_dump</td>
</tr>
<tr>
<td>echo</td>
<td>${pdf_dump}</td>
<td></td>
</tr>
<tr>
<td>verifyNotExpression</td>
<td>${pdf_dump}</td>
<td>null</td>
</tr>
<tr>
<td>storeEval</td>
<td>function ajax(url, param) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("POST", url, true); xhr.responseType = param.dataType || ""; if (typeof param.headers === 'object' &amp;&amp; param.headers !== null) { for (k in param.headers) { if (param.headers.hasOwnProperty(k)) { xhr.setRequestHeader(k, param.headers[k]); } } } xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); if (typeof param.xhrFields === 'object' &amp;&amp; param.xhrFields !== null) { for (k in param.xhrFields) { if (param.xhrFields.hasOwnProperty(k)) { xhr[k] = param.xhrFields[k]; } } } xhr.send(param.data); }, function() { xhr.abort(); }); } var form_data = new FormData(); form_data.append("field_my_file", storedVars["pdf_dump"], "Template.Test.Slideshow-001-en.pdf"); form_data.append("form_id", "File_view"); x = ajax(storedVars["url"].split("?")[0] + "/Base_edit", {"xhrFields": {"with_credentials": true}, "data": form_data});</td>
<td>promise</td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["promise"].then(function () {document.getElementById("selenium_myiframe").src=storedVars["url"].split("?")[0]+"/File_view?portal_status_message=Data%20updated."});</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="transition_message"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Data updated.</td>
<td></td>
</tr>
<!-- generate image - template_test_slideshow_input_slide_0_001_en_bmp -->
<tr>
<td>echo</td>
<td>update => template_test_slideshow_input_slide_0_001_en_bmp</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["url"].split("?")[0]</td>
<td>screenshot_url</td>
</tr>
<tr>
<td>echo</td>
<td>${screenshot_url}</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${screenshot_url}/Document_createScreenshot?frame=0&amp;doc_id=template_test_slideshow_input_slide_0_001_en_bmp</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Screenshot updated.</td>
<td></td>
</tr>
</tal:block>
<!-- CASE 2 (pdf) - template_test_slideshow_input_004_en_pdf -->
<tr>
<td>echo</td>
<td>CASE 2 (pdf) => template_test_slideshow_input_004_en_pdf</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_page_module/</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>001</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Export Slideshow</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>name=field_format</td>
<td>index=1</td>
</tr>
<tr>
<td>check</td>
<td>name=field_display_note</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_callDialogMethod:method</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<!-- PDF viewer has no document.title, wait for "" means pdf is loaded -->
<tr>
<td>waitForTitle</td>
<td></td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- Store this location for re-requesting -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${url}</td>
<td></td>
</tr>
<!-- Can't fetch pdf source, so request page again -->
<tr>
<td>storeEval</td>
<td>function ajax(url) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("GET", url, true); xhr.responseType = "blob", xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); xhr.send(); }, function() { xhr.abort(); }); }; ajax(storedVars["url"].split("#")[0] + "&amp;batch_mode=True");</td>
<td>pdf_source</td>
</tr>
<!-- pause to let the ajax request finish. now if the table was a async, queue
that would be nice 3/6/9/12/15000 not enough-->
<tr>
<td>pause</td>
<td>18000</td>
<td></td>
</tr>
</tal:block>
<tr>
<td>goBackAndWait</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Web Pages</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'ERP5')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>004</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- manual form submit -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<!-- only handle pdf_source (a promise!) here, because it needs to be set on
the iframe and a page-reload resets all (bad) parameters manually set -->
<tr>
<td>storeEval</td>
<td>storedVars["pdf_source"].then(function (evt) {document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter = new Blob([evt.target.response || evt.target.responseText], {"type": evt.target.getResponseHeader("Content-Type")});});</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter</td>
<td>pdf_dump</td>
</tr>
<tr>
<td>echo</td>
<td>${pdf_dump}</td>
<td></td>
</tr>
<tr>
<td>verifyNotExpression</td>
<td>${pdf_dump}</td>
<td>null</td>
</tr>
<tr>
<td>storeEval</td>
<td>function ajax(url, param) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("POST", url, true); xhr.responseType = param.dataType || ""; if (typeof param.headers === 'object' &amp;&amp; param.headers !== null) { for (k in param.headers) { if (param.headers.hasOwnProperty(k)) { xhr.setRequestHeader(k, param.headers[k]); } } } xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); if (typeof param.xhrFields === 'object' &amp;&amp; param.xhrFields !== null) { for (k in param.xhrFields) { if (param.xhrFields.hasOwnProperty(k)) { xhr[k] = param.xhrFields[k]; } } } xhr.send(param.data); }, function() { xhr.abort(); }); } var form_data = new FormData(); form_data.append("field_my_file", storedVars["pdf_dump"], "Template.Test.Slideshow-004-en.pdf"); form_data.append("form_id", "File_view"); x = ajax(storedVars["url"].split("?")[0] + "/Base_edit", {"xhrFields": {"with_credentials": true}, "data": form_data});</td>
<td>promise</td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["promise"].then(function () {document.getElementById("selenium_myiframe").src=storedVars["url"].split("?")[0]+"/File_view?portal_status_message=Data%20updated."});</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="transition_message"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Data updated.</td>
<td></td>
</tr>
<!-- generate image - template_test_slideshow_input_slide_6_004_en_bmp -->
<tr>
<td>echo</td>
<td>update => template_test_slideshow_input_slide_6_004_en_bmp</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["url"].split("?")[0]</td>
<td>screenshot_url</td>
</tr>
<tr>
<td>echo</td>
<td>${screenshot_url}</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${screenshot_url}/Document_createScreenshot?frame=6&amp;doc_id=template_test_slideshow_input_slide_6_004_en_bmp</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Screenshot updated.</td>
<td></td>
</tr>
</tal:block>
<!-- CASE 3 (pdf) - template_test_slideshow_input_002_en_pdf -->
<tr>
<td>echo</td>
<td>CASE 3 (pdf) => template_test_slideshow_input_002_en_pdf</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_page_module/</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>002</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Export Slideshow</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>name=field_format</td>
<td>index=1</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_callDialogMethod:method</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<!-- PDF viewer has no document.title, wait for "" means pdf is loaded -->
<tr>
<td>waitForTitle</td>
<td></td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- Store this location for re-requesting -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${url}</td>
<td></td>
</tr>
<!-- Can't fetch pdf source, so request page again -->
<tr>
<td>storeEval</td>
<td>function ajax(url) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("GET", url, true); xhr.responseType = "blob", xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); xhr.send(); }, function() { xhr.abort(); }); }; ajax(storedVars["url"].split("#")[0] + "&amp;batch_mode=True");</td>
<td>pdf_source</td>
</tr>
<!-- pause to let the ajax request finish. now if the table was a async, queue
that would be nice 3/6/9/12/15000 not enough-->
<tr>
<td>pause</td>
<td>18000</td>
<td></td>
</tr>
</tal:block>
<tr>
<td>goBackAndWait</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Web Pages</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'ERP5')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>002</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- manual form submit -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<!-- only handle pdf_source (a promise!) here, because it needs to be set on
the iframe and a page-reload resets all (bad) parameters manually set -->
<tr>
<td>storeEval</td>
<td>storedVars["pdf_source"].then(function (evt) {document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter = new Blob([evt.target.response || evt.target.responseText], {"type": evt.target.getResponseHeader("Content-Type")});});</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter</td>
<td>pdf_dump</td>
</tr>
<tr>
<td>echo</td>
<td>${pdf_dump}</td>
<td></td>
</tr>
<tr>
<td>verifyNotExpression</td>
<td>${pdf_dump}</td>
<td>null</td>
</tr>
<tr>
<td>storeEval</td>
<td>function ajax(url, param) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("POST", url, true); xhr.responseType = param.dataType || ""; if (typeof param.headers === 'object' &amp;&amp; param.headers !== null) { for (k in param.headers) { if (param.headers.hasOwnProperty(k)) { xhr.setRequestHeader(k, param.headers[k]); } } } xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); if (typeof param.xhrFields === 'object' &amp;&amp; param.xhrFields !== null) { for (k in param.xhrFields) { if (param.xhrFields.hasOwnProperty(k)) { xhr[k] = param.xhrFields[k]; } } } xhr.send(param.data); }, function() { xhr.abort(); }); } var form_data = new FormData(); form_data.append("field_my_file", storedVars["pdf_dump"], "Template.Test.Slideshow-002-en.pdf"); form_data.append("form_id", "File_view"); x = ajax(storedVars["url"].split("?")[0] + "/Base_edit", {"xhrFields": {"with_credentials": true}, "data": form_data});</td>
<td>promise</td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["promise"].then(function () {document.getElementById("selenium_myiframe").src=storedVars["url"].split("?")[0]+"/File_view?portal_status_message=Data%20updated."});</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="transition_message"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Data updated.</td>
<td></td>
</tr>
<!-- generate image - template_test_slideshow_input_slide_0_002_en_bmp -->
<tr>
<td>echo</td>
<td>update => template_test_slideshow_input_slide_0_002_en_bmp</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["url"].split("?")[0]</td>
<td>screenshot_url</td>
</tr>
<tr>
<td>echo</td>
<td>${screenshot_url}</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${screenshot_url}/Document_createScreenshot?frame=0&amp;doc_id=template_test_slideshow_input_slide_0_002_en_bmp</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Screenshot updated.</td>
<td></td>
</tr>
</tal:block>
<!-- CASE 4 (pdf) - template_test_slideshow_input_003_en_pdf -->
<tr>
<td>echo</td>
<td>CASE 4 (pdf) => template_test_slideshow_input_003_en_pdf</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_page_module/</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>002</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Export Slideshow</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>name=field_format</td>
<td>index=1</td>
</tr>
<tr>
<td>type</td>
<td>name=field_override_logo_reference</td>
<td>Template.Test.Image.Erp5.Logo</td>
</tr>
<tr>
<td>type</td>
<td>name=field_override_source_organisation_title</td>
<td>Couscous</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_callDialogMethod:method</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<!-- PDF viewer has no document.title, wait for "" means pdf is loaded -->
<tr>
<td>waitForTitle</td>
<td></td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- Store this location for re-requesting -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${url}</td>
<td></td>
</tr>
<!-- Can't fetch pdf source, so request page again -->
<tr>
<td>storeEval</td>
<td>function ajax(url) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("GET", url, true); xhr.responseType = "blob", xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); xhr.send(); }, function() { xhr.abort(); }); }; ajax(storedVars["url"].split("#")[0] + "&amp;batch_mode=True");</td>
<td>pdf_source</td>
</tr>
<!-- pause to let the ajax request finish. now if the table was a async, queue
that would be nice, 3/6/9/12/15000 not enough -->
<tr>
<td>pause</td>
<td>18000</td>
<td></td>
</tr>
</tal:block>
<tr>
<td>goBackAndWait</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Web Pages</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'ERP5')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>003</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- manual form submit -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<!-- only handle pdf_source (a promise!) here, because it needs to be set on
the iframe and a page-reload resets all (bad) parameters manually set -->
<tr>
<td>storeEval</td>
<td>storedVars["pdf_source"].then(function (evt) {document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter = new Blob([evt.target.response || evt.target.responseText], {"type": evt.target.getResponseHeader("Content-Type")});});</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter</td>
<td>pdf_dump</td>
</tr>
<tr>
<td>echo</td>
<td>${pdf_dump}</td>
<td></td>
</tr>
<tr>
<td>verifyNotExpression</td>
<td>${pdf_dump}</td>
<td>null</td>
</tr>
<tr>
<td>storeEval</td>
<td>function ajax(url, param) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("POST", url, true); xhr.responseType = param.dataType || ""; if (typeof param.headers === 'object' &amp;&amp; param.headers !== null) { for (k in param.headers) { if (param.headers.hasOwnProperty(k)) { xhr.setRequestHeader(k, param.headers[k]); } } } xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); if (typeof param.xhrFields === 'object' &amp;&amp; param.xhrFields !== null) { for (k in param.xhrFields) { if (param.xhrFields.hasOwnProperty(k)) { xhr[k] = param.xhrFields[k]; } } } xhr.send(param.data); }, function() { xhr.abort(); }); } var form_data = new FormData(); form_data.append("field_my_file", storedVars["pdf_dump"], "Template.Test.Slideshow-003-en.pdf"); form_data.append("form_id", "File_view"); x = ajax(storedVars["url"].split("?")[0] + "/Base_edit", {"xhrFields": {"with_credentials": true}, "data": form_data});</td>
<td>promise</td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["promise"].then(function () {document.getElementById("selenium_myiframe").src=storedVars["url"].split("?")[0]+"/File_view?portal_status_message=Data%20updated."});</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="transition_message"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Data updated.</td>
<td></td>
</tr>
<!-- generate image - template_test_slideshow_input_slide_0_003_en_bmp -->
<tr>
<td>echo</td>
<td>update => template_test_slideshow_input_slide_0_003_en_bmp</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["url"].split("?")[0]</td>
<td>screenshot_url</td>
</tr>
<tr>
<td>echo</td>
<td>${screenshot_url}</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${screenshot_url}/Document_createScreenshot?frame=0&amp;doc_id=template_test_slideshow_input_slide_0_003_en_bmp</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Screenshot updated.</td>
<td></td>
</tr>
</tal:block>
<!-- CASE 5 (pdf) - template_test_slideshow_input_005_de_pdf -->
<tr>
<td>echo</td>
<td>CASE 5 (pdf) => template_test_slideshow_input_005_de_pdf</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_page_module/</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>003</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@class="import_export"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Export Slideshow</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>name=field_format</td>
<td>index=1</td>
</tr>
<tr>
<td>check</td>
<td>name=field_display_note</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_callDialogMethod:method</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<!-- PDF viewer has no document.title, wait for "" means pdf is loaded -->
<tr>
<td>waitForTitle</td>
<td></td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- Store this location for re-requesting -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${url}</td>
<td></td>
</tr>
<!-- Can't fetch pdf source, so request page again -->
<tr>
<td>storeEval</td>
<td>function ajax(url) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("GET", url, true); xhr.responseType = "blob", xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); xhr.send(); }, function() { xhr.abort(); }); }; ajax(storedVars["url"].split("#")[0] + "&amp;batch_mode=True");</td>
<td>pdf_source</td>
</tr>
<!-- pause to let the ajax request finish. now if the table was a async, queue
that would be nice, 3/6/9/12/15000 not enough-->
<tr>
<td>pause</td>
<td>18000</td>
<td></td>
</tr>
</tal:block>
<tr>
<td>goBackAndWait</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Web Pages</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'ERP5')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Documents')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>005</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tal:block tal:condition="python: no_file_update == False">
<!-- manual form submit -->
<tr>
<td>storeLocation</td>
<td>url</td>
<td></td>
</tr>
<!-- only handle pdf_source (a promise!) here, because it needs to be set on
the iframe and a page-reload resets all (bad) parameters manually set -->
<tr>
<td>storeEval</td>
<td>storedVars["pdf_source"].then(function (evt) {document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter = new Blob([evt.target.response || evt.target.responseText], {"type": evt.target.getResponseHeader("Content-Type")});});</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.getElementById("selenium_myiframe").contentDocument.body.bad_pdf_parameter</td>
<td>pdf_dump</td>
</tr>
<tr>
<td>echo</td>
<td>${pdf_dump}</td>
<td></td>
</tr>
<tr>
<td>verifyNotExpression</td>
<td>${pdf_dump}</td>
<td>null</td>
</tr>
<tr>
<td>storeEval</td>
<td>function ajax(url, param) { var xhr = new XMLHttpRequest(); return new Promise(function(resolve, reject) { var k; xhr.open("POST", url, true); xhr.responseType = param.dataType || ""; if (typeof param.headers === 'object' &amp;&amp; param.headers !== null) { for (k in param.headers) { if (param.headers.hasOwnProperty(k)) { xhr.setRequestHeader(k, param.headers[k]); } } } xhr.addEventListener("load", function(e) { if (e.target.status >= 400) { return reject(e); } resolve(e); }); xhr.addEventListener("error", reject); if (typeof param.xhrFields === 'object' &amp;&amp; param.xhrFields !== null) { for (k in param.xhrFields) { if (param.xhrFields.hasOwnProperty(k)) { xhr[k] = param.xhrFields[k]; } } } xhr.send(param.data); }, function() { xhr.abort(); }); } var form_data = new FormData(); form_data.append("field_my_file", storedVars["pdf_dump"], "Template_test_slideshow_005_de_pdf"); form_data.append("form_id", "File_view"); x = ajax(storedVars["url"].split("?")[0] + "/Base_edit", {"xhrFields": {"with_credentials": true}, "data": form_data});</td>
<td>promise</td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["promise"].then(function () {document.getElementById("selenium_myiframe").src=storedVars["url"].split("?")[0]+"/File_view?portal_status_message=Data%20updated."});</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="transition_message"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Data updated.</td>
<td></td>
</tr>
<!-- generate image - template_test_slideshow_input_slide_7_005_de_bmp -->
<tr>
<td>echo</td>
<td>update => template_test_slideshow_input_slide_7_005_de_bmp</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars["url"].split("?")[0]</td>
<td>screenshot_url</td>
</tr>
<tr>
<td>echo</td>
<td>${screenshot_url}</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${screenshot_url}/Document_createScreenshot?frame=7&amp;doc_id=template_test_slideshow_input_slide_7_005_de_bmp</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Screenshot updated.</td>
<td></td>
</tr>
</tal:block>
<!-- make sure print exchange works -->
<tr>
<td>echo</td>
<td>ACTION => PRINT</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_page_module/</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>001</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@class="print"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@class="print"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Print As Slideshow</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_showUpdateDialog:method</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="transition_message"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Preview updated.</td>
<td></td>
</tr>
<!-- make sure action slideshow view works -->
<tr>
<td>echo</td>
<td>print dialog</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_page_module/</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>records</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_reference</td>
<td>Template.Test.Slideshow</td>
</tr>
<tr>
<td>type</td>
<td>name=listbox_version</td>
<td>001</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>listbox_version</td>
<td>\13</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Template Test Slideshow</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), 'Template.Test.Slideshow')]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Short Title</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//img[@title="View As Slideshow"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//img[@title="View As Slideshow"]</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//section[@class="ci-slideshow-intro present"]</td>
<td></td>
</tr>
</tal:block>
</tbody>
</table>
</body>
......
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