Skip to content

Commit

Permalink
Merge pull request #127 from MithishR/ojus-selenium-implementation
Browse files Browse the repository at this point in the history
Selenium added to testing
  • Loading branch information
Sparshkhannaa authored Mar 28, 2024
2 parents 9927554 + 1f81957 commit 79a773f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 10 additions & 10 deletions Django/communicado/pages/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
from django.urls import reverse
from .models import *
from django.test import LiveServerTestCase
#from selenium import webdriver
#from selenium.webdriver.common.keys import Keys
#from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import time

# Example 1

#class Hosttest(LiveServerTestCase):
class Hosttest(LiveServerTestCase):

# def testhomepage(self):
# options = Options()
# options.headless = True
# driver = webdriver.Chrome(options=options)
# driver.get(self.live_server_url)
def testhomepage(self):
options = Options()
options.headless = True
driver = webdriver.Chrome(options=options)
driver.get(self.live_server_url)
# try driver.get(self.live_server_url) if driver.get('http://127.0.0.1:8000/') does not work
# assert "Hello, world!" in driver.title
assert "Hello, world!" in driver.title

class UsersTestCase(TestCase):

Expand Down
3 changes: 2 additions & 1 deletion Django/communicado/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Django==4.2.3
mysqlclient==2.1.0
django-jazzmin==2.4.5
django-jazzmin==2.4.5
selenium==4.18.1

0 comments on commit 79a773f

Please sign in to comment.