Skip to content

Add E2E test and set up for development environment

username-removed-562690 requested to merge didemacet/gitlab-ce:e2e-tests into master

Added browser automated E2E tests which will run on Selenium. Currently I wrote the tests below and set up a development environment which will allow others to add more tests.

Added tests

  • Login
  • Logout
  • Register
  • Star project
  • Unstar project

TODO List

  • Add initial tests
  • Set up development environment with Grunt
  • Create test runner
  • Integrate tests with GitLab CI
  • Add more tests

Screencasts

Login test

login

Logout test

logout

Star Project test

starProject

Below you can read more about the tests.


E2E Tests

This folder contains browser automated End to End tests. We are using Nightwatch.JS as our E2E testing framework.

Installation

Nightwatch.js works with Node.js so you must have Node.js installed on your machine. Development environment works with Grunt so you need to Grunt installed.

  • cd gitlab/tests
  • npm install -g grunt grunt-cli
  • npm install

npm install will download all required binaries like Selenium Standalone, ChromeDriver, PhantomJS driver etc.

Development

Development environment build on top of Grunt. There are a few basic Grunt tasks for transpiling CoffeeScript files and watching for changes. Before writing new tests you should run grunt in gitlab/tests directory. It will transpile CoffeeScript files to JavaScript and put them to output folder and start watching for changes.

Running Tests

We have a bash file named run to run tests easily without using Nightwatch test runner. It's a wrapper aroung Nightwatch's test runner. There is three options to run tests.

Run all tests in a folder

run user

This will run all tests in the lib/user folder.

Run a test suite

run user login

This will run only login suite in the lib/user folder.

Run a single test

run user login loginWithEmail

This will run only one test which is loginWithEmail test in lib/user/login file.

Running tests with different browsers

Right now tests are configured to run with PhantomJS but we can also run the tests with Chrome and Firefox. To do so, just change the test_settings.desiredCapabilities.browserName in nightwatch.json to the name of the driver you want. The options are phantomjs, chrome or firefox.

Merge request reports

Loading