1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/* global describe it cy beforeEach require afterEach Cypress */
var helper = require('../../common/helper');
var impressHelper = require('../../common/impress_helper');
var desktopHelper = require('../../common/desktop_helper');
describe('Top toolbar tests.', function() {
var testFileName = 'top_toolbar.odp';
beforeEach(function() {
helper.beforeAll(testFileName, 'impress');
if (Cypress.env('INTEGRATION') === 'nextcloud') {
desktopHelper.hideSidebarIfVisible();
} else {
desktopHelper.hideSidebar();
}
impressHelper.selectTextShapeInTheCenter();
});
afterEach(function() {
helper.afterAll(testFileName, this.currentTest.state);
});
it('Apply bold on text shape.', function() {
cy.get('#tb_editbar_item_bold')
.click();
impressHelper.triggerNewSVGForShapeInTheCenter();
cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
.should('have.attr', 'font-weight', '700');
});
it('Apply italic on text shape.', function() {
cy.get('#tb_editbar_item_italic')
.click();
impressHelper.triggerNewSVGForShapeInTheCenter();
cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
.should('have.attr', 'font-style', 'italic');
});
it('Apply underline on text shape.', function() {
cy.get('#tb_editbar_item_underline')
.click();
impressHelper.triggerNewSVGForShapeInTheCenter();
cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
.should('have.attr', 'text-decoration', 'underline');
});
it('Apply strikethrough on text shape.', function() {
cy.get('#tb_editbar_item_strikeout')
.click();
impressHelper.triggerNewSVGForShapeInTheCenter();
cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
.should('have.attr', 'text-decoration', 'line-through');
});
it('Apply font color on text shape.', function() {
cy.get('#tb_editbar_item_fontcolor')
.click();
desktopHelper.selectColorFromPalette('FF011B');
impressHelper.triggerNewSVGForShapeInTheCenter();
cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextShape .TextParagraph .TextPosition tspan')
.should('have.attr', 'fill', 'rgb(255,1,27)');
});
it('Apply highlight color on text shape.', function() {
cy.get('#tb_editbar_item_backcolor')
.click();
desktopHelper.selectColorFromPalette('FF9838');
impressHelper.triggerNewSVGForShapeInTheCenter();
cy.wait(500);
//highlight color is not in the SVG
// that's why we didn't test there
});
it('Apply left/right alignment on text seleced text.', function() {
cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph .TextPosition')
.should('have.attr', 'x', '1400');
// Set right alignment first
impressHelper.selectTextOfShape();
cy.get('#tb_editbar_item_rightpara')
.click();
impressHelper.triggerNewSVGForShapeInTheCenter();
cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph .TextPosition')
.should('have.attr', 'x', '24526');
// Set left alignment
impressHelper.selectTextOfShape();
cy.get('#tb_editbar_item_leftpara')
.click();
impressHelper.triggerNewSVGForShapeInTheCenter();
cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph .TextPosition')
.should('have.attr', 'x', '1400');
});
});
|