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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tedbow created an issue. See original summary.

dawehner’s picture

Thanks a ton for writing a test for that!

+++ b/core/modules/system/tests/modules/submit_form_test/src/Controller/LinksController.php
@@ -0,0 +1,37 @@
+   * Displays test links that will open in offcanvas tray.
...
+          'data-dialog-type' => 'modal',

Is there a reason for this mismatch? Modal vs. offcanvas

dawehner’s picture

@tedbow
Just curious, did you tried assertWaitOnAjaxRequest ?

Status: Needs review » Needs work

The last submitted patch, dialog_form_submit_test.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review
FileSize
5.42 KB
2.08 KB

@dawehner

Is there a reason for this mismatch? Modal vs. offcanvas

Copy and paste error. Fixed

Just curious, did you tried assertWaitOnAjaxRequest ?

I think had tried that. Thought it might be the problem but wasn't. Now using assertWaitOnAjaxRequest.

Status: Needs review » Needs work

The last submitted patch, 5: 2789381-5.patch, failed testing.

dawehner’s picture

Ah sorry, I haven't seen your waiting, too bad that wasn't the problem. I have a look into it now.

dawehner’s picture

FileSize
4.27 KB
3.94 KB
3.94 KB
3.94 KB

Here 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.

droplet’s picture

FileSize
33.12 KB

wrong z-index.

Saving your life: #2775653: JavascriptTests with webDriver

dawehner’s picture

Thank you @droplet!

Wim Leers’s picture

droplet’s picture

Status: Closed (duplicate) » Needs work

this 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.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Mile23’s picture

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

nod_’s picture

Version: 8.9.x-dev » 9.2.x-dev
Issue tags: -JavaScript +JavaScript

With the various updates to testing libraries does it still happen?

nod_’s picture

Status: Needs work » Postponed (maintainer needs more info)

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue tags: +Bug Smash Initiative

There 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!

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Since 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.