-1

How can I integrate Nightwatch with Jenkins, and run the tests from Jenkins? What are the correct commands that I should use?

I have selected 'Execute Windows Batch Command' and tried to run 'echo' followed by the usual commands that I run in cmd, but no success.

Mihaela
  • 9
  • 1
  • 4
  • Would be great to provide us with information of what you tried, commands and actual output. – Stratos Ion Nov 23 '18 at 14:25
  • In the Build section of the job's configuration, I used the exact command that I would normally use in the Command Line to run the tests(e.g. `cd "C:/xampp/htdocs/webapp/tests/nightwatch"`). I used similar commands to start Selenium. In the Console output, the build it's successful, but my test is supposed to launch an internet browser page, which it doesn't. Any idea how to make it launch the browser? – Mihaela Nov 28 '18 at 16:50

2 Answers2

0

Do you use selenium to run the nightwatch in the background? Take a look at this link

  • Hi. Yes, I used the following command to run Selenium in Jenkins: _cd "C:\xampp/htdocs/webapp/tests/nightwatch/selenium" selenium-server-standalone-3.9.1.jar_ When I look at the Console output it looks like it's doing it (run Selenium). But when it comes to running the actual test, it wouldn't launch the browser and the Console would just stall. As far as I know, Selenium should automatically run anyway when the test is run. – Mihaela Nov 16 '18 at 15:54
  • Hi. Did you even install selenium webdriver (chrome or firefox)? See this link: https://dzone.com/articles/test-automation-using-nightwatch – dalmo.santos Nov 16 '18 at 17:13
  • Yes. I had everything installed – Mihaela Nov 19 '18 at 10:41
0

You should run shell commands with the nightwatch test in each For example:

nightwatch --test tests/product/itineraryCreate.js --testcase "itinerary_new" --env integration

But the most important thing is a well defined environment in the nightwatch.json

    "integration" : {
      "persist_globals" : true,
      "launch_url" : "https://test.url",
      "globals" : {
        "foo" : "var"
      },
      "desiredCapabilities" : {
        "browserName" : "firefox",
        "acceptInsecureCerts" : true,
        "alwaysMatch" : {
          "acceptInsecureCerts" : true,
          "moz:firefoxOptions" : {
            "args" : [ "-headless" ]
          }
        }
      }
    },

Make sure headless mode is set

Sergi
  • 1,224
  • 3
  • 15
  • 34