summaryrefslogtreecommitdiffstats
path: root/cypress_test/integration_tests/desktop/writer/track_changes_spec.js
blob: 295f7fb89c22610e76e06c8f5ef1a1ece3b90e88 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* global describe it cy beforeEach require afterEach*/

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

describe('Track Changes', function () {
	var origTestFileName = 'track_changes.odt';
	var testFileName;

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

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

	function confirmChange(action) {
		cy.get('#menu-editmenu')
			.click()
			.get('#menu-changesmenu')
			.click()
			.contains(action)
			.click();
	}

	//enable record for track changes
	function enableRecord() {
		cy.get('#menu-editmenu')
			.click()
			.get('#menu-changesmenu')
			.click()
			.contains('Record')
			.click();

		//if we don't wait , the test will fail in CLI
		cy.wait(200);

		cy.get('#menu-editmenu')
			.click()
			.get('#menu-changesmenu')
			.click()
			.contains('Record')
			.should('have.class', 'lo-menu-item-checked');

		//to close
		cy.get('#menu-changesmenu')
			.click();
	}

	it('Accept All', function () {

		helper.typeIntoDocument('Hello World');

		enableRecord();

		helper.clearAllText();
		//if we don't wait , the test will fail in CLI
		cy.wait(200);

		helper.selectAllText();

		confirmChange('Accept All');

		cy.wait(200);

		helper.typeIntoDocument('{ctrl}a');

		helper.textSelectionShouldNotExist();
	});

	it.skip('Reject All', function () {

		helper.typeIntoDocument('Hello World');

		enableRecord();

		helper.clearAllText();

		//if we don't wait , the test will fail in CLI
		cy.wait(600);

		helper.selectAllText();

		confirmChange('Reject All');

		cy.wait(200);

		cy.get('.leaflet-layer').click();

		helper.selectAllText();

		helper.expectTextForClipboard('\nHello World');
	});
});