Skip to content

Commit

Permalink
trying travis ci and selenium debug
Browse files Browse the repository at this point in the history
  • Loading branch information
abidibo committed May 26, 2020
1 parent cb6278c commit e59d449
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ install:
- pip install --upgrade pip
- pip install $DJANGO_VERSION --upgrade
- pip install oauth2client==1.5.2
- pip install webdriver-manager
- pip install python-dotenv
- django-admin.py --version
- pip install selenium
Expand All @@ -22,6 +23,7 @@ env:
- DJANGO_VERSION='Django>=2.2,<3.0'
- DJANGO_VERSION='Django>=3.0,<3.1'
- CHROME_DRIVER_PATH='/usr/lib/chromium-browser/chromedriver'
- TRAVIS_CI='1'
script:
- cd testapp/app && python manage.py test
branches:
Expand Down
1 change: 1 addition & 0 deletions testapp/.env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CHROME_DRIVER_PATH=/home/abidibo/Applications/chromedriver_linux64/chromedriver
TRAVIS_CI=0
18 changes: 14 additions & 4 deletions testapp/app/app/tests/test_e2e_login.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import os
from dotenv import load_dotenv
load_dotenv()

from django.test import TestCase
from dotenv import load_dotenv
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager

load_dotenv()



class TestBatonLogin(TestCase):
Expand All @@ -17,12 +20,19 @@ def setUp(self):
chrome_options.add_argument("--headless")
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-dev-shm-usage')
self.driver = webdriver.Chrome(
options=chrome_options, executable_path=os.getenv('CHROME_DRIVER_PATH'))
ChromeDriverManager().install(),
options=chrome_options,)

def test_form(self):
self.driver.get('http://localhost:8000/admin')
header_field = self.driver.find_element_by_id("header")
# wait for page to load
try:
element_present = EC.presence_of_element_located(
(By.ID, 'header'))
WebDriverWait(self.driver, 10).until(element_present)
except TimeoutException:
print("Timed out waiting for page to load")
self.assertEqual(header_field.text, 'Baton Test App')

0 comments on commit e59d449

Please sign in to comment.