Skip to content

Commit 8a984a7

Browse files
committed
bring 4252 up to date
1 parent 93391e5 commit 8a984a7

File tree

22 files changed

+19839
-28900
lines changed

22 files changed

+19839
-28900
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
describe('createContent Tests', () => {
2+
beforeEach(() => {
3+
cy.autologin();
4+
cy.createContent({
5+
contentType: 'Document',
6+
contentId: 'comments-page',
7+
contentTitle: 'Comments Page',
8+
allow_discussion: true,
9+
});
10+
cy.setRegistry(
11+
'plone.app.discussion.interfaces.IDiscussionSettings.globally_enabled',
12+
true,
13+
);
14+
cy.createContent({
15+
contentType: 'Document',
16+
contentId: 'my-first-page',
17+
contentTitle: 'My First Page',
18+
});
19+
cy.createContent({
20+
contentType: 'Document',
21+
contentId: 'my-second-page',
22+
contentTitle: 'My Second Page',
23+
});
24+
});
25+
26+
it('As editor I can autosave when editing a content item', () => {
27+
cy.visit('/my-first-page');
28+
29+
cy.log('adding a text block on the first page');
30+
31+
cy.navigate('/my-first-page/edit');
32+
cy.getSlateEditorAndType('My first text').contains('My first text');
33+
cy.wait(1000);
34+
35+
cy.visit('/my-second-page');
36+
37+
cy.log('adding a text block on the second page');
38+
cy.navigate('/my-second-page/edit');
39+
40+
cy.getSlateEditorAndType('My second text').contains('My second text');
41+
cy.wait(1000);
42+
43+
cy.log('visit first page and start editing');
44+
45+
cy.visit('/my-first-page');
46+
cy.navigate('/my-first-page/edit');
47+
cy.wait(1000);
48+
49+
cy.findByRole('alert')
50+
.get('.toast-inner-content')
51+
.contains('Autosaved content found')
52+
.get('button.ui.icon.button.save.toast-box')
53+
.eq(0)
54+
.click();
55+
56+
cy.wait(1000);
57+
58+
cy.getSlate().contains('My first text');
59+
60+
cy.log('visit second page and start editing');
61+
62+
cy.visit('/my-second-page');
63+
cy.navigate('/my-second-page/edit');
64+
cy.wait(1000);
65+
66+
cy.findByRole('alert')
67+
.get('.toast-inner-content')
68+
.contains('Autosaved content found')
69+
.get('button.ui.icon.button.save.toast-box')
70+
.eq(0)
71+
.click();
72+
73+
cy.wait(1000);
74+
75+
cy.getSlate().contains('My second text');
76+
cy.reload();
77+
78+
cy.log(
79+
'test is cancel load data will delete from storage (toast does not show)',
80+
);
81+
cy.findByRole('alert')
82+
.get('.toast-inner-content')
83+
.contains('Autosaved content found')
84+
.get('button.ui.icon.button.save.toast-box')
85+
.eq(1)
86+
.click();
87+
88+
cy.wait(1000);
89+
cy.reload();
90+
91+
cy.wait(1000);
92+
93+
cy.contains('Autosaved content found').should('not.exist');
94+
});
95+
96+
it('As editor I can autosave when adding a content item', function () {
97+
cy.visit('/');
98+
99+
cy.log(
100+
'adding a Document content type and refresh to verify if content is autosaved and retrieved',
101+
);
102+
cy.get('#toolbar-add').click().get('#toolbar-add-document').click();
103+
cy.getSlateTitle().type('Page 1 title');
104+
cy.getSlateEditorAndType('Page 1 content').contains('Page 1 content');
105+
cy.wait(1000);
106+
cy.reload();
107+
108+
cy.log('test if autosaved toast shows retrieved data and click OK to load');
109+
cy.findByRole('alert')
110+
.get('.toast-inner-content')
111+
.contains('Autosaved content found')
112+
.get('button.ui.icon.button.save.toast-box')
113+
.eq(0)
114+
.click();
115+
116+
cy.wait(1000);
117+
118+
cy.log('test if autosaved data is loaded');
119+
cy.getSlateTitle().contains('Page 1 title');
120+
cy.getSlate().contains('Page 1 content');
121+
122+
cy.log(
123+
'test if draft is autosaved after I cancel adding a new page content type',
124+
);
125+
126+
cy.get('button.button.cancel').click();
127+
128+
cy.wait(1000);
129+
130+
cy.get('#toolbar-add').click().get('#toolbar-add-document').click();
131+
132+
cy.findByRole('alert')
133+
.get('.toast-inner-content')
134+
.contains('Autosaved content found')
135+
.get('button.ui.icon.button.save.toast-box')
136+
.eq(0)
137+
.click();
138+
139+
cy.wait(1000);
140+
cy.getSlateTitle().contains('Page 1 title');
141+
cy.getSlate().contains('Page 1 content');
142+
143+
cy.wait(1000);
144+
145+
cy.log('test if page content type is added as new page after Toolbar Save');
146+
147+
cy.get('#toolbar-save').focus().click();
148+
cy.wait(2000);
149+
cy.contains('Page 1 title');
150+
cy.wait(1000);
151+
152+
cy.log('test draft is deleted from local storage after save');
153+
154+
cy.visit('/');
155+
cy.get('#toolbar-add').click().get('#toolbar-add-document').click();
156+
157+
cy.wait(1000);
158+
159+
cy.contains('Autosaved content found').should('not.exist');
160+
});
161+
162+
it('As editor I can autosave comments', function () {
163+
cy.log('adding a comment and refresh,');
164+
cy.visit('/comments-page');
165+
cy.get('textarea[id="field-comment"]').clear().type('This is a comment');
166+
cy.wait(1000);
167+
cy.reload();
168+
169+
cy.log('test if comment is retrieved from local storage');
170+
171+
cy.findByRole('alert')
172+
.get('.toast-inner-content')
173+
.contains('Autosaved content found')
174+
.get('button.ui.icon.button.save.toast-box')
175+
.eq(0)
176+
.click();
177+
178+
cy.get('#field-comment').contains('This is a comment');
179+
180+
cy.wait(1000);
181+
cy.reload();
182+
183+
cy.log(
184+
'test if comment is deleted from local storage after selecting Cancel in the Autosave toast',
185+
);
186+
187+
cy.findByRole('alert')
188+
.get('.toast-inner-content')
189+
.contains('Autosaved content found')
190+
.get('button.ui.icon.button.save.toast-box')
191+
.eq(1)
192+
.click();
193+
194+
cy.wait(1000);
195+
cy.reload();
196+
cy.contains('Autosaved content found').should('not.exist');
197+
198+
cy.log('adding another comment and save it');
199+
200+
cy.get('textarea[id="field-comment"]')
201+
.clear()
202+
.type('This is a another comment');
203+
cy.wait(1000);
204+
cy.reload();
205+
206+
cy.findByRole('alert')
207+
.get('.toast-inner-content')
208+
.contains('Autosaved content found')
209+
.get('button.ui.icon.button.save.toast-box')
210+
.eq(0)
211+
.click();
212+
213+
cy.wait(1000);
214+
215+
cy.get('button[type="submit"').click();
216+
217+
cy.get('.comment').contains('This is a another comment');
218+
219+
cy.log('test if the local storage comment was deleted after submit');
220+
221+
cy.wait(1000);
222+
cy.reload();
223+
cy.contains('Autosaved content found').should('not.exist');
224+
});
225+
});

