本文整理汇总了Python中test_initializer.TestInitializer.quit方法的典型用法代码示例。如果您正苦于以下问题:Python TestInitializer.quit方法的具体用法?Python TestInitializer.quit怎么用?Python TestInitializer.quit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_initializer.TestInitializer
的用法示例。
在下文中一共展示了TestInitializer.quit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EditModulePageTest
# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import quit [as 别名]
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()
示例2: MainNavigationTest
# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import quit [as 别名]
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()
示例3: UserPermissionsTest
# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import quit [as 别名]
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()
示例4: LoginTest
# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import quit [as 别名]
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.quit()
示例5: EditExercisePageTest
# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import quit [as 别名]
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.quit()
示例6: HomePageTest
# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import quit [as 别名]
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: StaffPageTest
# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import quit [as 别名]
class StaffPageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
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('/first-exercise-round/' + str(x + 1) + "/submissions/" in str(self.driver.current_url))
def tearDown(self):
self.driver.quit()
示例8: TeacherFeedbackTest
# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import quit [as 别名]
class TeacherFeedbackTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
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.quit()