mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
* Add absolute URL to power tests * Update to target Python 3.10 * Return user to current page when clicking 'mark reviewed' * Add units to power test record detail and form I'm a bad scientist (coz I'm an engineer) * Allow a higher value in PSSC fields * Default venue to event venue in EC/PT * Fix population of initial venue values for EC/PT * Add link to create power test from EC detail * Do not set power plan field to required on RA "This might be a problem if the risk assessment is being done by one person and the power plan by another." * Default power MIC to MIC * Implement some suggestions from the Doctor * Prevent checking in to cancelled events and dry hires Will close #539 * Exclude dry hires from H&S overview list * Add "ex VAT" tooltips to asset purchase price and replacement cost * Automagically clear and focus ID field when audit modal closes Closes #533 * Delete unused things * Allow two decimal places in cable length, show training item IDs in selectpicker Will close #540 * Fix #524 500 Error when viewing qualification list for items nobody is qualified in * Update README.md * Add a guard against nulls in recent changes Maybe fixes #537 I'm unable to replicate locally * Turn down verbosity of CI tests, fix tests, potential speedup * Squash migration * Add encoding to open * Update to v3 upload-artifact Resolves a deprecation warning
80 lines
2.9 KiB
Python
80 lines
2.9 KiB
Python
import datetime
|
|
import time
|
|
|
|
from django.utils import timezone
|
|
from selenium.webdriver.common.by import By
|
|
from selenium.webdriver.support import expected_conditions as ec
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
|
|
from PyRIGS.tests.base import AutoLoginTest, screenshot_failure_cls, assert_times_almost_equal
|
|
from PyRIGS.tests.pages import animation_is_finished
|
|
from training import models
|
|
from training.tests import pages
|
|
|
|
|
|
def select_super(page, supervisor):
|
|
page.supervisor_selector.toggle()
|
|
assert page.supervisor_selector.is_open
|
|
page.supervisor_selector.search(supervisor.name[:-6])
|
|
time.sleep(2) # Slow down for javascript
|
|
assert page.supervisor_selector.options[0].selected
|
|
page.supervisor_selector.toggle()
|
|
|
|
|
|
def test_add_qualification(logged_in_browser, live_server, trainee, supervisor, training_item):
|
|
page = pages.AddQualification(logged_in_browser.driver, live_server.url, pk=trainee.pk).open()
|
|
# assert page.name in str(trainee)
|
|
|
|
page.depth = "Training Started"
|
|
page.date = date = datetime.date(1984, 1, 1)
|
|
page.notes = "A note"
|
|
|
|
time.sleep(2) # Slow down for javascript
|
|
|
|
page.item_selector.toggle()
|
|
assert page.item_selector.is_open
|
|
page.item_selector.search(training_item.description)
|
|
time.sleep(2) # Slow down for javascript
|
|
# page.item_selector.set_option(training_item.description, True)
|
|
assert page.item_selector.options[0].selected
|
|
page.item_selector.toggle()
|
|
|
|
select_super(page, supervisor)
|
|
|
|
page.submit()
|
|
assert page.success
|
|
qualification = models.TrainingItemQualification.objects.get(trainee=trainee, item=training_item)
|
|
assert qualification.supervisor_id == supervisor.pk
|
|
assert qualification.date == date
|
|
assert qualification.notes == "A note"
|
|
assert qualification.depth == models.TrainingItemQualification.STARTED
|
|
|
|
|
|
def test_session_log(logged_in_browser, live_server, trainee, supervisor, training_item, training_item_2):
|
|
page = pages.SessionLog(logged_in_browser.driver, live_server.url).open()
|
|
|
|
page.date = date = datetime.date(2001, 1, 10)
|
|
page.notes = note = "A general note"
|
|
|
|
time.sleep(2) # Slow down for javascript
|
|
|
|
select_super(page, supervisor)
|
|
|
|
page.trainees_selector.toggle()
|
|
assert page.trainees_selector.is_open
|
|
page.trainees_selector.search(trainee.first_name)
|
|
time.sleep(2) # Slow down for javascript
|
|
page.trainees_selector.set_option(trainee.name, True)
|
|
# assert page.trainees_selector.options[0].selected
|
|
page.trainees_selector.toggle()
|
|
|
|
page.training_started_selector.toggle()
|
|
assert page.training_started_selector.is_open
|
|
page.training_started_selector.search(training_item.description[:-2])
|
|
time.sleep(2) # Slow down for javascript
|
|
# assert page.training_started_selector.options[0].selected
|
|
page.training_started_selector.toggle()
|
|
|
|
page.submit()
|
|
assert page.success
|