Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
Integrate selenium on travis with version 3.4.0 and
Browse files Browse the repository at this point in the history
update docs to reflect the changes in command changes

Closes #676
  • Loading branch information
Monal5031 committed May 23, 2018
1 parent fb302bd commit cf79a03
Show file tree
Hide file tree
Showing 25 changed files with 74 additions and 380 deletions.
20 changes: 19 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
language: python

env:
- MOZ_HEADLESS=1

addons:
firefox: "55.0"

python:
- "2.7"

services: postgresql

before_install:
- wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-linux64.tar.gz
- tar -xzvf geckodriver-v0.20.1-linux64.tar.gz
- sudo mv geckodriver /usr/local/bin

install:
- pip install -r requirements.txt

before_script:
- psql -c "create role vmsadmin with createrole createdb login password '0xdeadbeef';" -U postgres
- psql -c "CREATE DATABASE vms;" -U postgres
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3
- export DJANGO_SECRET_KEY=foobarbaz

script:
- cd vms
- python manage.py syncdb --noinput
- python manage.py migrate --noinput --traceback --settings=vms.settings
- coverage run --source='.' manage.py test
- coverage run --source='.' manage.py test -v 2
- coverage report -m

after_success:
coveralls --rcfile=.coveragerc
3 changes: 2 additions & 1 deletion aut_docs/Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
- `cd vms`
- To run, `python manage.py runserver`. Browse
`http://127.0.0.1:8000`
- To execute tests `python manage.py test`. This will run all unit-tests and
- Before running tests, make sure to download the latest geckodriver. Unpack and move the binary to `/usr/local/bin`
- To execute tests `python manage.py test`. This will run all selenium tests, unit-tests and
all functional-tests across all apps. To execute tests of only a particular
app, run `python manage.py test <app_name>`
- If all tests pass, `OK` will be received at the end.
Expand Down
54 changes: 48 additions & 6 deletions docs/Installation_Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,17 @@ There needs to be at least one organization in the `organization_organization` t

Make sure to exit the postgres client before proceeding to the next steps:

```
\q
```

## Change Directory Permissions

You will have to change the permissions on the **/srv** directory to read, write and execute (**/srv** is the directory where Volunteer resumes are uploaded and stored). To do this, run the following command:

```
sudo chmod 777 /srv
```

NOTE: In case you can the error "/srv: No such file or directory" while running the above comment do the following
sudo mkdir /srv
Expand All @@ -278,26 +282,57 @@ Change directory to where you can find the **manage.py** file (this is located i

Start the development server by running the command (this runs the development server on the VM):

```
python manage.py runserver [::]:8000
```

You can now try out the project by going to [http://localhost:8001/home](http://localhost:8001/home) on a browser on your local machine.

## Run Unit and Functional Tests
## Download and Set Geckodriver
To run tests it is essential that you have geckodriver downloaded and set in your path.

Download Geckodriver:

```bash
wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-linux64.tar.gz
```

Unpack it:

```bash
tar -xzvf geckodriver-v0.20.1-linux64.tar.gz
```

Set it in your path

```bash
sudo mv geckodriver /usr/local/bin
```


## Run Unit, Functional and Selenium Tests

You can also run unit and functional tests by running the command:

```
python manage.py test name_of_app_here
```


For example, in the project, there are Django apps called volunteer, job, shift and organization. You can run tests for these apps individually by running these commands separately:

```
python manage.py test volunteer
```

```
python manage.py test job
```

```
python manage.py test shift
```

```
python manage.py test organization
```
Expand All @@ -309,25 +344,32 @@ For example, if you want to run unit tests for the event app:
python manage.py test event.tests.test_services
```

Smilarly, for job app it would be:
Similarly, for job app it would be:
```
python manage.py test job.tests.test_services
```

If you want to run all unit tests, run this command:

```
python manage.py test
```

Once you are done with testing out and running the project, you may want to exit the VM and suspend or shut it down by running these commands:

Exit out of the ssh session with the VM by running:

exit

```
exit
```
To put the VM in suspend mode, run the command:

vagrant suspend
```
vagrant suspend
```

Alternatively, to shut down the VM, run the command:

vagrant halt
```
vagrant halt
```
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ flake8 == 3.4.1
psycopg2 == 2.7.3
PyYAML == 3.11
requests == 2.7.0
selenium == 2.53.1
selenium == 3.4.0
phonenumbers == 7.2.6
django-cities-light == 3.2.0
Unidecode == 0.4.19
Expand Down
Empty file removed tests/__init__.py
Empty file.
Empty file removed tests/administrator/__init__.py
Empty file.
41 changes: 0 additions & 41 deletions tests/administrator/test_working.py

This file was deleted.

Empty file removed tests/authentication/__init__.py
Empty file.
Empty file removed tests/event/__init__.py
Empty file.
41 changes: 0 additions & 41 deletions tests/event/test_working.py

This file was deleted.

Empty file removed tests/home/__init__.py
Empty file.
41 changes: 0 additions & 41 deletions tests/home/test_working.py

This file was deleted.

Empty file removed tests/job/__init__.py
Empty file.
41 changes: 0 additions & 41 deletions tests/job/test_working.py

This file was deleted.

Empty file removed tests/organization/__init__.py
Empty file.
41 changes: 0 additions & 41 deletions tests/organization/test_working.py

This file was deleted.

Empty file removed tests/pom/__init__.py
Empty file.
Loading

0 comments on commit cf79a03

Please sign in to comment.