Problem/Motivation
drupalPostAjaxForm()
is simulating the behaviour of ajax.js
, so using it, doesn't really provide fundamental guarantees.
#2809161: Convert Javascript/AJAX testing to use JavascriptTestBase suggests to convert them to JavascriptTestBase
Proposed resolution
- Figure out which part of the test is testing PHP code and which part ajax behaviour
- Extract the ajax behaviour into a test that extends JavascriptTestBase
Remaining tasks
- Either fix the test module or find another solution. The current testmodule cannot be enabled because of JavaScript errors as it's not a valid plugin:
-- Error: [CKEDITOR.resourceManager.load] Resource name "llama_button" was not found at "/core/modules/ckeditor/tests/modules/js/llama_button.js?t=G8JJ".
-- Error: [CKEDITOR.resourceManager.load] Resource name "llama_button" was not found at "/core/modules/ckeditor/tests/modules/js/llama_button.js?t=G8JJ"
- Figure out a way to fix the dialog JavaScript error
-- Reproduceable in the UI by the following steps:
--- Open add group dialog
--- Lose focus on the input field
--- While scrolling click the cancel button and keep scrolling
-- Cause: the event is debounced and the debounced event is triggered after the dialog is closed.
- Maybe find out why the Styles input can't handle a newline?
-- Manually comparing the results (fileMerge) states the strings are identical, the assertion disagrees. It must be an invisible character difference.
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#15 | 2809463-CKEditorAdminTest-testExistingFormat-15.patch | 14.5 KB | michielnugter |
#15 | interdiff-14-15.txt | 1001 bytes | michielnugter |
#14 | 2809463-CKEditorAdminTest-testExistingFormat-14.patch | 14.62 KB | michielnugter |
#14 | interdiff-7-14.txt | 6.63 KB | michielnugter |
#7 | 2809463-CKEditorAdminTest-testExistingFormat-7.patch | 18.97 KB | michielnugter |
Comments
Comment #2
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedI made an attempt at converting this test. There are several problems still though.
- There are JavaScript problems after adding a group, I have actually reproduced these but can't exactly figure out how. If I know how I should either upgrade this issue to a bug or open a new issue?
- Divider dragging doesn't work yet.
- Enabling the ckeditor_test module causes all kinds of problems somehow.
- Test still failes.
Posting my work in progress, curious if anyone has suggestions on fixing it.
Comment #3
claudiu.cristeaComment #5
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedI figured out some more on the JavaScript error.
The error is: Error: cannot call methods on dialog prior to initialization; attempted to call method 'option'
It's triggerd in dialog-position.js on line 62, a handler for a window resize event for the dialog. In the test (and on very rare occasions) it's triggered when the event handler is still triggered while the dialog is not there anymore.
I fine-tuned the patch a little and with the module testing disabled and the lines in dialog-position.js disabled the test now passes.
I also used a simplyfied Styles input as there are problems with the endline in the test.
Todo:
- Figure out why the module cannot be enabled while it could in the old test
-- I think it has something to do with the fact that JavaScript is actually executed and now causes problems, making the ckeditor_test module unusable in it's current state.
- Figure out a way to fix the dialog JavaScript error
- Maybe find out why the Styles input can't handle a newline?
-- Manually comparing the results (fileMerge) states the strings are identical, the assertion disagrees. It must be an invisible character difference.
Comment #6
claudiu.cristeaUnrelated changes. Should be reverted.
{@inheritdoc}
I think is protected in 8.3.x and let's use the square brackets syntax for arrays.
Comment #7
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedVery sorry about this, I forgot to upload my files and you reviewed a slightly older patch. I already removed the extra js files.
I fixed the other 2 issues with comments and code formatting.
My earlier todolist is still valid though..
Comment #8
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedI updated the summery with the remaining tasks. I also found out more about why the module doesn't work and did work, there are JavaScript errors because the llama plugin is not defined correctly.
Comment #9
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedComment #10
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedAdded reproducable steps and cause for the JavaScript error in the dialog. Really seems that it's actually a bug, it's harmless in the actual UI but it will make the test fail.
Comment #12
dawehnerIt's so great when conversions happen and they uncover other bugs.
@michielnugter
Did you tried to enable the module manually on your installation and check whether things are broken? I guess in that case, its indeed a super valid bug. Don't feel stuck on this particular issue. As you've probably seen, there are many other conversions which might have less resistance to fight against :)
That is so nice!
This might confuse the testbot :)
Comment #14
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedI moved the test for enabling the module back to the original test as it wasn't actually testing anything javascripty.
I updated the Functional test to fix some minor problems, I think it's good for a proper review now.
While searching the issues I found an existing issue for the dialog problem: #2731419: "cannot call methods on dialog prior to initialization" logged when resizing after closing a modal. This issue will need to be committed before this test will pass.
edit: waiting for needs review untill the related issue is fixed.
Comment #15
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedSmall update to use the new wait...() methods. Let's see if it passes now that mentioned issue is fixed.
Comment #18
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedComment #22
LendudeThis actually got 'fixed' by #2863996: Convert web tests to browser tests for ckeditor module.