Problem/Motivation

We have javascript tests in core now. These are not working on the 2.0.x version of the module.

Proposed resolution

Let's add some for the maxlength module and fix the existing ones for the 2.0.x branch.

Existing Tests

  1. Custom widget tests
  2. Functional JavaScript tests

Automated testing results from 2.0.x-dev test

Proposed Tests

  • Bypass Maxlength limit permission applies to the correct roles.
  • Maxlength limit method works as intended.
  • Previously set Maxlength limit value persists.

Remaining tasks

  1. Fix test coverage on 2.0.x
  2. Identify high priority test coverage to add
  3. Add high priority tests

Issue fork maxlength-2805089

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

dawehner created an issue. See original summary.

dawehner’s picture

Issue summary: View changes
cedewey’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
cedewey’s picture

Issue summary: View changes
christianadamski’s picture

I was asked to help here. Did anybody yet defined the scenarios to test?

cedewey’s picture

Issue summary: View changes

Thanks for helping with this Christian.

The top priority is fixing the existing tests. Here are the test results outlining the errors occurring, https://www.drupal.org/pift-ci-job/2361839

If you have suggestions on additional test coverage that would be helpful to have we're open to that. Here are some ideas in the meantime,

  • Bypass Maxlength limit permission applies to the correct roles.
  • Maxlength limit method works as intended.
  • Previously set Maxlength limit value persists.

hipp2bsquare made their first commit to this issue’s fork.

hipp2bsquare’s picture

StatusFileSize
new959 bytes

I had some time to look at it and wanted to see if I could get the existing tests running. Unfortunately, I'm not seeing a means of running DrupalCI on the merge request I just created, so I converted my work in the issue fork into a patch.

The "Max Length Summary" label has been changed to "Maximum Length Summary." Updated the test to reflect that.

hipp2bsquare’s picture

StatusFileSize
new1006 bytes

Take 2, I somehow truncated the end of that prior patch.

hipp2bsquare’s picture

StatusFileSize
new1.05 KB

#10 failed as well, this time with a slightly different error message:

1) Drupal\Tests\maxlength\FunctionalJavascript\MaxlengthCustomWidgetTest::testMaxlengthCustomWidgetSupported
WebDriver\Exception\UnknownError: element not interactable

Trying one more time here -- The documentation for TraversableElement::findField states that it accepts the name attribute as well, so I'm giving that a go. After this, I'll accept that I'm past my depth on figuring out testing with the time I have available at present.

hipp2bsquare’s picture

Failed again -- Clayton, I suggest we disable unit testing for now on the 2.0.x branch and see if Christian or someone else more knowledgeable w/ DrupalCI can take this up.

cedewey’s picture

Assigned: Unassigned » joevagyok

Assigning to joevagyok to take the lead on this.

joevagyok made their first commit to this issue’s fork.

cedewey’s picture

Status: Active » Needs work

Hi @joevagyok,

Thanks for all the great work on this issue. The tests from my vantage point look as expected, but we should have Steven or Jeff review that as well.

The validation that the maxlength number be positive works. However, now it is not possible to remove a maxlength value altogether. The final expected behavior should be that if the maximum length field is blank, no maxlength setting is applied at all.

Also, for enforcing the summary maxlength, it should be possible to set a Maxlength for the summary, but not the associated long text field.

joevagyok’s picture

Status: Needs work » Needs review

Thank you for the review @cedewey. In my last commit, I addressed your remarks with their corresponding tests.

cedewey’s picture

Assigned: joevagyok » hipp2bsquare

Thanks @joevagyok, both of the issues I flagged are resolved. Assigning to @hipp2bsquare to do a technical review of the test coverage and fixes.

hipp2bsquare’s picture

Maintainers have reviewed and approved this substantial contribution. Thank you, joevagyok!

  • 60519cc committed on 2.0.x
    Issue #2805089: Add test coverage and fix bug related to hard limit...
joevagyok’s picture

Status: Needs review » Fixed

Thank you.

joevagyok credited srdtwc.

joevagyok’s picture

joevagyok credited juancec.

joevagyok’s picture

cedewey’s picture

Status: Fixed » Closed (fixed)