ep_comments_page 11.0.26 → 11.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/package.json +1 -1
  2. package/static/js/index.js +16 -3
  3. package/static/tests/frontend-new/helper/comments.ts +193 -0
  4. package/static/tests/frontend-new/parked/commentDelete.spec.ts +57 -0
  5. package/static/tests/frontend-new/parked/commentEdit.spec.ts +113 -0
  6. package/static/tests/frontend-new/parked/commentIcons.spec.ts +131 -0
  7. package/static/tests/frontend-new/parked/commentReply.spec.ts +92 -0
  8. package/static/tests/frontend-new/parked/commentSuggestion.spec.ts +97 -0
  9. package/static/tests/frontend-new/parked/comment_l10n.spec.ts +63 -0
  10. package/static/tests/frontend-new/parked/comment_settings.spec.ts +47 -0
  11. package/static/tests/frontend-new/parked/newComment.spec.ts +25 -0
  12. package/static/tests/frontend-new/parked/preCommentMark.spec.ts +123 -0
  13. package/static/tests/frontend-new/parked/timeFormat.spec.ts +244 -0
  14. package/static/tests/frontend-new/parked/xcommentCopyPaste.spec.ts +29 -0
  15. package/static/tests/frontend-new/specs/smoke.spec.ts +32 -0
  16. package/static/tests/frontend/specs/commentDelete.js +0 -146
  17. package/static/tests/frontend/specs/commentEdit.js +0 -291
  18. package/static/tests/frontend/specs/commentIcons.js +0 -298
  19. package/static/tests/frontend/specs/commentReply.js +0 -200
  20. package/static/tests/frontend/specs/commentSuggestion.js +0 -100
  21. package/static/tests/frontend/specs/comment_l10n.js +0 -141
  22. package/static/tests/frontend/specs/comment_settings.js +0 -132
  23. package/static/tests/frontend/specs/newComment.js +0 -18
  24. package/static/tests/frontend/specs/preCommentMark.js +0 -241
  25. package/static/tests/frontend/specs/timeFormat.js +0 -266
  26. package/static/tests/frontend/specs/xcommentCopyPaste.js +0 -480
  27. package/static/tests/frontend/utils.js +0 -14
