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 @@
</tr>
<tr>
<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>
</tr>
<tr>
......@@ -181,36 +181,14 @@
<td>${description}</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_presentation"/>
<tr>
<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>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/save"/>
<tr>
<td>click</td>
<td>//a[@data-i18n='Document']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<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>
<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_presentation"/>
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@title='Description']</td>
......
......@@ -127,7 +127,7 @@
</tr>
<tr>
<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>
</tr>
<tr>
......@@ -181,36 +181,14 @@
<td>${description}</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tr>
<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>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/save"/>
<tr>
<td>click</td>
<td>//a[@data-i18n='Document']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<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>
<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_spreadsheet"/>
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@title='Description']</td>
......
......@@ -127,7 +127,7 @@
</tr>
<tr>
<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>
</tr>
<tr>
......@@ -181,22 +181,14 @@
<td>${description}</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/>
<tr>
<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>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/save"/>
<tr>
<td>click</td>
<td>//a[@data-i18n='Document']</td>
<td></td>
</tr>
<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>
<td>waitForElementPresent</td>
<td>//textarea[@title='Description']</td>
......
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<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>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
......@@ -19,7 +21,9 @@
</tr>
</tal:block>
<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>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
......@@ -36,8 +40,10 @@
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="wait_for_load_presentation">
<!-- Wait for OnlyOffice run -->
<tal:block metal:define-macro="wait_for_load_presentation">
<tr>
<td colspan="3"><b>Wait for load OnlyOffice</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
......
/*global window, rJS, RSVP, DocsAPI, console, document,
Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Uint8Array, XMLHttpRequest, Blob, Rusha*/
Uint8Array, XMLHttpRequest, Blob, Rusha, define*/
/*jslint nomen: true, maxlen:80, indent:2*/
"use strict";
if (Common === undefined) {
......@@ -277,7 +277,7 @@ DocsAPI.DocEditor.version = function () {
return g.props.value_zip_storage.getAttachment('/', 'body.txt')
.push(undefined, function (error) {
if (error.status_code === 404) {
throw 'not supported format of document: "' +
throw 'not supported format of document: body.txt absent "' +
value.slice(0, 100) + '"';
}
throw error;
......@@ -395,7 +395,7 @@ DocsAPI.DocEditor.version = function () {
require.onError = function (error) {
console.error(error);
};
require.config({catchError:true});
require.config({catchError: true});
if (g.props.binary_loader) {
g.props.base_url = "onlyoffice-bin/";
......@@ -441,7 +441,20 @@ DocsAPI.DocEditor.version = 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) {
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