Skip to content

Commit be70782

Browse files
committed
cypress: check if we update renders for styles
- annoying feature to test as it shows dummy placeholders then replaces them with image - entries are loded on demand when shown - best would be to spy on the protocol when rendering happens Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I1bfb24e7c610b26f410e7ed202ce8633ca768abf
1 parent 0bafb05 commit be70782

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

cypress_test/integration_tests/desktop/writer/stylebar_spec.js

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,56 @@ var helper = require('../../common/helper');
55
describe(['tagdesktop'], 'Test style sidebar', function() {
66

77
beforeEach(function() {
8-
helper.setupAndLoadDocument('writer/stylebar.odt');
98
cy.viewport(1920,1080);
9+
helper.setupAndLoadDocument('writer/stylebar.odt');
1010

1111
cy.cGet('#Format-tab-label').click();
1212
cy.cGet('#toolbar-up [id^="format-style-dialog"] button:visible').click();
13+
cy.cGet('#StyleListDeck').should('exist').should('be.visible');
14+
15+
cy.viewport(1000,660);
16+
17+
// show and trigger render
18+
cy.cGet('#treeview .ui-treeview-cell-text').contains('Complimentary Close')
19+
.should('exist').scrollIntoView();
20+
21+
cy.wait(2000); // stabilize
22+
});
23+
24+
function getEntry(text) {
25+
return cy.cGet('#treeview img.ui-treeview-custom-render[alt="' + text + '"]').should('exist');
26+
}
27+
28+
it('Style sidebar updates rendered preview on added style', function() {
29+
getEntry('Complimentary Close').click();
30+
31+
cy.wait(2000); // stabilize
32+
cy.cGet('#sidebar-dock-wrapper').compareSnapshot('style_initial', 0.05);
33+
34+
// open context menu and "new" dialog
35+
getEntry('Complimentary Close').rightclick();
36+
cy.cGet('#__MENU__').should('exist');
37+
cy.cGet('#__MENU__ .ui-treeview-cell-text-content').contains('New').click();
38+
39+
// add new style
40+
cy.cGet('[id^="TemplateDialog"].jsdialog').should('exist');
41+
cy.cGet('.button-primary').click();
42+
cy.cGet('[id^="TemplateDialog"].jsdialog').should('not.exist');
43+
cy.wait(2000); // stabilize
44+
45+
// check image after style was added
46+
getEntry('Complimentary Close').parent().parent().parent().parent()
47+
.find('.ui-treeview-expander-column').should('exist').click();
48+
49+
cy.wait(2000); // stabilize
50+
cy.cGet('#sidebar-dock-wrapper').compareSnapshot('style_added', 0.05);
1351
});
1452

1553
it('Style sidebar context menu on node with spaces', function() {
16-
cy.cGet('#treeview .ui-treeview-cell-text img.ui-treeview-custom-render[alt="Complimentary Close"]').click();
17-
cy.cGet('#treeview .ui-treeview-cell-text img.ui-treeview-custom-render[alt="Complimentary Close"]').rightclick();
54+
getEntry('Complimentary Close').click();
55+
getEntry('Complimentary Close').rightclick();
56+
1857
cy.cGet('#__MENU__').should('exist');
19-
cy.viewport(1000,660); // compare screenshot in normal size of screen
2058

2159
// visually check position and renders
2260
cy.wait(500);
26.3 KB
Loading
25.8 KB
Loading

0 commit comments

Comments
 (0)