Task

Add Functional Javascript tests

Drupal 10 Demo Video

Drupal 10 Demo Video

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

marcelovani created an issue. See original summary.

  • marcelovani committed abd358ec on 3040507-add-tests
    Issue #3040507: Updated Makefile with new commands for local development...

  • marcelovani committed 2c490755 on 3040507-add-tests
    Issue #3040507: Updated dependencies. New make commands.
    
marcelovani’s picture

Merged initial pull request to fix the Example module.
Still need to work on Functional Javascript tests.

marcelovani’s picture

Assigned: Unassigned » marcelovani
Status: Active » Needs work
marcelovani’s picture

Issue summary: View changes

marcelovani changed the visibility of the branch 3040507-tests to hidden.

marcelovani changed the visibility of the branch 3040507-test to hidden.

  • marcelovani committed f0614e03 on 8.x-1.x
    Issue #3040507: Add FunctionalJavascript coverage for the embed flow
    
marcelovani’s picture

Merged as MR !20.

ParagraphsIEFEmbedTest now covers the flow this module exists for, in a real browser:

  • the CKEditor 5 toolbar button opens the dialog, and the module's own entity browser widget renders one button per allowed paragraph type;
  • choosing a type loads that type's inline entity form in the iframe;
  • saving it returns to the dialog, where this module has replaced the back button with one that opens the paragraph's own edit form;
  • Embed inserts the widget, and the saved node renders the paragraph.

None of that is reachable from BrowserTestBase — the toolbar button, the iframe, the inline form and the embed step are all AJAX, which is why the earlier tests stopped at "the form renders".

Two things worth recording from writing them.

Editors need a permission that is easy to miss: Entity Browser generates "access <browser> entity browser pages" per browser, and without access paragraph_items entity browser pages the dialog opens on an access denied page rather than the type selector. That was the first thing the test hit. It is now documented — see #3619188.

Selecting an embedded entity logs a JavaScript error from Entity Embed, which would fail any test that embeds anything. Rather than turn the console check off, the test discards that one error by signature and still fails on any other. See #3619182.

The container ships no browser, so the Makefile grew selenium-start and test-local-js. CI needed no change: its test jobs already attach a Selenium service and run every suite in the module. Verified the tests genuinely execute there rather than being skipped — the phpunit job log shows both methods passing against Chrome 127.

marcelovani’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • marcelovani committed f0614e03 on 2.0.x
    Issue #3040507: Add FunctionalJavascript coverage for the embed flow
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.