-1

I know NightwatchJS and Cypress.io for Frontend Testing. Is there a way to make these tests more dynamic? For exmaple I have a framework where the detailpage of an article is always the same (ID-wise / styling can differ) and I want to test a list of URLs from my MYSQL database. So I define a test for the detailpage and call this test with an url/env parameter.

But how do I execute these tests? I want to work with cronjobs. Should I use a third-party like jenkins to trigger them? Directly in PHP (exec()) or are there other tools for that purpose.

Overview

TEST -> created with Cypress or Nightwatch

MYSQL -> query all website URLs

foreach(website) call a TEST

Isengo
  • 2,004
  • 3
  • 21
  • 43

1 Answers1

0

Yes, typically you run the tests inside a Docker container (a process like $ cypress run) running on a Docker image (a file-system with a chosen OS).

That's because you need a hosting image with NodeJS, Cypress (or NightwatchJS etc.) configured with a reliable and tested configuration (ie Node.js 8 etc.).

And yes, you can use Jenkins, Travis etc. to turn on the Docker image, copy the necessary files inside it (the project files, the configuration files, and the testing files), launch the testing process and alert you in case of non-0 exit.

NoriSte
  • 3,589
  • 1
  • 19
  • 18
  • So there is no "nice" way to do this directly in PHP, right? – Isengo Feb 12 '19 at 09:18
  • You could check [puphpeteer](https://github.com/nesk/puphpeteer) for a pure PHP implementation (it leverages Puppeteer instead of Cypress/Nightwatch but it doesn't change too much) or [Simfony Panther](https://github.com/symfony/panther) if you use Simfony – NoriSte Feb 12 '19 at 09:50