本文整理汇总了Python中test_initializer.TestInitializer类的典型用法代码示例。如果您正苦于以下问题:Python TestInitializer类的具体用法?Python TestInitializer怎么用?Python TestInitializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestInitializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainNavigationTest
class MainNavigationTest(unittest.TestCase):
baseUrl = BasePage.base_url + "/aplus1/basic_instance/"
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
LoginPage(self.driver).loginAsTeacher()
def testNavigateToResults(self):
BasePage(self.driver).clickResultsLink()
self.assertEqual(self.baseUrl + 'user/results/', str(self.driver.current_url))
#def testNavigateToUserPage(self):
# BasePage(self.driver).clickUserLink()
# self.assertEqual(self.baseUrl + 'user/notifications/', str(self.driver.current_url))
def testNavigateToTeachersView(self):
BasePage(self.driver).clickTeachersViewLink()
self.assertEqual(self.baseUrl + 'teachers/', str(self.driver.current_url))
# def testDownloadCalendar(self):
# BasePage(self.driver).clickCalendarFeedLink()
# self.assertEqual("Download calendar (ics)", str(self.driver.switch_to.active_element.text))
def tearDown(self):
self.driver.quit()
示例2: UserPermissionsTest
class UserPermissionsTest(unittest.TestCase):
baseUrl = BasePage.base_url + "/aplus1/basic_instance/"
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
def testShouldHaveTeachersPermissions(self):
LoginPage(self.driver).loginAsTeacher()
self.assertEqual(self.baseUrl, str(self.driver.current_url))
basePage = BasePage(self.driver)
self.assertTrue(basePage.isElementPresent(BasePageLocators.TEACHERS_VIEW_LINK))
self.assertTrue(basePage.isElementPresent(StaffPageLocators.SUBMISSION_LINKS))
basePage.clickTeachersViewLink()
self.assertEqual(self.baseUrl + 'teachers/', str(self.driver.current_url))
def testShouldHaveAssistantsPermissions(self):
LoginPage(self.driver).loginAsAssistant()
self.assertEqual(self.baseUrl, str(self.driver.current_url))
basePage = BasePage(self.driver)
self.assertFalse(basePage.isElementPresent(BasePageLocators.TEACHERS_VIEW_LINK))
self.assertTrue(basePage.isElementPresent(StaffPageLocators.SUBMISSION_LINKS))
def testShouldHaveStudentsPermissions(self):
LoginPage(self.driver).loginAsStudent()
self.assertEqual(self.baseUrl, str(self.driver.current_url))
basePage = BasePage(self.driver)
self.assertFalse(basePage.isElementPresent(BasePageLocators.TEACHERS_VIEW_LINK))
self.assertFalse(basePage.isElementPresent(StaffPageLocators.SUBMISSION_LINKS))
def tearDown(self):
self.driver.quit()
示例3: EditModulePageTest
class EditModulePageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
TestInitializer().recreateDatabase()
LoginPage(self.driver).loginAsTeacher()
def testShouldSaveModule(self):
COURSE_NAME = "Testikurssi"
POINTS_TO_PASS = "10"
OPENING_TIME = "2014-01-01 00:00:00"
CLOSING_TIME = "2016-01-01 00:00:00"
MODULE_ID = 1
editModulePage = EditModulePage(self.driver, MODULE_ID)
editModulePage.setCourseName(COURSE_NAME)
editModulePage.setPointsToPass(POINTS_TO_PASS)
editModulePage.setOpeningTime(OPENING_TIME)
editModulePage.setClosingTime(CLOSING_TIME)
editModulePage.submit()
self.assertTrue(editModulePage.isSuccessfulSave())
editModulePage = EditModulePage(self.driver, MODULE_ID)
self.assertEqual(editModulePage.getCourseName(), COURSE_NAME)
self.assertEqual(editModulePage.getPointsToPass(), POINTS_TO_PASS)
self.assertEqual(editModulePage.getOpeningTime(), OPENING_TIME)
self.assertEqual(editModulePage.getClosingTime(), CLOSING_TIME)
def tearDown(self):
self.driver.quit()
示例4: LoginTest
class LoginTest(unittest.TestCase):
logoutPageURI = '/accounts/logout'
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
def testLoginToTestCourseInstance(self):
LoginPage(self.driver).loginToCourse(CourseName.APLUS)
homePage = HomePage(self.driver, CourseName.APLUS)
self.assertEqual(homePage.getCourseBanner(), 'aplus-001 My test course')
self.assertTrue(LoginPage.defaultUsername in homePage.getLoggedInText())
def testLoginToExampleHookCourseInstance(self):
LoginPage(self.driver).loginToCourse(CourseName.HOOK)
homePage = HomePage(self.driver, CourseName.HOOK)
self.assertEqual(homePage.getCourseBanner(), 'aplus-001 My test course')
self.assertTrue(LoginPage.defaultUsername in homePage.getLoggedInText())
def testShouldThrowTimeoutExceptionOnWrongCredentials(self):
loginPage = LoginPage(self.driver)
try:
loginPage.loginToCourse(CourseName.APLUS, 'fake', 'password')
except Exception:
return
self.fail("There should have been an exception")
def tearDown(self):
self.driver.close()
示例5: EditExercisePageTest
class EditExercisePageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
TestInitializer().recreateDatabase()
LoginPage(self.driver).loginAsTeacher()
def testShouldSaveExercise(self):
exerciseName = "Testiharjoitus"
maxSubmissions = "5"
maxPoints = "99"
pointToPass = "50"
exerciseNumber = 1
editExercisePage = EditExercisePage(self.driver, exerciseNumber)
editExercisePage.setExerciseName(exerciseName)
editExercisePage.setMaxSubmissions(maxSubmissions)
editExercisePage.setMaxPoints(maxPoints)
editExercisePage.setPointsToPass(pointToPass)
editExercisePage.submit()
self.assertTrue(editExercisePage.isSuccessfulSave())
editExercisePage = EditExercisePage(self.driver, exerciseNumber)
self.assertEqual(editExercisePage.getExerciseName(), exerciseName)
self.assertEqual(editExercisePage.getMaxSubmissions(), maxSubmissions)
self.assertEqual(editExercisePage.getMaxPoints(), maxPoints)
self.assertEqual(editExercisePage.getPointsToPass(), pointToPass)
def tearDown(self):
self.driver.close()
示例6: HomePageTest
class HomePageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
TestInitializer().recreateDatabase()
LoginPage(self.driver).loginAsStudent()
def testInitialScoreShouldBeZero(self):
self.assertEqual("0 / 300", HomePage(self.driver).getMainScore())
def tearDown(self):
self.driver.quit()
示例7: HomePageTest
class HomePageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getFirefoxDriverWithLoggingEnabled()
TestInitializer().recreateDatabase()
LoginPage(self.driver).loginAsStudent()
def testInitialScoreShouldBeZero(self):
self.assertEqual("0 / 300", HomePage(self.driver).getMainScore())
def tearDown(self):
self.driver.close()
示例8: StaffPageTest
class StaffPageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getFirefoxDriverWithLoggingEnabled()
LoginPage(self.driver).loginAsAssistant()
@unittest.skip
def testShouldOpenAllAssistantsViewSubmissionPages(self):
linkCount = len(AssistantsPage(self.driver).getSubmissionLinks())
for x in range(0, linkCount):
assistantsPage = AssistantsPage(self.driver)
assistantsPage.clickSubmissionLink(x)
self.assertTrue('/exercises/' + str(x + 1) + "/submissions/" in str(self.driver.current_url))
def tearDown(self):
self.driver.close()
示例9: TeacherFeedbackTest
class TeacherFeedbackTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getFirefoxDriverWithLoggingEnabled()
TestInitializer().recreateDatabase()
def testStudentShouldGetFeedbackWithNotification(self):
ASSISTANT_FEEDBACK_TEXT = "ASSISTANT_FEEDBACK"
FEEDBACK_TEXT = "FEEDBACK"
EXERCISE_NUMBER = "2"
SUBMISSION_NUMBER = 1
POINTS = "50"
# Submit exercise
LoginPage(self.driver).loginAsStudent()
fileUploadGrader = FileUploadGrader(self.driver)
fileUploadGrader.submit()
fileUploadGrader.logout()
# Check submissions
LoginPage(self.driver).loginAsAssistant()
submissionPage = SubmissionPage(self.driver, exerciseId=EXERCISE_NUMBER)
self.assertEqual(submissionPage.getSubmissionCount(), 1)
# Assess exercise
assessmentPage = AssessmentPage(self.driver, exerciseId=EXERCISE_NUMBER, submissionNumber=SUBMISSION_NUMBER)
assessmentPage.setAssistantFeedback(ASSISTANT_FEEDBACK_TEXT)
assessmentPage.setFeedback(FEEDBACK_TEXT)
assessmentPage.setPoints(POINTS)
assessmentPage.submit()
assessmentPage.logout()
# Check that student receives the correct assessment and a notification of it
LoginPage(self.driver).loginAsStudent()
homePage = HomePage(self.driver)
self.assertTrue(homePage.hasNewNotifications())
studentFeedbackPage = StudentFeedbackPage(self.driver, exerciseId=EXERCISE_NUMBER, submissionNumber=SUBMISSION_NUMBER)
self.assertEqual(studentFeedbackPage.getAssistantFeedbackText(), ASSISTANT_FEEDBACK_TEXT)
self.assertEqual(studentFeedbackPage.getFeedbackText(), FEEDBACK_TEXT)
self.assertEqual(FileUploadGrader(self.driver).getPoints(), POINTS)
def tearDown(self):
self.driver.close()
示例10: CourseArchivePageTest
class CourseArchivePageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getFirefoxDriverWithLoggingEnabled()
def testApiDirectly(self):
page = AbstractPage(self.driver)
page.load("/api/v1/course/?format=json")
data = page.getJSON()
self.assertEqual(len(data["objects"]), 1)
self.assertEqual(len(data["objects"][0]["instances"]), 2)
@unittest.skip("unfixable jquery/ajax problem at plustest")
def testShouldOpenCourseArchivePage(self):
courseArchivePage = CourseArchivePage(self.driver)
courseArchivePage.waitForAjax()
courseArchivePage.getElement(CourseArchiveLocators.APLUS_LINK)
courseArchivePage.getElement(CourseArchiveLocators.HOOK_LINK)
def tearDown(self):
self.driver.close()
示例11: SubmissionsPageTest
class SubmissionsPageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getFirefoxDriverWithLoggingEnabled()
TestInitializer().recreateDatabase()
LoginPage(self.driver).loginAsAssistant()
def testShouldContainAsManySubmissionsAsSubmitted(self):
firstExercisePage = MyFirstExerciseGrader(self.driver)
firstExercisePage.setText("123test")
firstExercisePage.submit()
self.assertEqual(SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(), 1)
firstExercisePage = MyFirstExerciseGrader(self.driver)
firstExercisePage.setText("Hello")
firstExercisePage.submit()
self.assertEqual(SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(), 2)
ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
ajaxExercisePage.setText(-1)
ajaxExercisePage.submit()
self.assertEqual(SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(), 1)
ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
ajaxExercisePage.setText(50)
ajaxExercisePage.submit()
self.assertEqual(SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(), 2)
firstExercisePage = MyFirstExerciseGrader(self.driver)
firstExercisePage.setText("HelloA+")
firstExercisePage.submit()
self.assertEqual(SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(), 3)
ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
ajaxExercisePage.setText(100)
ajaxExercisePage.submit()
self.assertEqual(SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(), 3)
def tearDown(self):
self.driver.close()
示例12: setUp
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
示例13: setUp
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
TestInitializer().recreateDatabase()
LoginPage(self.driver).loginAsTeacher()
示例14: setUp
def setUp(self):
self.driver = TestInitializer().getFirefoxDriverWithLoggingEnabled()
示例15: setUp
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
TestInitializer().recreateDatabase()