I want to pull on some threads from two separate issues and create a new smaller easier to handle thing.

1) PhpUnit test is prefered but what to do about javascript testing - how to maintain test coverage?

as berdir says

https://www.drupal.org/node/2751053#comment-11359129

When all else fails we have javascriptTestBase,

2) From

#2759417: Reduce the number of calls to FlagTestBase::createFlagWithForm() to make PHPUnit conversion easier

A single conversion of creteFlagWithForm() is impossible to convert.

An approach suggested by joachim - doCreateAjaxFlag() - we should create a separate test

This issue is to make a test that extends javascriptTestBase and maintains that test coverage.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

martin107 created an issue. See original summary.

martin107’s picture

Assigned: Unassigned » martin107
Issue summary: View changes

My focus is shifting here.

martin107’s picture

Status: Active » Needs review

Early patch - just want to show the general direction and to welcome nudges in the right direction.

1) For methods common to tests extending BrowserBase, JavascriptTestBase and FlagTestBase. I have created FlagTestTrait.

I have moved in only the functions I needed here - as we convert more tests this little trait will grow.

2) To maintain test coverage, ie running through flag creation via the UI there is a new test FlagAddFormTest - yes it is simplistic but that is all the coverage we ever had...
maybe a separate issue as followup

3) In the end LinkTypeAjax test will be the fancy pants test extending JavascriptTestBase it will makes assertJsCondition() calls.

I have put zero effort into getting the new LinkTypeAjaxTest working - For now want testbot to confirm FlagAddForm works.

I hope to have more time over the weekend.

martin107’s picture

Status: Needs review » Needs work

The last submitted patch, 4: fancy-pants-2759945-3.patch, failed testing.

The last submitted patch, 4: fancy-pants-2759945-3.patch, failed testing.

martin107’s picture

Just fixing gross errors.

locally I was only checking new functional tests - did not check other tests.

Status: Needs review » Needs work

The last submitted patch, 7: trait-2759945-7.patch, failed testing.

The last submitted patch, 7: trait-2759945-7.patch, failed testing.