mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-02-09 00:09:44 +00:00
* Started POM and assets test * FEAT: Adapt unit tests from RIGS to assets * CHORE: pep8... * Added Asset Create and Edit forms * Add non-cable asset creation test * CHORE: Frickin pep8... * Add cable asset creation test * Basic asset create validation testing * Asset edit tests are here A bit dodgy in places but par for the course for me :P * Add access level tests * Delete unused code Much less effort way to increase coverage stats :D * Add delete sample data test for completeness Chasing that sweet 100% coverage... * Add supplier list page + tests Also fix the supplier page not being ordered alphabetically * Helps if I add the migration... * Add supplier create/edit tests * Asset duplicate tests Also fixed some random bugs * Asset search tests * 404 tests and test that everything requires authentication * Test visibility of form errors And fix supplier form not displaying errors correctly! * Fix broken search test Co-authored-by: Matthew Smith <mattysmith22@googlemail.com>
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
from django.test import LiveServerTestCase
|
|
from selenium import webdriver
|
|
from RIGS import models as rigsmodels
|
|
from . import pages
|
|
import os
|
|
|
|
|
|
def create_browser():
|
|
options = webdriver.ChromeOptions()
|
|
options.add_argument("--window-size=1920,1080")
|
|
if os.environ.get('CI', False):
|
|
options.add_argument("--headless")
|
|
options.add_argument("--no-sandbox")
|
|
driver = webdriver.Chrome(chrome_options=options)
|
|
return driver
|
|
|
|
|
|
class BaseTest(LiveServerTestCase):
|
|
def setUp(self):
|
|
super().setUpClass()
|
|
self.driver = create_browser()
|
|
|
|
def tearDown(self):
|
|
super().tearDown()
|
|
self.driver.quit()
|
|
|
|
|
|
class AutoLoginTest(BaseTest):
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.profile = rigsmodels.Profile(
|
|
username="EventTest", first_name="Event", last_name="Test", initials="ETU", is_superuser=True)
|
|
self.profile.set_password("EventTestPassword")
|
|
self.profile.save()
|
|
loginPage = pages.LoginPage(self.driver, self.live_server_url).open()
|
|
loginPage.login("EventTest", "EventTestPassword")
|