tyler36 / ddev-cypress

Cypress E2E testing for use with DDEV
Apache License 2.0
11 stars 7 forks source link

Can define drush as a custom command? #40

Closed abelperezlindo closed 1 month ago

abelperezlindo commented 1 month ago

Is there any way this command can work with ddev and this plugin? thanks

Cypress.Commands.add('loginAs', (uid) => {
  cy.exec(`drush uli --uid=${uid}`, {failOnNonZeroExit: false}).then((response) => {
    cy.log("response is " + stdout);
  })
})
rfay commented 1 month ago

I'm no expert, but drush isn't available as is inside the cypress container, so this would somehow have to be executed in the web container. It would be a useful thing. I do think there are other approaches to cypress testing that use the cypress capabilities inside the web container.

abelperezlindo commented 1 month ago

Thanks for your comment, I'll look into another alternative. Being able to use drush in a custom cypress command would be very useful. Regards.

tyler36 commented 1 month ago

@abelperezlindo

Closing. Sorry, this add-on uses a cypress container, that, by design, is unable to see the drush (web) container.

You could try setting up an API endpoint that runs the drush command and returns the needed data. Make sure you limit it to test environment though. :)