ckeditor / github-writer

GitHub Writer - WYSIWYG Rich-Text Editor for GitHub, powered by CKEditor.
https://ckeditor.com/
Other
380 stars 61 forks source link

Updated failing functional tests. #286

Open mateuszzagorski opened 2 years ago

mateuszzagorski commented 2 years ago

Tests: Functional tests have been updated and are now working correctly. Fixes: https://github.com/ckeditor/github-writer/issues/281.

This issue most likely will result in fixing the: https://github.com/ckeditor/github-writer/issues/285 as well.

mateuszzagorski commented 2 years ago

Observations:

1. When the button ( [role="button"].timeline-comment-action ) is clicked without prior hover the editor can't be created fast enough (that's not a 100% replicable behavior for all added comments) - even on a normal internet connection.

Error in the browser console:

The most common error in the console is:

1) Issue
      should edit the created comment without prior hover:
    Error: No editor found for the root `JSHandle@node`.
     at IssuePage.getEditorByRoot (tests/_pom/githubpage.js:97:10)
     at processTicksAndRejections (internal/process/task_queues.js:93:5)
     at async IssuePage.editComment (tests/_pom/pages/commentstimelinepage.js:83:10)
     at async Context.<anonymous> (tests/functional/issue.js:101:18)```

2. Additional checks (added while testing) inside the clickListener in the commenteditor.js file, and editComment function in the  commentstimelinepage.js will confirm the issue described in the point above.

3. Tried to add multiple specific waitForSelector, or waitVisible elements, but it did not resolve the issue.

4. Checking the task-lists:not([disabled]) selector (as it's the one that's initially disabled, and updated automatically when fetching finishes) did not resolve the issue.

Possible fix:

1. Enforce the creation of the commentEditor to happen only after the background fetch has been completed and all the selectors are available in the DOM

2. Optional tests temporary "patch":

actionButton.hover() should not be skipped.
Wait for the fetch that's mentioned in the #285 issue to finish (using browserPage.waitForResponse() and the response.url() should contain either actions_menu or editor_form ) after the hover, add at least 1sec (given my test results 2sec should be optimal including slower connections/throttling) timeout as well.