From fb302bd3d99b28a471ae18e81ff4328864515ab0 Mon Sep 17 00:00:00 2001 From: Monal5031 Date: Tue, 15 May 2018 00:34:19 +0530 Subject: [PATCH 1/2] Create Base module for Tests Closes https://github.com/systers/vms/issues/674 --- tests/__init__.py | 0 tests/administrator/__init__.py | 0 tests/administrator/test_working.py | 41 ++++++++++++++++++++++++++++ tests/authentication/__init__.py | 0 tests/authentication/test_working.py | 41 ++++++++++++++++++++++++++++ tests/event/__init__.py | 0 tests/event/test_working.py | 41 ++++++++++++++++++++++++++++ tests/home/__init__.py | 0 tests/home/test_working.py | 41 ++++++++++++++++++++++++++++ tests/job/__init__.py | 0 tests/job/test_working.py | 41 ++++++++++++++++++++++++++++ tests/organization/__init__.py | 0 tests/organization/test_working.py | 41 ++++++++++++++++++++++++++++ tests/pom/__init__.py | 0 tests/pom/test_working.py | 41 ++++++++++++++++++++++++++++ tests/registration/__init__.py | 0 tests/registration/test_working.py | 41 ++++++++++++++++++++++++++++ tests/shift/__init__.py | 0 tests/shift/test_working.py | 41 ++++++++++++++++++++++++++++ tests/volunteer/__init__.py | 0 tests/volunteer/test_working.py | 41 ++++++++++++++++++++++++++++ 21 files changed, 410 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/administrator/__init__.py create mode 100644 tests/administrator/test_working.py create mode 100644 tests/authentication/__init__.py create mode 100644 tests/authentication/test_working.py create mode 100644 tests/event/__init__.py create mode 100644 tests/event/test_working.py create mode 100644 tests/home/__init__.py create mode 100644 tests/home/test_working.py create mode 100644 tests/job/__init__.py create mode 100644 tests/job/test_working.py create mode 100644 tests/organization/__init__.py create mode 100644 tests/organization/test_working.py create mode 100644 tests/pom/__init__.py create mode 100644 tests/pom/test_working.py create mode 100644 tests/registration/__init__.py create mode 100644 tests/registration/test_working.py create mode 100644 tests/shift/__init__.py create mode 100644 tests/shift/test_working.py create mode 100644 tests/volunteer/__init__.py create mode 100644 tests/volunteer/test_working.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/administrator/__init__.py b/tests/administrator/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/administrator/test_working.py b/tests/administrator/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/administrator/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/authentication/__init__.py b/tests/authentication/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/authentication/test_working.py b/tests/authentication/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/authentication/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/event/__init__.py b/tests/event/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/event/test_working.py b/tests/event/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/event/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/home/__init__.py b/tests/home/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/home/test_working.py b/tests/home/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/home/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/job/__init__.py b/tests/job/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/job/test_working.py b/tests/job/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/job/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/organization/__init__.py b/tests/organization/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/organization/test_working.py b/tests/organization/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/organization/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/pom/__init__.py b/tests/pom/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/pom/test_working.py b/tests/pom/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/pom/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/registration/__init__.py b/tests/registration/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/registration/test_working.py b/tests/registration/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/registration/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/shift/__init__.py b/tests/shift/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/shift/test_working.py b/tests/shift/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/shift/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + diff --git a/tests/volunteer/__init__.py b/tests/volunteer/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/volunteer/test_working.py b/tests/volunteer/test_working.py new file mode 100644 index 000000000..742cec491 --- /dev/null +++ b/tests/volunteer/test_working.py @@ -0,0 +1,41 @@ +# Third Party Imports +from selenium import webdriver + +# Django imports +from django.contrib.staticfiles.testing import LiveServerTestCase + +# Local Project Imports +from selenium.webdriver.common.keys import Keys + + +class DummyTesting(LiveServerTestCase): + """ + Dummy Test Class to check the tests are working correctly. + """ + + @classmethod + def setUpClass(cls): + cls.driver = webdriver.Firefox() + cls.driver.implicitly_wait(5) + cls.driver.maximize_window() + super(DummyTesting, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + super(DummyTesting, cls).tearDownClass() + + def test_working(self): + """ + Dummy Test function to check working of selenium + Delete this function after the first test for this + Class is added. + """ + self.driver.get("http://www.python.org") + self.assertIn('Python', self.driver.title) + element = self.driver.find_element_by_name('q') + element.clear() + element.send_keys('pycon') + element.send_keys(Keys.RETURN) + self.assertNotIn('No results found.', self.driver.page_source + From cf79a03e16494fda43a4be7b33d56cb6ed672b80 Mon Sep 17 00:00:00 2001 From: Monal5031 Date: Tue, 15 May 2018 17:21:40 +0530 Subject: [PATCH 2/2] Integrate selenium on travis with version 3.4.0 and update docs to reflect the changes in command changes Closes https://github.com/systers/vms/issues/676 --- .travis.yml | 20 ++++++- aut_docs/Setup.md | 3 +- docs/Installation_Guide.md | 54 ++++++++++++++++--- requirements.txt | 2 +- tests/__init__.py | 0 tests/administrator/__init__.py | 0 tests/administrator/test_working.py | 41 -------------- tests/authentication/__init__.py | 0 tests/event/__init__.py | 0 tests/event/test_working.py | 41 -------------- tests/home/__init__.py | 0 tests/home/test_working.py | 41 -------------- tests/job/__init__.py | 0 tests/job/test_working.py | 41 -------------- tests/organization/__init__.py | 0 tests/organization/test_working.py | 41 -------------- tests/pom/__init__.py | 0 tests/pom/test_working.py | 41 -------------- tests/registration/__init__.py | 0 tests/registration/test_working.py | 41 -------------- tests/shift/__init__.py | 0 tests/shift/test_working.py | 41 -------------- tests/volunteer/__init__.py | 0 tests/volunteer/test_working.py | 41 -------------- .../tests/test_selenium_working.py | 6 ++- 25 files changed, 74 insertions(+), 380 deletions(-) delete mode 100644 tests/__init__.py delete mode 100644 tests/administrator/__init__.py delete mode 100644 tests/administrator/test_working.py delete mode 100644 tests/authentication/__init__.py delete mode 100644 tests/event/__init__.py delete mode 100644 tests/event/test_working.py delete mode 100644 tests/home/__init__.py delete mode 100644 tests/home/test_working.py delete mode 100644 tests/job/__init__.py delete mode 100644 tests/job/test_working.py delete mode 100644 tests/organization/__init__.py delete mode 100644 tests/organization/test_working.py delete mode 100644 tests/pom/__init__.py delete mode 100644 tests/pom/test_working.py delete mode 100644 tests/registration/__init__.py delete mode 100644 tests/registration/test_working.py delete mode 100644 tests/shift/__init__.py delete mode 100644 tests/shift/test_working.py delete mode 100644 tests/volunteer/__init__.py delete mode 100644 tests/volunteer/test_working.py rename tests/authentication/test_working.py => vms/administrator/tests/test_selenium_working.py (87%) diff --git a/.travis.yml b/.travis.yml index df462122a..90428ccb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,24 @@ 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 @@ -11,10 +26,13 @@ before_script: - "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 diff --git a/aut_docs/Setup.md b/aut_docs/Setup.md index 219573533..59c136163 100644 --- a/aut_docs/Setup.md +++ b/aut_docs/Setup.md @@ -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 ` - If all tests pass, `OK` will be received at the end. diff --git a/docs/Installation_Guide.md b/docs/Installation_Guide.md index 3f5e120d2..adda940b2 100644 --- a/docs/Installation_Guide.md +++ b/docs/Installation_Guide.md @@ -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 @@ -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 ``` @@ -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 +``` diff --git a/requirements.txt b/requirements.txt index 245c6ddbe..bc07a6287 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/administrator/__init__.py b/tests/administrator/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/administrator/test_working.py b/tests/administrator/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/administrator/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/authentication/__init__.py b/tests/authentication/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/event/__init__.py b/tests/event/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/event/test_working.py b/tests/event/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/event/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/home/__init__.py b/tests/home/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/home/test_working.py b/tests/home/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/home/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/job/__init__.py b/tests/job/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/job/test_working.py b/tests/job/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/job/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/organization/__init__.py b/tests/organization/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/organization/test_working.py b/tests/organization/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/organization/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/pom/__init__.py b/tests/pom/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/pom/test_working.py b/tests/pom/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/pom/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/registration/__init__.py b/tests/registration/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/registration/test_working.py b/tests/registration/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/registration/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/shift/__init__.py b/tests/shift/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/shift/test_working.py b/tests/shift/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/shift/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/volunteer/__init__.py b/tests/volunteer/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/volunteer/test_working.py b/tests/volunteer/test_working.py deleted file mode 100644 index 742cec491..000000000 --- a/tests/volunteer/test_working.py +++ /dev/null @@ -1,41 +0,0 @@ -# Third Party Imports -from selenium import webdriver - -# Django imports -from django.contrib.staticfiles.testing import LiveServerTestCase - -# Local Project Imports -from selenium.webdriver.common.keys import Keys - - -class DummyTesting(LiveServerTestCase): - """ - Dummy Test Class to check the tests are working correctly. - """ - - @classmethod - def setUpClass(cls): - cls.driver = webdriver.Firefox() - cls.driver.implicitly_wait(5) - cls.driver.maximize_window() - super(DummyTesting, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - cls.driver.quit() - super(DummyTesting, cls).tearDownClass() - - def test_working(self): - """ - Dummy Test function to check working of selenium - Delete this function after the first test for this - Class is added. - """ - self.driver.get("http://www.python.org") - self.assertIn('Python', self.driver.title) - element = self.driver.find_element_by_name('q') - element.clear() - element.send_keys('pycon') - element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source - diff --git a/tests/authentication/test_working.py b/vms/administrator/tests/test_selenium_working.py similarity index 87% rename from tests/authentication/test_working.py rename to vms/administrator/tests/test_selenium_working.py index 742cec491..13d6c58cf 100644 --- a/tests/authentication/test_working.py +++ b/vms/administrator/tests/test_selenium_working.py @@ -10,7 +10,9 @@ class DummyTesting(LiveServerTestCase): """ - Dummy Test Class to check the tests are working correctly. + Dummy Test Class to check the selenium is working correctly. + Delete this file after uncommenting the selenium tests + currently present. """ @classmethod @@ -37,5 +39,5 @@ def test_working(self): element.clear() element.send_keys('pycon') element.send_keys(Keys.RETURN) - self.assertNotIn('No results found.', self.driver.page_source + self.assertNotIn('No results found.', self.driver.page_source)