1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-14 15:12:48 +01:00
send/test/integration
2018-04-27 15:44:03 -04:00
..
pages Added footer link tests. (#811) 2018-04-27 15:44:03 -04:00
scripts This adds some user integration tests to aide the SoftVision team a bit. Right now I have 3 tests. 2018-04-24 11:00:19 -04:00
conftest.py This adds some user integration tests to aide the SoftVision team a bit. Right now I have 3 tests. 2018-04-24 11:00:19 -04:00
pipenv.txt This adds some user integration tests to aide the SoftVision team a bit. Right now I have 3 tests. 2018-04-24 11:00:19 -04:00
Pipfile This adds some user integration tests to aide the SoftVision team a bit. Right now I have 3 tests. 2018-04-24 11:00:19 -04:00
README.md This adds some user integration tests to aide the SoftVision team a bit. Right now I have 3 tests. 2018-04-24 11:00:19 -04:00
test_download.py This adds some user integration tests to aide the SoftVision team a bit. Right now I have 3 tests. 2018-04-24 11:00:19 -04:00
test_home.py Added footer link tests. (#811) 2018-04-27 15:44:03 -04:00
test_progress.py This adds some user integration tests to aide the SoftVision team a bit. Right now I have 3 tests. 2018-04-24 11:00:19 -04:00
test_upload.py This adds some user integration tests to aide the SoftVision team a bit. Right now I have 3 tests. 2018-04-24 11:00:19 -04:00
tox.ini Added footer link tests. (#811) 2018-04-27 15:44:03 -04:00

Integration Tests for Firefox Send.

How to run the tests locally

Clone the repository

If you have cloned this project already then you can skip this, otherwise you'll need to clone this repo using Git. If you do not know how to clone a GitHub repository, check out this help page from GitHub.

If you think you would like to contribute to the tests by writing or maintaining them in the future, it would be a good idea to create a fork of this repository first, and then clone that. GitHub also has great instructions for forking a repository.

App Setup

Please view the README at the root directory of the project.

Run the tests

Included in the docker-compose file is an image containing Firefox Nightly. tox is our test environment manager and pytest is the test runner.

To run the tests, execute the command below:

  1. Make sure all of the images are running:
docker-compose ps

If not start them detached:

docker-compose up -d
  1. Start the tests within the docker container
npm run test:integration-docker

If you have geckodriver installed you can use these steps:

npm start &
npm run test:integration

This will use your local Firefox installation.

Adding a test

The tests are written in Python using a POM, or Page Object Model. The plugin we use for this is called pypom. Please read the documentation there for good examples on how to use the Page Object Model when writing tests.

The pytest plugin that we use for running tests has a number of advanced command line options available too. The full documentation for the plugin can be found here.

Watching a test run (within the docker container)

The tests are run on a live version of Firefox, but they are run headless. To access the container where the tests are run to view them follow these steps:

  1. Make sure all of the containers are running:
docker-compose ps

If not start them detached:

docker-compose up -d
  1. Copy the port that is forwarded for the selenium-firefox image:
0.0.0.0:32771->5900/tcp

Note: Your port may not match what is seen here.

You will want to copy what ever IP address and port is before the ->5900/tcp.

  1. Open your favorite VNC viewer and type in, or paste that address.
  2. The password is secret.
  3. The viewer should open a window with a Ubuntu logo. If that happens you are connected to the selenium-firefox image and if you start the test, you should see a Firefox window open and the tests running.

Debugging a failure

Whether a test passes or fails will result in a HTML report being created. This report will have detailed information of the test run and if a test does fail, it will provide geckodriver logs, terminal logs, as well as a screenshot of the browser when the test failed. We use a pytest plugin called pytest-html to create this report. The report can be found within the root directory of the project and is named send-test.html. It should be viewed within a browser.