packages/volto/locales/ca/LC_MESSAGES/volto.po

+15
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ msgstr ""
437437
msgid "Automatically"
438438
msgstr ""
439439

440+
#. Default: "Autosaved content found"
441+
#: helpers/Utils/withSaveAsDraft
442+
msgid "Autosaved content found"
443+
msgstr ""
444+
440445
#. Default: "Available"
441446
#: components/manage/Controlpanels/AddonsControlpanel
442447
msgid "Available"
@@ -1160,6 +1165,11 @@ msgstr "Realment voleu suprimir l'usuari {username}?"
11601165
msgid "Do you really want to delete this item?"
11611166
msgstr "Realment voleu suprimir aquest element?"
11621167

1168+
#. Default: "Do you want to restore the autosaved content?"
1169+
#: helpers/Utils/withSaveAsDraft
1170+
msgid "Do you want to restore the autosaved content?"
1171+
msgstr ""
1172+
11631173
#. Default: "Document"
11641174
#: components/manage/Multilingual/TranslationObject
11651175
#: components/manage/Sidebar/Sidebar
@@ -3785,6 +3795,11 @@ msgstr ""
37853795
msgid "The value does not match the pattern {pattern}"
37863796
msgstr ""
37873797

3798+
#. Default: "The version of the autosaved content I found in your browser is older than that stored on the server. Do you want to restore the autosaved content? (You can undo the autosaved content and revert to the server version.)"
3799+
#: helpers/Utils/withSaveAsDraft
3800+
msgid "The version of the autosaved content I found in your browser is older than that stored on the server. Do you want to restore the autosaved content? (You can undo the autosaved content and revert to the server version.)"
3801+
msgstr ""
3802+
37883803
#. Default: "The working copy was discarded"
37893804
#: components/manage/Toolbar/More
37903805
msgid "The working copy was discarded"

packages/volto/locales/de/LC_MESSAGES/volto.po

+15
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,11 @@ msgstr "Zuweisungen"
436436
msgid "Automatically"
437437
msgstr "automatisch"
438438

439+
#. Default: "Autosaved content found"
440+
#: helpers/Utils/withSaveAsDraft
441+
msgid "Autosaved content found"
442+
msgstr ""
443+
439444
#. Default: "Available"
440445
#: components/manage/Controlpanels/AddonsControlpanel
441446
msgid "Available"
@@ -1159,6 +1164,11 @@ msgstr "Möchten Sie den Nutzer {username} wirklich löschen?"
11591164
msgid "Do you really want to delete this item?"
11601165
msgstr "Möchten Sie den Artikel wirklich löschen?"
11611166

