Ticket #13614: 13614-test.diff

File 13614-test.diff, 2.1 KB (added by Tim Graham, 8 years ago)
  • tests/admin_widgets/tests.py

    diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
    index ce1ef0e..7fb26ce 100644
    a b class HorizontalVerticalFilterSeleniumFirefoxTests(SeleniumDataMixin, AdminSelen  
    11401140        self.assertEqual(list(self.school.alumni.all()),
    11411141                         [self.jason, self.peter])
    11421142
     1143    def test_back_button_bug(self):
     1144        self.school.students.set([self.lisa, self.peter])
     1145        self.school.alumni.set([self.lisa, self.peter])
     1146
     1147        self.admin_login(username='super', password='secret', login_url='/')
     1148        change_url = reverse('admin:admin_widgets_school_change', args=(self.school.id,))
     1149        self.selenium.get(self.live_server_url + change_url)
     1150
     1151        # Navigate away and go back to the change form page -------------------
     1152        self.selenium.find_element_by_link_text('Home').click()
     1153        self.selenium.back()
     1154        self.wait_for('#id_students_from')
     1155        # Check that everything is still in place -----------------------------
     1156        # Don't take in account the order of options in the select controls
     1157        # to accommodate behavior divergence by some browsers (i.e. Firefox)
     1158        from_box = '#id_students_from'
     1159        to_box = '#id_students_to'
     1160        self.assertSelectOptions(from_box, [
     1161            str(self.arthur.id), str(self.bob.id), str(self.cliff.id),
     1162            str(self.jason.id), str(self.jenny.id), str(self.john.id),
     1163        ])
     1164        self.assertSelectOptions(to_box, [str(self.lisa.id), str(self.peter.id)])
     1165
     1166        from_box = '#id_alumni_from'
     1167        to_box = '#id_alumni_to'
     1168        self.assertSelectOptions(from_box, [
     1169            str(self.arthur.id), str(self.bob.id), str(self.cliff.id),
     1170            str(self.jason.id), str(self.jenny.id), str(self.john.id),
     1171        ])
     1172        self.assertSelectOptions(to_box, [str(self.lisa.id), str(self.peter.id)])
     1173
    11431174
    11441175class HorizontalVerticalFilterSeleniumChromeTests(HorizontalVerticalFilterSeleniumFirefoxTests):
    11451176    webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
Back to Top