I found this during #2786459: "Offcanvas" tray should be using the existing dialog system
I will attach patch that proves that if you try to submit a form that is inside a Ajax dialog you will get a GastonJS error like this:
1) Drupal\Tests\system\FunctionalJavascript\SubmitFormTest::testFormSubmit
Zumba\GastonJS\Exception\BrowserError: There was an error inside the PhantomJS portion of GastonJS.
This is probably a bug, so please report it:
click
Inside \Drupal\Tests\system\FunctionalJavascript\DialogSubmitFormTest I have left a comment showing the various ways I have tried to submit form that also throw the same error. Here they are:
$dialog->pressButton('Submit');
$page->pressButton('Submit');
$dialog->find('css', '.js-form-submit')->press();
$dialog->find('css', '.js-form-submit')->click();
$this->submitForm(['msg' => 'the end of the other sentence.'], 'Submit');
The also proves the form can be submitted if it is not a dialog.
I have searched core I don't think anywhere else we are testing submitting a form in an ajax dialog.
If anyone knows a workaround to get this working for now that would be great to fix the test in #2786459: "Offcanvas" tray should be using the existing dialog system
Comments
Comment #2
dawehnerThanks a ton for writing a test for that!
Is there a reason for this mismatch? Modal vs. offcanvas
Comment #3
dawehner@tedbow
Just curious, did you tried
assertWaitOnAjaxRequest
?Comment #5
tedbow@dawehner
Copy and paste error. Fixed
I think had tried that. Thought it might be the problem but wasn't. Now using assertWaitOnAjaxRequest.
Comment #7
dawehnerAh sorry, I haven't seen your waiting, too bad that wasn't the problem. I have a look into it now.
Comment #8
dawehnerHere is what I found out so far. It seems to be that the dialog misses some focus, somehow. One thing which is also weird that normally
$this->createScreenshot
returns something helpful. In this particular case, it actually didn't. The screenshots are all 1024x99 px. Maybe this is some reason for the weird behaviour.Comment #9
droplet CreditAttribution: droplet commentedwrong z-index.
Saving your life: #2775653: JavascriptTests with webDriver
Comment #10
dawehnerThank you @droplet!
Comment #11
Wim LeersI'm pretty certain this is a duplicate of #2773791: Clicking elements with children in Javascript tests throws a GastonJS exception.
Comment #12
droplet CreditAttribution: droplet commentedthis isn't a duplication. Because of wrong z-index. You are clicking on DIV, not the actual buttons. It's a bug of Modal (JS) & base theme (missing styles)
We can't use JS to fake our testing engine.
Comment #15
Mile23Almost a duplicate of #2831506: Minimal profile disallows modal AJAX tests under JavascriptTestBase because #2936535: Modal dialog errors in stark theme
Comment #20
nod_With the various updates to testing libraries does it still happen?
Comment #21
nod_Comment #25
quietone CreditAttribution: quietone at PreviousNext commentedThere was some activity here 5 or 6 years ago but since a year ago when @nod_ asked if this is still a problem. There has not been a response.
Since we need more information to move forward with this issue, I am keeping the status at Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #27
quietone CreditAttribution: quietone at PreviousNext commentedSince there has been no response from the last two requests for more information made in the past 2 years to confirm that this is still a problem, it is time to close.