Problem/Motivation

We are trying to deprecate node_add_body_field in #3489266: Deprecate node_add_body_field() but currently NodeTypeForm is calling this for the testing profile (since #3488742: Stop calling node_add_body_field() from NodeTypeForm) just for these Nightwatch tests.

In #3467492: [policy, no patch] Replace Nightwatch with Playwright I think we all agree that Nightwatch is unreliable, and looking at the tests they are doing an awful lot of costly operations via the UI that if it were a PHP test we could use API to do for us (install the site, install modules, set up content types, etc).

Instead of adding even more UI clunk to Nightwatch in order to setup a body field, let's just convert these to WebDriver tests. There's nothing in there that can't be done in PHP afaict.

Proposed resolution

Convert ckEditor5CodeSyntaxTest to a WebDriver test.

Remaining tasks

Do it

Issue fork drupal-3517023

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

acbramley created an issue. See original summary.

acbramley’s picture

So this one is quite easy to do in PHP, except that I can't figure out how to actually type in the editor which we need to do to prove that adding the code block adds the specific class/markup. Without typing anything, CKE returns no data.

I need to move on for today so have pushed what I've got so far.

mstrelan’s picture

Honestly I don't know why we need to be testing the behaviour of the codeblock plugin. This is provided by CKE5 core and is thoroughly tested there. We should only be testing that we can configure the languages, and that the languages get passed to the plugin. I'd argue we don't need a JS test at all for this, but I guess a basic smoke test that the plugin is loading and the configured languages are available would be reasonable.

acbramley’s picture

Status: Active » Needs review

Absolutely agree with #4, I was actually trying to find which part of drupal was adding those tags we're testing in the nightwatch test. Seeing as it's the CKE5 plugin itself, we don't need the drama of testing it ourselves.

I've also added return types to 4 functions in CKEditor5TestTrait that were flagging new violations in the new test class. This means we can remove 240 lines from the baseline.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Appears to be a good conversion, agree with the update to the testTrait since it's just void. Hopefully doesn't lead to any more random failures then we already get :)

  • longwave committed 2041dbb5 on 11.x
    Issue #3517023 by acbramley, mstrelan: Convert ckEditor5CodeSyntaxTest...
longwave’s picture

Status: Reviewed & tested by the community » Fixed

If this is one way of getting rid of the flaky Nightwatch tests I'm all for it. I will also allow the scope creep of baseline cleanup while we're here - the reason we didn't do this before is because technically someone could override those helpers without adding the typehint, but tests are considered internal and this is easy to fix if we broke something somewhere.

Committed 2041dbb and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

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