summaryrefslogtreecommitdiffstats
path: root/cypress_test/integration_tests/desktop/writer/scrolling_spec.js
blob: 71a233f2640c524af25fa5e0aa61f59146b9f476 (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
/* global describe it cy beforeEach require afterEach */

var helper = require('../../common/helper');
var desktopHelper = require('../../common/desktop_helper');

describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Scroll through document', function() {
	var testFileName = 'scrolling.odt';

	beforeEach(function() {
		helper.beforeAll(testFileName, 'writer');
		desktopHelper.switchUIToCompact();

		cy.cGet('#toolbar-up .ui-scroll-right').click();
		cy.cGet('#sidebar').click({force: true});
	});

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

	it('Scrolling to bottom/top', function() {
		desktopHelper.selectZoomLevel('40');
		helper.typeIntoDocument('{ctrl}{home}');
		//scroll to bottom
		cy.cGet('#StatePageNumber').should('have.text', 'Page 1 of 4');
		desktopHelper.pressKey(2, 'pagedown');
		cy.cGet('#StatePageNumber').should('have.text', 'Page 2 of 4');
		desktopHelper.pressKey(1, 'pagedown');
		cy.cGet('#StatePageNumber').should('have.text', 'Page 3 of 4');
		desktopHelper.pressKey(1, 'pagedown');
		cy.cGet('#StatePageNumber').should('have.text', 'Page 4 of 4');
		//scroll to top
		desktopHelper.pressKey(1, 'pageup');
		cy.cGet('#StatePageNumber').should('have.text', 'Page 3 of 4');
		desktopHelper.pressKey(1, 'pageup');
		cy.cGet('#StatePageNumber').should('have.text', 'Page 2 of 4');
		desktopHelper.pressKey(2, 'pageup');
		cy.cGet('#StatePageNumber').should('have.text', 'Page 1 of 4');
	});

	it('Scrolling to left/right', function() {
		cy.cGet('#toolbar-down').click();
		desktopHelper.selectZoomLevel('200');
		//show horizontal scrollbar
		cy.cGet('.leaflet-layer').click('bottom');
		cy.wait(1000);
		helper.typeIntoDocument('{home}{end}{home}');
		cy.cGet('#test-div-horizontal-scrollbar').should('have.text', '0');
		helper.typeIntoDocument('{end}{home}{end}');
		desktopHelper.assertScrollbarPosition('horizontal', 430, 653);
	});
});