summaryrefslogtreecommitdiffstats
path: root/cypress_test/integration_tests/desktop/impress/image_operation_spec.js
blob: bdf303c1de988465f3479b7689fc3c1e9aa22df4 (plain)
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
/* global describe it require cy afterEach beforeEach */

var helper = require('../../common/helper');
var { insertImage, deleteImage, assertImageSize } = require('../../common/desktop_helper');
var desktopHelper = require('../../common/desktop_helper');
var { triggerNewSVGForShapeInTheCenter } = require('../../common/impress_helper');

describe(['tagdesktop'], 'Image Operation Tests', function() {
	var origTestFileName = 'image_operation.odp';
	var testFileName;

	beforeEach(function() {
		testFileName = helper.beforeAll(origTestFileName, 'impress');
	});

	afterEach(function() {
		helper.afterAll(testFileName, this.currentTest.state);
	});

	it('Insert/Delete image',function() {
		desktopHelper.switchUIToNotebookbar();
		insertImage();

		//make sure that image is in focus
		cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g.leaflet-control-buttons-disabled')
			.should('exist');

		deleteImage();
	});

	it('Resize image when keep ratio option enabled and disabled', function() {
		desktopHelper.switchUIToNotebookbar();
		insertImage();
		//when Keep ratio is unchecked
		assertImageSize(438, 111);

		//sidebar needs more time
		cy.cGet('#sidebar-panel').should('be.visible').wait(2000).scrollTo('bottom');

		cy.cGet('#PosSizePropertyPanelPanelExpander-label').should('be.visible').click();

		cy.cGet('#selectwidth input').clear({force:true})
			.type('10{enter}', {force:true});

		cy.cGet('#selectheight input').clear({force:true})
			.type('4{enter}', {force:true});

		triggerNewSVGForShapeInTheCenter();

		assertImageSize(463, 185);

		//Keep ratio checked
		//sidebar needs more time
		cy.cGet('#sidebar-panel').should('be.visible').wait(2000).scrollTo('bottom');

		cy.cGet('#PosSizePropertyPanelPanelExpander-label').should('be.visible').click();

		helper.waitUntilIdle('#ratio input');

		cy.cGet('#ratio input').check();

		helper.waitUntilIdle('#selectheight');

		cy.cGet('#selectheight input').clear({force:true})
			.type('5{enter}', {force:true});

		triggerNewSVGForShapeInTheCenter();

		assertImageSize(579, 232);
	});
});