Skip to content

Commit

Permalink
Adding the process to run acceptance tests to the README
Browse files Browse the repository at this point in the history
Signed-off-by: Emiliemorais <emilie.mo@hotmail.com>
Signed-off-by: Italo Paiva <italosensei@hotmail.com>
  • Loading branch information
italopaiva authored and Emiliemorais committed Apr 19, 2016
1 parent ad6f618 commit 145a411
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 22 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@ sudo: false
python:
- "2.7"

addons:
apt:
packages:
- xvfb
- firefox

env:
global:
- COLAB_SETTINGS=tests/colab_settings.py

install:
- pip install coveralls flake8 behave behave_django
- pip install coveralls flake8 behave behave_django selenium
- pip install .

script:
- python setup.py test
- colab-admin behave
- xvfb-run -a colab-admin behave --format=progress
- flake8 colab

after_success:
Expand Down
49 changes: 49 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,52 @@ Follow the steps below:
.. code-block::
python setup.py test
How to run Acceptance Tests
---------------------------

Follow the steps below to run the acceptance tests.

1- Log in virtual machine:

1.1 - To run without opening a graphic interface

.. code-block::
vagrant ssh
1.2 - To run opening a graphic interface

.. code-block::
vagrant ssh -- -X
2- Use colab virtualenv:

.. code-block::
workon colab
3- Enter into colab source code directory:

.. code-block::
cd /vagrant
4- Run all the acceptance tests with:

.. code-block::
COLAB_SETTINGS=tests/colab_settings.py colab-admin behave
4.1 To run without opening a browser:
.. code-block::
COLAB_SETTINGS=tests/colab_settings.py xvfb-run -a colab-admin behave
4.2 To run a specific feature:

.. code-block::
COLAB_SETTINGS=tests/colab_settings.py colab-admin behave /path/to/features/file.feature
1 change: 0 additions & 1 deletion colab/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
'haystack',
'hitcounter',
'taggit',
'behave_django',

# Own apps
'colab',
Expand Down
14 changes: 3 additions & 11 deletions features/environment.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
from selenium import webdriver
from django.conf import settings


def before_all(context):
# Otherwise the ManifestStaticFilesStorage will use hashed names
settings.DEBUG = True

def before_feature(context, feature):
if 'selenium' in feature.tags:
context.driver = webdriver.Firefox()
context.driver.set_window_size(1000, 600)
context.driver.implicitly_wait(5)
else:
context.driver = webdriver.PhantomJS()
context.driver = webdriver.Firefox()
context.driver.set_window_size(1000, 600)
context.driver.implicitly_wait(5)


def after_feature(context, feature):
Expand Down
1 change: 0 additions & 1 deletion features/home_redirect.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

@selenium
Feature: Home redirect
In order to be able to choose the home page
As a developer
Expand Down
4 changes: 2 additions & 2 deletions features/profile_edition.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@selenium

Feature: User Profile Edition
In order to update my personal information
As an User
Expand Down Expand Up @@ -76,4 +76,4 @@ Feature: User Profile Edition
When I fill "newpassword" in "id_password" field
When I click in "Acesso "
When I click in "Login" button
Then The browser URL should be "/dashboard"
Then The browser URL should be "/dashboard"
2 changes: 0 additions & 2 deletions features/steps/user_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ def create_user(context, username, password, status):
user.set_password(password)
user.email = "usertest@colab.com.br"
user.id = 1
user.twitter = "usertestcolab"
user.facebook = "usertestcolab"
user.first_name = "USERtestCoLaB"
user.last_name = "COLAB"
user.needs_update = False
Expand Down
3 changes: 2 additions & 1 deletion features/steps/web_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def step_impl(context, url):

@when(u'I click in "{link}"')
def step_impl(context, link):
context.driver.find_element_by_xpath("//a[contains(., '%s')]" % link).click()
context.driver.find_element_by_xpath("//a[contains(., '%s')]" %
link).click()


@when(u'I click in "{button_value}" button')
Expand Down
1 change: 0 additions & 1 deletion features/user_sign_in.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

@selenium
Feature: User sign in
In order to be able to access the system funcionalities
As an User
Expand Down
2 changes: 1 addition & 1 deletion features/user_sign_up.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@selenium

Feature: User Sign Up
In order to use the system
As an User
Expand Down

0 comments on commit 145a411

Please sign in to comment.