Commit 5be69ea3 authored by Boris Kocherov's avatar Boris Kocherov Committed by Vincent Bechu

[erp5_only_office][erp5_officejs_ui_test] prevent creating empty zip archive during save

parent 7ba249f0
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
</tr> </tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td> <td tal:content="python: 'test_presentation_%s' % DateTime().strftime('%Y%m%d%H%M%S')">Titre</td>
<td>title</td> <td>title</td>
</tr> </tr>
<tr> <tr>
...@@ -181,36 +181,14 @@ ...@@ -181,36 +181,14 @@
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_presentation"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_presentation"/>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/save"/>
<td>click</td>
<td>//button[@data-i18n='Save']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Document']</td> <td>//a[@data-i18n='Document']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<td>waitForElementPresent</td> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_presentation"/>
<td>link=Add</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>link=${title}</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=${title}</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
......
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
</tr> </tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td> <td tal:content="python: 'test_spreadsheet_%s' % DateTime().strftime('%Y%m%d%H%M%S')">Titre</td>
<td>title</td> <td>title</td>
</tr> </tr>
<tr> <tr>
...@@ -181,36 +181,14 @@ ...@@ -181,36 +181,14 @@
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/save"/>
<td>click</td>
<td>//button[@data-i18n='Save']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Document']</td> <td>//a[@data-i18n='Document']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<td>waitForElementPresent</td> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<td>link=Add</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>link=${title}</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=${title}</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
......
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
</tr> </tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td>Titre</td> <td tal:content="python: 'test_text_%s' % DateTime().strftime('%Y%m%d%H%M%S')">Titre</td>
<td>title</td> <td>title</td>
</tr> </tr>
<tr> <tr>
...@@ -181,22 +181,14 @@ ...@@ -181,22 +181,14 @@
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/save"/>
<td>click</td>
<td>//button[@data-i18n='Save']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Document']</td> <td>//a[@data-i18n='Document']</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
......
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal" <tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"> xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="wait_for_load_spreadsheet"> <tal:block metal:define-macro="wait_for_load_spreadsheet">
<!-- Wait for OnlyOffice run --> <tr>
<td colspan="3"><b>Wait for load OnlyOffice</b></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td> <td>//div[@class='asc-loadmask-title']</td>
...@@ -19,7 +21,9 @@ ...@@ -19,7 +21,9 @@
</tr> </tr>
</tal:block> </tal:block>
<tal:block metal:define-macro="wait_for_load"> <tal:block metal:define-macro="wait_for_load">
<!-- Wait for OnlyOffice run --> <tr>
<td colspan="3"><b>Wait for load OnlyOffice</b></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td> <td>//div[@class='asc-loadmask-title']</td>
...@@ -36,8 +40,10 @@ ...@@ -36,8 +40,10 @@
<td></td> <td></td>
</tr> </tr>
</tal:block> </tal:block>
<tal:block metal:define-macro="wait_for_load_presentation"> <tal:block metal:define-macro="wait_for_load_presentation">
<!-- Wait for OnlyOffice run --> <tr>
<td colspan="3"><b>Wait for load OnlyOffice</b></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td> <td>//div[@class='asc-loadmask-title']</td>
......
/*global window, rJS, RSVP, DocsAPI, console, document, /*global window, rJS, RSVP, DocsAPI, console, document,
Common, require, jIO, URL, FileReader, atob, ArrayBuffer, Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Uint8Array, XMLHttpRequest, Blob, Rusha*/ Uint8Array, XMLHttpRequest, Blob, Rusha, define*/
/*jslint nomen: true, maxlen:80, indent:2*/ /*jslint nomen: true, maxlen:80, indent:2*/
"use strict"; "use strict";
if (Common === undefined) { if (Common === undefined) {
...@@ -277,7 +277,7 @@ DocsAPI.DocEditor.version = function () { ...@@ -277,7 +277,7 @@ DocsAPI.DocEditor.version = function () {
return g.props.value_zip_storage.getAttachment('/', 'body.txt') return g.props.value_zip_storage.getAttachment('/', 'body.txt')
.push(undefined, function (error) { .push(undefined, function (error) {
if (error.status_code === 404) { if (error.status_code === 404) {
throw 'not supported format of document: "' + throw 'not supported format of document: body.txt absent "' +
value.slice(0, 100) + '"'; value.slice(0, 100) + '"';
} }
throw error; throw error;
...@@ -395,7 +395,7 @@ DocsAPI.DocEditor.version = function () { ...@@ -395,7 +395,7 @@ DocsAPI.DocEditor.version = function () {
require.onError = function (error) { require.onError = function (error) {
console.error(error); console.error(error);
}; };
require.config({catchError:true}); require.config({catchError: true});
if (g.props.binary_loader) { if (g.props.binary_loader) {
g.props.base_url = "onlyoffice-bin/"; g.props.base_url = "onlyoffice-bin/";
...@@ -441,7 +441,20 @@ DocsAPI.DocEditor.version = function () { ...@@ -441,7 +441,20 @@ DocsAPI.DocEditor.version = function () {
} }
}) })
.push(function () { .push(function () {
return zip.getAttachment('/', '/'); return zip.getAttachment('/', 'body.txt')
.push(undefined, function (error) {
if (error.status_code === 404) {
return "";
}
throw error;
});
})
.push(function (Editor_bin) {
if (Editor_bin) {
return zip.getAttachment('/', '/');
} else {
return new Blob();
}
}) })
.push(function (zip_blob) { .push(function (zip_blob) {
return jIO.util.readBlobAsDataURL(zip_blob); return jIO.util.readBlobAsDataURL(zip_blob);
......
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