Sample project to experiment with Cypress for testing the GitLab application.
You need to have a GitLab local environment such as GDK or Docker up and running.
You also need to have node and npm installed on your computer.
For this project, the following versions of node and npm were used:
$ node -v
v12.13.0
$ npm -v
6.12.1
Run docker run --publish 80:80 --name gitlab --hostname localhost wlsf82/gitlab-ce
and wait for the environment to be up and running (this might take a minute or so), then access http://localhost/, and finally, create a password for the root
user.
Run npm i
to install the dev dependencies.
Before running the tests, create a file called
cypress.env.json
in the project root directory, based on thecypress.env.example.json
file, and update the value of theuser_password
property with the credentials of theroot
user.After that, log into your local GitLab environment and create an access token with the
api
scope, and then, in thecypress.env.json
file, in the property calledgitlab_access_token
, update its value with the just created token. This token will be used by most of the tests.An easy way to create this token is to simply run the test
cypress/integration/createAccessToken.spec.js
in interactive mode (see below for instructions), and use the automatically created token to update thecypress.env.json
file.By default, the tests will run against
http://localhos/
, but if you need to run them in a different URL (e.g.:http://localhos:3000/
), change thebaseUrl
property in thecypress.json
file.
Run npm t
to run the tests in headless mode. The test results should look like the below image.
Run npx cypress open
, then click Run all specs to run the tests in interactive mode. You should see something like the below gif.
Another option is run click in a specific test file to run it only.
Made with 💚 by Walmyr Filho