1167+
#. Default: "Do you want to restore the autosaved content?"
1168+
#: helpers/Utils/withSaveAsDraft
1169+
msgid "Do you want to restore the autosaved content?"
1170+
msgstr ""
1171+
11621172
#. Default: "Document"
11631173
#: components/manage/Multilingual/TranslationObject
11641174
#: components/manage/Sidebar/Sidebar
@@ -3784,6 +3794,11 @@ msgstr "Die Seitenkonfiguration ist veraltet und muss aktualisiert werden."
37843794
msgid "The value does not match the pattern {pattern}"
37853795
msgstr ""
37863796

3797+
#. Default: "The version of the autosaved content I found in your browser is older than that stored on the server. Do you want to restore the autosaved content? (You can undo the autosaved content and revert to the server version.)"
3798+
#: helpers/Utils/withSaveAsDraft
3799+
msgid "The version of the autosaved content I found in your browser is older than that stored on the server. Do you want to restore the autosaved content? (You can undo the autosaved content and revert to the server version.)"
3800+
msgstr ""
3801+
37873802
#. Default: "The working copy was discarded"
37883803
#: components/manage/Toolbar/More
37893804
msgid "The working copy was discarded"

packages/volto/locales/en/LC_MESSAGES/volto.po

+15
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,11 @@ msgstr ""
431431
msgid "Automatically"
432432
msgstr ""
433433

434+
#. Default: "Autosaved content found"
435+
#: helpers/Utils/withSaveAsDraft
436+
msgid "Autosaved content found"
437+
msgstr ""
438+
434439
#. Default: "Available"
435440
#: components/manage/Controlpanels/AddonsControlpanel
436441
msgid "Available"
@@ -1154,6 +1159,11 @@ msgstr ""
11541159
msgid "Do you really want to delete this item?"
11551160
msgstr ""
11561161

1162+
#. Default: "Do you want to restore the autosaved content?"
1163+
#: helpers/Utils/withSaveAsDraft
1164+
msgid "Do you want to restore the autosaved content?"
1165+
msgstr ""
1166+
11571167
#. Default: "Document"
11581168
#: components/manage/Multilingual/TranslationObject
11591169
#: components/manage/Sidebar/Sidebar
@@ -3779,6 +3789,11 @@ msgstr ""
37793789
msgid "The value does not match the pattern {pattern}"
37803790
msgstr ""
37813791

3792+
#. Default: "The version of the autosaved content I found in your browser is older than that stored on the server. Do you want to restore the autosaved content? (You can undo the autosaved content and revert to the server version.)"
3793+
#: helpers/Utils/withSaveAsDraft
3794+
msgid "The version of the autosaved content I found in your browser is older than that stored on the server. Do you want to restore the autosaved content? (You can undo the autosaved content and revert to the server version.)"
3795+
msgstr ""
3796+
37823797
#. Default: "The working copy was discarded"
37833798
#: components/manage/Toolbar/More
37843799
msgid "The working copy was discarded"

packages/volto/locales/es/LC_MESSAGES/volto.po

+15
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ msgstr "Tareas"
438438
msgid "Automatically"
439439
msgstr ""
440440

441+
#. Default: "Autosaved content found"
442+
#: helpers/Utils/withSaveAsDraft
443+
msgid "Autosaved content found"
444+
msgstr ""
445+
441446
#. Default: "Available"
442447
#: components/manage/Controlpanels/AddonsControlpanel
443448
msgid "Available"
@@ -1161,6 +1166,11 @@ msgstr "¿Esta seguro que quiere eliminar el usuario {username}?"
11611166
msgid "Do you really want to delete this item?"
11621167
msgstr "¿Usted realmente quiere eliminar este elemento?"
11631168

1169+
#. Default: "Do you want to restore the autosaved content?"
1170+
#: helpers/Utils/withSaveAsDraft
1171+
msgid "Do you want to restore the autosaved content?"
1172+
msgstr ""
1173+
11641174
#. Default: "Document"
11651175
#: components/manage/Multilingual/TranslationObject
11661176
#: components/manage/Sidebar/Sidebar
@@ -3786,6 +3796,11 @@ msgstr "La configuración del sitio está anticuada y debe ser actualizada."
37863796
msgid "The value does not match the pattern {pattern}"
37873797
msgstr ""
37883798

3799+
#. Default: "The version of the autosaved content I found in your browser is older than that stored on the server. Do you want to restore the autosaved content? (You can undo the autosaved content and revert to the server version.)"
3800+
#: helpers/Utils/withSaveAsDraft
3801+
msgid "The version of the autosaved content I found in your browser is older than that stored on the server. Do you want to restore the autosaved content? (You can undo the autosaved content and revert to the server version.)"
3802+
msgstr ""
3803+
37893804
#. Default: "The working copy was discarded"
37903805
#: components/manage/Toolbar/More
37913806
msgid "The working copy was discarded"

0 commit comments

Comments
 (0)