Run Nightwatch tests on Bamboo
Overview
Bamboo is a continuous integration server developed by Atlassian, that allows you to build, test, and deploy your web applications.
Prerequisites
We presume you have a working project to test that has been pushed to Github. And your tests are running properly in your local system.
Java and a database (eg: postgres, MySQL etc) must be installed; walkthrough the guide for supported versions
Setup Guide
I’m taking the nightwatch-examples repo for demonstration. Now, let's configure CI by following the procedures below :
Step 1: Installation and Configuration of Bamboo
Download the file and follow the installation instructions as per your operating system.
In order to complete the installation procedure, you must set up a database, which you may do by following this tutorial.
And this article will also assist you in getting started with the remote agent.
After completion of installation; you should follow the guide to run the setup wizard.
Step 2 : Sign In and create a plan
After installation, now you can sign in to the admin and create a plan after clicking the button displayed in the image below :
Fill out the form accordingly by providing the information requested and then save the details.
Link your repository with the project by filling in the following form and then save and continue the provided info
And then select the agent environment
Step 3: Create tasks
Create tasks where the source code checkout task will be default in our case. And to add new tasks click on Add task button
Select npm task type by searching for it.
In order to install all the dependencies you need to complete the form by typing
install
in the command input box and selecting Node.js executable, either custom or default.Note : In case while executing these commands you are getting errors in deafult Node.js executable. You may try using node version manager to install Node.js and get its path using which node command.
And then add this path to create a new executable, as seen in the image below.
In order to run the test cases you need to add another npm task type and type test in the command input box.
But if you want to run the tests in headless mode or want to pass more arguments you may use the script task type in place of npm.
npm install npx npx nightwatch --headless
Finally click on the create button and try running your tasks.