From 48b7e7cf189515c6a4b07450691be8334cb42093 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Sun, 11 Oct 2015 11:39:33 +0100 Subject: [PATCH 1/2] Added test for rig/non-rig changing --- RIGS/test_functional.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/RIGS/test_functional.py b/RIGS/test_functional.py index 378f859b..cc145d7e 100644 --- a/RIGS/test_functional.py +++ b/RIGS/test_functional.py @@ -613,7 +613,38 @@ class EventTest(LiveServerTestCase): event = models.Event.objects.get(name='Test Event Name') self.assertIn("N0000%d | Test Event Name"%event.pk, self.browser.find_element_by_xpath('//h1').text) + def testRigNonRig(self): + self.browser.get(self.live_server_url + '/event/create/') + # Gets redirected to login and back + self.authenticate('/event/create/') + wait = WebDriverWait(self.browser, 10) #setup WebDriverWait to use later (to wait for animations) + self.browser.implicitly_wait(3) #Set session-long wait (only works for non-existant DOM objects) + + wait.until(animation_is_finished()) + + # Click Non-Rig button + self.browser.find_element_by_xpath('//button[.="Non-Rig"]').click() + + # Click Rig button + self.browser.find_element_by_xpath('//button[.="Rig"]').click() + + form = self.browser.find_element_by_tag_name('form') + save = self.browser.find_element_by_xpath('(//button[@type="submit"])[3]') + + # Set title + e = self.browser.find_element_by_id('id_name') + e.send_keys('Test Event Name') + + # Set an arbitrary date + form.find_element_by_id('id_start_date').clear() + form.find_element_by_id('id_start_date').send_keys('3015-04-24') + + # Save the rig + save.click() + detail_panel = self.browser.find_element_by_xpath("//div[@id='content']/div/div[6]/div/div") + self.assertTrue(detail_panel.is_displayed()) + self.assertIn("Event Detail", detail_panel.text) def testEventDetail(self): with transaction.atomic(), reversion.create_revision(): From 932b4a685224d839865b9b9bc535b63f0cee412b Mon Sep 17 00:00:00 2001 From: David Taylor Date: Sun, 11 Oct 2015 11:39:49 +0100 Subject: [PATCH 2/2] Fixed changing between rig/non-rig --- RIGS/templates/RIGS/event_form.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RIGS/templates/RIGS/event_form.html b/RIGS/templates/RIGS/event_form.html index b0b94e14..0e7aa6ad 100644 --- a/RIGS/templates/RIGS/event_form.html +++ b/RIGS/templates/RIGS/event_form.html @@ -57,14 +57,14 @@ $('#is_rig-selector button').on('click', function () { $('.form-non_rig').slideDown(); if ($(this).data('is_rig') == 1) { - $('#{{form.is_rig.auto_id}}').attr('checked', true); + $('#{{form.is_rig.auto_id}}').prop('checked', true); if ($('.form-non_rig').is(':hidden')) { $('.form-is_rig').show(); } else { $('.form-is_rig').slideDown(); } } else { - $('#{{form.is_rig.auto_id}}').attr('checked', false); + $('#{{form.is_rig.auto_id}}').prop('checked', false); $('.form-is_rig').slideUp(); } })