@@ -1,298 +0,0 @@
1
- 'use strict';
2
-
3
- let freshPad = true;
4
-
5
- before(async function () {
6
- await helper.aNewPad();
7
- // #commentIcons will only be inserted if icons are enabled
8
- if (!helper.padChrome$.window.clientVars.displayCommentAsIcon) this.skip();
9
- });
10
-
11
- // create a new pad with comment before each test run
12
- beforeEach(async function () {
13
- this.timeout(60000);
14
- if (!freshPad) await helper.aNewPad();
15
- freshPad = false;
16
- // make sure Etherpad has enough space to display comment icons
17
- enlargeScreen();
18
- // force sidebar comments to be shown
19
- chooseToShowComments(true);
20
- await createComment();
21
- });
22
-
23
- after(async function () {
24
- // undo frame resize that was done on before()
25
- $('#iframe-container iframe').css('max-width', '');
26
- });
27
-
28
- it('adds a comment icon on the same height of commented text', async function () {
29
- const inner$ = helper.padInner$;
30
- const outer$ = helper.padOuter$;
31
- const commentId = await getCommentId();
32
- const $commentIcon = outer$(`#commentIcons #icon-${commentId}`);
33
-
34
- // check icon exists
35
- expect($commentIcon.length).to.be(1);
36
-
37
- // check height is the same
38
- const $commentedText = inner$(`.${commentId}`);
39
- // all icons are +5px down to adjust position
40
- const expectedTop = $commentedText.offset().top + 5;
41
- expect($commentIcon.offset().top).to.be(expectedTop);
42
- });
43
- // TODO: Needs fixing
44
- xit('does not show comment icon when commented text is removed', async function () {
45
- const inner$ = helper.padInner$;
46
- const outer$ = helper.padOuter$;
47
- // remove commented text
48
- const $commentedLine = inner$('div .comment').parent();
49
- $commentedLine.sendkeys('{selectall}'); // select all
50
- $commentedLine.sendkeys('{del}'); // clear the first line
51
- // wait until comment deletion is done
52
- await helper.waitForPromise(() => {
53
- // check icon is not visible
54
- const $commentIcons = outer$('#commentIcons .comment-icon:visible');
55
- return $commentIcons.length === 0;
56
- });
57
- });
58
- // TODO: Needs fixing
59
- xit('does not show comment icon when comment is deleted', async function () {
60
- const outer$ = helper.padOuter$;
61
-
62
- await deleteComment();
63
- // check icon is not visible
64
- const $commentIcons = outer$('#commentIcons .comment-icon:visible');
65
- expect($commentIcons.length).to.be(0);
66
- });
67
-
68
- it('updates comment icon height when commented text is moved to another line', async function () {
69
- // don't run this test in safari. borrowed from
70
- // https://stackoverflow.com/questions/7944460/detect-safari-browser
71
- const ua = navigator.userAgent.toLowerCase();
72
- if (ua.indexOf('safari') !== -1) {
73
- if (ua.indexOf('chrome') > -1) {
74
- // Chrome
75
- } else {
76
- return this.skip();
77
- }
78
- }
79
-
80
- const inner$ = helper.padInner$;
81
- const outer$ = helper.padOuter$;
82
- const commentId = await getCommentId();
83
-
84
- // adds some new lines on the beginning of the text
85
- const $firstTextElement = inner$('div').first();
86
- $firstTextElement.sendkeys('{leftarrow}{enter}{enter}');
87
-
88
- // wait until the new lines are split into separated .ace-line's
89
- await helper.waitForPromise(() => inner$('div').length > 2);
90
-
91
- // wait until comment is visible again
92
- await helper.waitForPromise(() => {
93
- const $commentIcons = outer$('#commentIcons .comment-icon:visible');
94
- return $commentIcons.length !== 0;
95
- });
96
-
97
- // check height is the same
98
- const $commentIcon = outer$(`#commentIcons #icon-${commentId}`);
99
- const $commentedText = inner$(`.${commentId}`);
100
- // all icons are +5px down to adjust position
101
- const expectedTop = $commentedText.offset().top + 5;
102
- expect($commentIcon.offset().top).to.be(expectedTop);
103
- });
104
-
105
- it('shows comment when user clicks on comment icon', async function () {
106
- const outer$ = helper.padOuter$;
107
- const commentId = await getCommentId();
108
-
109
- // click on the icon
110
- const $commentIcon = outer$(`#commentIcons #icon-${commentId}`).first();
111
- $commentIcon.click();
112
-
113
- // check sidebar comment is visible
114
- const $openedSidebarComments = outer$('#comments .sidebar-comment:visible');
115
- expect($openedSidebarComments.length).to.be(1);
116
- });
117
-
118
- it('hides comment when user clicks on comment icon twice', async function () {
119
- // don't run this test in safari. borrowed from
120
- // https://stackoverflow.com/questions/7944460/detect-safari-browser
121
- const ua = navigator.userAgent.toLowerCase();
122
- if (ua.indexOf('safari') !== -1) {
123
- if (ua.indexOf('chrome') > -1) {
124
- // Chrome
125
- } else {
126
- return this.skip();
127
- }
128
- }
129
-
130
- const outer$ = helper.padOuter$;
131
- const commentId = await getCommentId();
132
-
133
- // click on the icon to open, then click again to close
134
- const $commentIcon = outer$(`#commentIcons #icon-${commentId}`).first();
135
- $commentIcon.click();
136
- $commentIcon.click();
137
-
138
- // check sidebar comment is not visible
139
- const $openedSidebarComments = outer$('#comments .sidebar-comment:visible');
140
- expect($openedSidebarComments.length).to.be(0);
141
- });
142
-
143
- it('hides comment when user clicks outside of comment box', async function () {
144
- // don't run this test in safari. borrowed from
145
- // https://stackoverflow.com/questions/7944460/detect-safari-browser
146
- const ua = navigator.userAgent.toLowerCase();
147
- if (ua.indexOf('safari') !== -1) {
148
- if (ua.indexOf('chrome') > -1) {
149
- // Chrome
150
- } else {
151
- return this.skip();
152
- }
153
- }
154
-
155
- const outer$ = helper.padOuter$;
156
- const commentId = await getCommentId();
157
-
158
- // click on the icon to open
159
- const $commentIcon = outer$(`#commentIcons #icon-${commentId}`).first();
160
- $commentIcon.click();
161
-
162
- // click outside the comment to hide it
163
- outer$('#outerdocbody').click();
164
-
165
- // check sidebar comment is not visible
166
- const $openedSidebarComments = outer$('#comments .sidebar-comment:visible');
167
- expect($openedSidebarComments.length).to.be(0);
168
- });
169
-
170
- it('hides 1st, shows 2nd comment when user clicks on one then another icon', async function () {
171
- // don't run this test in safari. borrowed from
172
- // https://stackoverflow.com/questions/7944460/detect-safari-browser
173
- const ua = navigator.userAgent.toLowerCase();
174
- if (ua.indexOf('safari') !== -1) {
175
- if (ua.indexOf('chrome') > -1) {
176
- // Chrome
177
- } else {
178
- return this.skip();
179
- }
180
- }
181
-
182
- const inner$ = helper.padInner$;
183
- const outer$ = helper.padOuter$;
184
-
185
- // add a second line...
186
- const $lastTextElement = inner$('div').last();
187
- $lastTextElement.sendkeys('Second line{enter}');
188
-
189
- // wait until the new line is split into a separated .ace-line
190
- await helper.waitForPromise(() => inner$('div').length > 2);
191
-
192
- // ... then add a comment to second line
193
- const $secondLine = inner$('div').eq(1);
194
- $secondLine.sendkeys('{selectall}');
195
- await addComment('Second Comment');
196
-
197
- // click on the icon of first comment...
198
- const $firstCommentIcon = outer$(`#commentIcons #icon-${await getCommentId(0)}`).first();
199
- $firstCommentIcon.click();
200
- // ... then click on the icon of last comment
201
- const $secondCommentIcon = outer$(`#commentIcons #icon-${await getCommentId(1)}`).first();
202
- $secondCommentIcon.click();
203
-
204
- // check modal is visible
205
- const $commentText = outer$('#comments .sidebar-comment:visible .comment-text').text();
206
- expect($commentText).to.be('Second Comment');
207
- });
208
-
209
- /* ********** Helper functions ********** */
210
-
211
- const createComment = async () => {
212
- const inner$ = helper.padInner$;
213
-
214
- // get the first text element out of the inner iframe
215
- const $firstTextElement = inner$('div').first();
216
-
217
- // simulate key presses to delete content
218
- $firstTextElement.sendkeys('{selectall}'); // select all
219
- $firstTextElement.sendkeys('{del}'); // clear the first line
220
- $firstTextElement.sendkeys('This content will receive a comment{enter}'); // insert text
221
- // wait until the two lines are split into two .ace-line's
222
- await helper.waitForPromise(() => inner$('div').length > 1);
223
-
224
- // add comment to last line of the text
225
- const $lastTextElement = inner$('div').first();
226
- $lastTextElement.sendkeys('{selectall}'); // need to select content to add comment to
227
-
228
- await addComment('My comment');
229
- };
230
-
231
- // Assumes text is already selected, then add comment to the selected text
232
- const addComment = async (commentText) => {
233
- const inner$ = helper.padInner$;
234
- const chrome$ = helper.padChrome$;
235
-
236
- // get original number of comments, so can check if a new comment was created
237
- const numberOfComments = inner$('.comment:visible').length;
238
-
239
- // get the comment button and click it
240
- const $commentButton = chrome$('.addComment');
241
- $commentButton.click();
242
-
243
- // fill the comment form and submit it
244
- const $commentField = chrome$('textarea.comment-content');
245
- $commentField.val(commentText);
246
- // we don't need comment suggestion to be filled for these tests, but here's how to do it:
247
- // var $hasSuggestion = outer$(".suggestion-checkbox");
248
- // $hasSuggestion.click();
249
- // var $suggestionField = outer$("textarea.to-value");
250
- // $suggestionField.val("Change to this suggestion");
251
- const $submittButton = chrome$('.comment-buttons input[type=submit]');
252
- $submittButton.click();
253
-
254
- // wait until comment is created and comment id is set
255
- await helper.waitForPromise(async () => await getCommentId(numberOfComments) != null);
256
- };
257
-
258
- const deleteComment = async () => {
259
- const chrome$ = helper.padChrome$;
260
- const outer$ = helper.padOuter$;
261
-
262
- // click on the delete button
263
- const $deleteButton = outer$('.comment-delete');
264
- $deleteButton.click();
265
-
266
- await helper.waitForPromise(() => chrome$('.sidebar-comment').is(':visible') === false);
267
- };
268
-
269
-
270
- const getCommentId = async (numberOfComments) => {
271
- const nthComment = numberOfComments || 0;
272
- await helper.waitForPromise(() => helper.padInner$);
273
- const inner$ = helper.padInner$;
274
- const comment = inner$('.comment').eq(nthComment);
275
- const cls = comment.attr('class');
276
- const classCommentId = /(?:^| )(c-[A-Za-z0-9]*)/.exec(cls);
277
- const commentId = (classCommentId) ? classCommentId[1] : null;
278
- return commentId;
279
- };
280
-
281
- const chooseToShowComments = (shouldShowComments) => {
282
- const chrome$ = helper.padChrome$;
283
-
284
- // click on the settings button to make settings visible
285
- const $settingsButton = chrome$('.buttonicon-settings');
286
- $settingsButton.click();
287
-
288
- // check "Show Comments"
289
- const $showComments = chrome$('#options-comments');
290
- if ($showComments.is(':checked') !== shouldShowComments) $showComments.click();
291
-
292
- // hide settings again
293
- $settingsButton.click();
294
- };
295
-
296
- const enlargeScreen = () => {
297
- $('#iframe-container iframe').css('max-width', '1000px');
298
- };
@@ -1,200 +0,0 @@
1
- 'use strict';
2
-
3
- describe('ep_comments_page - Comment Reply', function () {
4
- // create a new pad with comment before each test run
5
- beforeEach(function (cb) {
6
- helper.newPad(() => {
7
- chooseToShowComments(true, () => {
8
- createComment(() => {
9
- // make sure Etherpad has enough space to display comments
10
- $('#iframe-container iframe').css('max-width', '1000px');
11
- cb();
12
- });
13
- });
14
- });
15
- this.timeout(60000);
16
- });
17
-
18
- after(function (cb) {
19
- // undo what was done on before()
20
- $('#iframe-container iframe').css('max-width', '');
21
- cb();
22
- });
23
-
24
- xit('Ensures a comment can be replied', function (done) {
25
- createReply(false, () => {
26
- done();
27
- });
28
- });
29
-
30
- xit('Ensures a comment reply can have suggestion', function (done) {
31
- createReply(true, () => {
32
- const outer$ = helper.padOuter$;
33
- const $replySuggestion = outer$('.comment-changeTo-form');
34
- expect($replySuggestion.is(':visible')).to.be(true);
35
- done();
36
- });
37
- });
38
-
39
- xit('Clears the comment reply form after submitting a reply with suggestion', function (done) {
40
- createReply(true, () => {
41
- const outer$ = helper.padOuter$;
42
- const $replyForm = outer$('form.new-comment');
43
- const $replyField = $replyForm.find('.comment-content');
44
- const $replyWithSuggestionCheckbox = $replyForm.find('.suggestion-checkbox');
45
- const $replySuggestionTextarea = $replyForm.find('.to-value');
46
- expect($replyField.text()).to.be('');
47
- expect($replyWithSuggestionCheckbox.is(':checked')).to.be(false);
48
- expect($replySuggestionTextarea.text()).to.be('');
49
- done();
50
- });
51
- });
52
-
53
- xit('Replaces the original text with reply suggestion', function (done) {
54
- createReply(true, () => {
55
- const inner$ = helper.padInner$;
56
- const outer$ = helper.padOuter$;
57
-
58
- // click to accept suggested change of the reply
59
- const $replyAcceptChangeButton =
60
- outer$(".sidebar-comment-reply .comment-changeTo-form input[type='submit']")[0];
61
- $replyAcceptChangeButton.click();
62
-
63
- // check the pad text
64
- const $firstTextElement = inner$('div').first();
65
- // cake waitFor
66
- helper.waitFor(() => {
67
- console.log($firstTextElement.text());
68
- return $firstTextElement.text() === 'My suggestion';
69
- });
70
- expect($firstTextElement.text()).to.be('My suggestion');
71
-
72
- done();
73
- });
74
- });
75
-
76
- xit('Replaces orig with reply sugg. after replacing orig with comment sugg.', function (done) {
77
- createReply(true, () => {
78
- const inner$ = helper.padInner$;
79
- const outer$ = helper.padOuter$;
80
-
81
- // click to accept suggested change of the original comment
82
- const $commentAcceptChangeButton =
83
- outer$(".sidebar-comment .comment-changeTo-form input[type='submit']").first();
84
- $commentAcceptChangeButton.click();
85
-
86
- // click to accept suggested change of the reply
87
- const $replyAcceptChangeButton =
88
- outer$(".sidebar-comment-reply .comment-changeTo-form input[type='submit']");
89
- $replyAcceptChangeButton.click();
90
-
91
- // check the pad text
92
- const $firstTextElement = inner$('div').first();
93
- expect($firstTextElement.text()).to.be('My suggestion');
94
-
95
- done();
96
- });
97
- });
98
-
99
- const createComment = (callback) => {
100
- const inner$ = helper.padInner$;
101
- const outer$ = helper.padOuter$;
102
- const chrome$ = helper.padChrome$;
103
-
104
- // get the first text element out of the inner iframe
105
- const $firstTextElement = inner$('div').first();
106
-
107
- // simulate key presses to delete content
108
- $firstTextElement.sendkeys('{selectall}'); // select all
109
- $firstTextElement.sendkeys('{del}'); // clear the first line
110
- $firstTextElement.sendkeys('This content will receive a comment'); // insert text
111
-
112
- // get the comment button and click it
113
- $firstTextElement.sendkeys('{selectall}'); // needs to select content to add comment to
114
- const $commentButton = chrome$('.addComment');
115
- $commentButton.click();
116
-
117
- // fill the comment form and submit it
118
- const $commentField = chrome$('textarea.comment-content');
119
- $commentField.val('My comment');
120
- const $hasSuggestion = outer$('.suggestion-checkbox');
121
- $hasSuggestion.click();
122
- const $suggestionField = outer$('textarea.to-value');
123
- $suggestionField.val('Change to this suggestion');
124
- const $submittButton = chrome$('.comment-buttons input[type=submit]');
125
- $submittButton.click();
126
-
127
- // wait until comment is created and comment id is set
128
- helper.waitFor(() => getCommentId() != null)
129
- .done(callback);
130
- };
131
-
132
- const createReply = (withSuggestion, callback) => {
133
- const outer$ = helper.padOuter$;
134
- const commentId = getCommentId();
135
- const existingReplies = outer$('.sidebar-comment-reply').length;
136
-
137
- // if comment icons are enabled, make sure we display the comment box:
138
- if (commentIconsEnabled()) {
139
- // click on the icon
140
- const $commentIcon = outer$(`#commentIcons #icon-${commentId}`).first();
141
- $commentIcon.click();
142
- }
143
-
144
- // fill reply field
145
- const $replyField = outer$('.comment-content');
146
- $replyField.val('My reply');
147
-
148
- // fill suggestion
149
- if (withSuggestion) {
150
- // show suggestion field
151
- const $replySuggestionCheckbox = outer$('.suggestion-checkbox');
152
- $replySuggestionCheckbox.click();
153
-
154
- // fill suggestion field
155
- const $suggestionField = outer$('textarea.to-value');
156
- $suggestionField.val('My suggestion');
157
- }
158
-
159
- // submit reply
160
- const $submitReplyButton = outer$("form.new-comment input[type='submit']").first();
161
- $submitReplyButton.click();
162
-
163
- // wait for the reply to be saved
164
- helper.waitFor(() => outer$('.sidebar-comment-reply').length === existingReplies + 1)
165
- .done(callback);
166
- };
167
-
168
- const getCommentId = () => {
169
- helper.waitFor(() => {
170
- const inner$ = helper.padInner$;
171
- if (inner$) return true;
172
- }).done(() => {
173
- const inner$ = helper.padInner$;
174
- const comment = inner$('.comment').first();
175
- const cls = comment.attr('class');
176
- const classCommentId = /(?:^| )(c-[A-Za-z0-9]*)/.exec(cls);
177
- const commentId = (classCommentId) ? classCommentId[1] : null;
178
- return commentId;
179
- });
180
- };
181
-
182
- const chooseToShowComments = (shouldShowComments, callback) => {
183
- const chrome$ = helper.padChrome$;
184
-
185
- // click on the settings button to make settings visible
186
- const $settingsButton = chrome$('.buttonicon-settings');
187
- $settingsButton.click();
188
-
189
- // check "Show Comments"
190
- const $showComments = chrome$('#options-comments');
191
- if ($showComments.is(':checked') !== shouldShowComments) $showComments.click();
192
-
193
- // hide settings again
194
- $settingsButton.click();
195
-
196
- callback();
197
- };
198
-
199
- const commentIconsEnabled = () => helper.padOuter$('#commentIcons').length > 0;
200
- });
@@ -1,100 +0,0 @@
1
- 'use strict';
2
-
3
- const utils = require('../utils');
4
-
5
- // create a new pad before each test run
6
- beforeEach(async function () {
7
- this.timeout(60000);
8
- await utils.aNewPad();
9
- });
10
-
11
- it('Fills suggestion Change From field when adding a comment with suggestion', async function () {
12
- const chrome$ = helper.padChrome$;
13
-
14
- // As in the function openCommentFormWithSuggestion we send all the text and call 'selectall',
15
- // we select the beginning of line as well. This situation does not happen in the browser, it's
16
- // not possible to select the beginning of first line of a selection. To fix this we add a first
17
- // text without line attribute, in this case a <span>, to avoid select a '*'
18
- const targetText = '<span>A</span><ul><li> text with</li><li> line attributes</li></ul>';
19
-
20
- await openCommentFormWithSuggestion(targetText);
21
- const $suggestionFrom = chrome$('.from-value');
22
- expect($suggestionFrom.text()).to.be('A\n text with\n line attributes');
23
- });
24
-
25
- it('Cancel suggestion and try again fills suggestion Change From field', async function () {
26
- const outer$ = helper.padOuter$;
27
- const chrome$ = helper.padChrome$;
28
-
29
- await openCommentFormWithSuggestion('This content will receive a comment');
30
-
31
- // cancel
32
- const $cancelButton = chrome$('#comment-reset');
33
- $cancelButton.click();
34
-
35
- // wait for comment form to close
36
- await helper.waitForPromise(() => outer$('#newComments.active').length === 0);
37
- await openCommentFormWithSuggestion('New target for comment');
38
-
39
- const $suggestionFrom = chrome$('.from-value');
40
- expect($suggestionFrom.text()).to.be('New target for comment');
41
- });
42
-
43
- it('Fills suggestion Change From field, adds sugestion', async function () {
44
- const outer$ = helper.padOuter$;
45
- const inner$ = helper.padInner$;
46
- const chrome$ = helper.padChrome$;
47
- const origText = 'This content will receive a comment';
48
- const suggestedText = 'amp: & dq: " sq: \' lt: < gt: > bs: \\ end';
49
- await openCommentFormWithSuggestion(origText);
50
-
51
- await helper.waitForPromise(() => chrome$('#newComment.popup-show').is(':visible'));
52
- chrome$('#newComment').find('textarea.comment-content').val('A new comment text');
53
- chrome$('#newComment').find('suggestion-checkbox').click();
54
- let newCommentSuggestion;
55
- await helper.waitForPromise(() => {
56
- newCommentSuggestion = chrome$('#newComment').find('textarea.to-value');
57
- return newCommentSuggestion.length > 0 && newCommentSuggestion.is(':visible');
58
- });
59
- newCommentSuggestion.val(suggestedText);
60
- chrome$('#comment-create-btn').click();
61
-
62
- let commentedText$;
63
- await helper.waitForPromise(() => {
64
- commentedText$ = inner$('div').first().find('.comment');
65
- return commentedText$.length > 0;
66
- });
67
- commentedText$.click();
68
- let comment$;
69
- await helper.waitForPromise(() => {
70
- comment$ = outer$('.comment-container');
71
- const fd$ = comment$.find('.full-display-content');
72
- return comment$.length > 0 && fd$.length > 0 && fd$.is(':visible');
73
- });
74
- await helper.waitForPromise(
75
- () => comment$.find('.comment-title-wrapper .from-label').text().includes(suggestedText));
76
-
77
- outer$('.approve-suggestion-btn:visible').click();
78
- commentedText$ = inner$('div').first().find('.comment');
79
- await helper.waitForPromise(
80
- () => inner$('div').first().find('.comment').text() === suggestedText);
81
- });
82
-
83
- const openCommentFormWithSuggestion = async (targetText) => {
84
- const inner$ = helper.padInner$;
85
- const chrome$ = helper.padChrome$;
86
-
87
- // get the first text element out of the inner iframe
88
- const $firstTextElement = inner$('div').first();
89
-
90
- // simulate key presses to delete content
91
- $firstTextElement.sendkeys('{selectall}'); // select all
92
- $firstTextElement.sendkeys('{del}'); // clear the first line
93
- // to simulate a selection with more than one line we have to send the sendkeys selectall
94
- // at the same line. The sendkeys will be run before the line break.
95
- $firstTextElement.html(targetText).sendkeys('{selectall}');
96
- chrome$('.addComment').first().click();
97
- await helper.waitForPromise(
98
- () => chrome$('#newComment.popup-show').find('.suggestion-checkbox').length);
99
- chrome$('#newComment.popup-show').find('.suggestion-checkbox').first().click();
100
- };