acquia / blt

Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
https://docs.acquia.com/blt/
GNU General Public License v2.0
442 stars 394 forks source link

DT-581: Drupal JavaScript testing using Nightwatch #3673

Closed greylabel closed 4 years ago

greylabel commented 5 years ago

Drupal core supports JavaScript testing using Nightwatch. BLT should support Nightwatch, similar to how it supports Drupal core's other testing frameworks.

mikemadison13 commented 5 years ago

@greylabel currently the BLT testing for frontend frameworks assumes that you are using gulp (or npm, or whatever other framework) as a runner from inside a module or theme, and uses the frontend-test hook https://github.com/acquia/blt/blob/10.x/src/Robo/Commands/Frontend/FrontendCommand.php#L49.

I'm familiar with Nightwatch, but haven't used it yet. Could you perhaps outline how supporting Nightwatch itself might be different than supporting pa11y, jest, etc. via the frontend hooks I mentioned above?

Thanks!

greylabel commented 5 years ago

@mikemadison13 It's very similar. yarn is recommended by Drupal core, rather than npm and it is really easy to get up and running with Nightwatch testing and BLT/DrupalVM locally:

  1. cd docroot/core && yarn install
  2. cp .env.example .env and configure
  3. yarn test:nightwatch

All of this can be done using BLT's front end hooks, as you mentioned. So there are a few of options:

  1. Do nothing and let users manage the above described process on their own
  2. Minimally, ensure dependencies are installed for use locally and in CI via frontend-test — really just yarn and selenium or chromedriver (the latter already are)
  3. Add a blt tests: command that wraps the above steps and makes the experience more seamless

I think option 2. is probably sufficient to start. (I am happy to take this task.)

danepowell commented 4 years ago

At the same time that we're deprecating run-tests.sh (#3917) in BLT 11, I'd like to get Nightwatch fully supported. It's not exactly a replacement, but it is complementary to core phpunit tests so I think it deserves its own command.