Lullabot / drupal9ci

Command Line Interface for implementing Continuous Integration in Drupal 9
GNU General Public License v3.0
161 stars 55 forks source link

Drupal Test Traits configured for Github Actions config, but not other CI configs #63

Closed davereid-pfg closed 3 years ago

davereid-pfg commented 3 years ago

It looks like the CircleCI setup script requires weitzman/drupal-test-traits, but the phpunit.xml doesn't seem to reference it at all, and instead uses Behat tests. There seems to be a fairly big different between the CircleCI PHPunit config compared to the Github actions phpunit.xml. Is the intent that the testing frameworks should be standardized between all the CI environments supported in this project?

fjgarlin commented 3 years ago

https://github.com/Lullabot/drupal9ci/pull/65 and https://github.com/Lullabot/drupal9ci/pull/66 removed that dependency and that package is no longer required.

There is still left Gitlab to fully check but with that push the testing has been a bit standarised (or at least a bit more). It might be interesting to work on a CypressIO integration as suggested here https://github.com/Lullabot/drupal9ci/issues/67 for end to end tests.

davereid-pfg commented 3 years ago

So is the future recommendation here to use CypressIO in the future instead of Drupal Test Traits?

fjgarlin commented 3 years ago

My 2c, I guess you can go either way or both ways to be honest, it'll probably depends on the experience that you have with the tools.

In the case of CypressIO it's really quick and easy to get it set up and to write end-to-end tests. You can see a very quick intro here: https://www.youtube.com/watch?v=eL4zkArYQLo. Basically it's npm install cypress and then write a test like this:

describe('Visit homepage', () => {
  it('Sees welcome message', () => {
    cy.visit('/')
    cy.contains('Welcome').should('be.visible')
  })
})

and you're almost done :-) You can see the WIP PR for CypressIO integration here: https://github.com/Lullabot/drupal9ci/pull/70 (and related issue https://github.com/Lullabot/drupal9ci/issues/67). This is already working for Gitlab.

Also, the Javascript testing that was done was using ExistingSiteJavascript/ExistingSiteTest.php, but the official Javascript testing on Drupal seems to be different (classes should extend Drupal\FunctionalJavascriptTests\WebDriverTestBase). This can be added if needed too at a later stage. I'm only adding Cypress on the above PR, not replacing behat.

The way I see this integration is that it provides the base tools and then you can build on that on a project per project basis, this is just the initial push to get CI configured.

juampynr commented 3 years ago

I second @fjgarlin. If you are going to do BDD, cypress.io's developer experience is much more transparent than Drupal Test Traits.

deviantintegral commented 3 years ago

Can you still use DTT traits like NodeCreationTrait? Admittedly, on my last project we never ran tests multiple times on the same environment, but it'd be good to document and tell users what the alternatives are.

From an adoption standpoint, if someone is willing to finish the DTT integration, that makes it more likely this will be used on existing projects with tests.

fjgarlin commented 3 years ago

Based on this: https://api.drupal.org/api/drupal/core%21tests%21Drupal%21FunctionalJavascriptTests%21WebDriverTestBase.php/class/WebDriverTestBase/9.1.x if you use WebDriverTestBase then those traits should still be available.

Before asking for the final review on https://github.com/Lullabot/drupal9ci/pull/70 I'll also make sure to update the README file with the information concerning CypressIO and any other relevant changes.

juampynr commented 3 years ago

@fjgarlin I think that this is done already, correct?

fjgarlin commented 3 years ago

Correct @juampynr, done and merged to the main branch.

juampynr commented 3 years ago

Thanks! Closing.