localgovdrupal / localgov

Installation profile for the LocalGov Drupal distribution.
GNU General Public License v2.0
82 stars 18 forks source link

Functional Javascript tests for the Localgov theme #102

Closed Adnan-cds closed 1 year ago

Adnan-cds commented 4 years ago

Some parts of public facing pages have heavy dependency on Javascript. Examples include mobile menu, site search, Service status pages, Step by step pages, etc. When the localgov_theme is responsible for significant parts of any of these functionalities, it would be good to have some Functional Javascript tests to go along.

Relevant links:

Drupal also supports Nightwatch-based Javascript tests. These are also fine.

paulpopus commented 3 years ago

We can also write these using Mocha.js if people are comfortable with it. I've started working with it for automated tests involving PRs in the theme, but Mocha can be used for other tests as well.

Adnan-cds commented 3 years ago

Hi Paul, We are writing all tests for Backend code using Drupal's testing framework which eventually gets run by PHPUnit. I understand it would be too much to ask Frontend test code be written in PHP as well. Even the Drupal core project uses Nightwatch for some functional Javascript tests AFAIK. Apparently you can write unit tests in Nightwatch too although I never tried either. I prefer to stick to what Drupal core uses, but if you are more comfortable with Mocha.js then feel free to write tests for the Frontend in it. For the Backend, let's not go too far from PHPUnit for now.

In any case, if you want these Mocha.js tests to run regularly like all the other PHPUnit tests then you will have to convince Stephen Cox to include it in the test runner :)

FAO @paulpopus @stephen-cox @finnlewis

Adnan-cds commented 3 years ago

In any case, if you want these Mocha.js tests to run regularly like all the other PHPUnit tests then you will have to convince Stephen Cox to include it in the test runner :)

Sorry, this won't be needed given that you are waking up Mocha from the Github test workflow for the theme as part of another draft pull request.

andybroomfield commented 1 year ago

I'll close as localgov_theme is now being deprecated.