当前位置: 首页>>代码示例>>Python>>正文


Python TestInitializer.close方法代码示例

本文整理汇总了Python中test_initializer.TestInitializer.close方法的典型用法代码示例。如果您正苦于以下问题:Python TestInitializer.close方法的具体用法?Python TestInitializer.close怎么用?Python TestInitializer.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test_initializer.TestInitializer的用法示例。


在下文中一共展示了TestInitializer.close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainNavigationTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [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.close()
开发者ID:LassiHaaranen,项目名称:a-plus,代码行数:27,代码来源:main_navigation_test.py

示例2: LoginTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [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.close()
开发者ID:LassiHaaranen,项目名称:a-plus,代码行数:30,代码来源:login_test.py

示例3: EditModulePageTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [as 别名]
class EditModulePageTest(unittest.TestCase):
    def setUp(self):
        self.driver = TestInitializer().getFirefoxDriverWithLoggingEnabled()
        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.close()
开发者ID:N1cc3,项目名称:a-plus,代码行数:33,代码来源:edit_module_page_test.py

示例4: UserPermissionsTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [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()
        basePage = BasePage(self.driver)
        self.assertTrue(basePage.isElementVisible(BasePageLocators.TEACHERS_VIEW_LINK))
        self.assertTrue(basePage.isElementVisible(StaffPageLocators.SUBMISSION_LINKS))
        basePage.clickTeachersViewLink()
        self.assertEqual(self.baseUrl + 'teachers/', str(self.driver.current_url))

    def testShouldHaveAssistantsPermissions(self):
        LoginPage(self.driver).loginAsAssistant()
        basePage = BasePage(self.driver)
        self.assertFalse(basePage.isElementVisible(BasePageLocators.TEACHERS_VIEW_LINK))
        self.assertTrue(basePage.isElementVisible(StaffPageLocators.SUBMISSION_LINKS))

    def testShouldHaveStudentsPermissions(self):
        LoginPage(self.driver).loginAsStudent()
        basePage = BasePage(self.driver)
        self.assertFalse(basePage.isElementVisible(BasePageLocators.TEACHERS_VIEW_LINK))
        self.assertFalse(basePage.isElementVisible(StaffPageLocators.SUBMISSION_LINKS))

    def tearDown(self):
        self.driver.close()
开发者ID:LassiHaaranen,项目名称:a-plus,代码行数:30,代码来源:user_permissions_test.py

示例5: EditExercisePageTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [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.close()
开发者ID:LassiHaaranen,项目名称:a-plus,代码行数:33,代码来源:edit_exercise_page_test.py

示例6: HomePageTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [as 别名]
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()
开发者ID:N1cc3,项目名称:a-plus,代码行数:13,代码来源:home_page_test.py

示例7: StaffPageTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [as 别名]
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()
开发者ID:N1cc3,项目名称:a-plus,代码行数:18,代码来源:staff_page_test.py

示例8: TeacherFeedbackTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [as 别名]
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()
开发者ID:PasiSa,项目名称:a-plus,代码行数:45,代码来源:teacher_feedback_test.py

示例9: CourseArchivePageTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [as 别名]
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()
开发者ID:N1cc3,项目名称:a-plus,代码行数:22,代码来源:course_archive_page_test.py

示例10: SubmissionsPageTest

# 需要导入模块: from test_initializer import TestInitializer [as 别名]
# 或者: from test_initializer.TestInitializer import close [as 别名]
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()
开发者ID:PasiSa,项目名称:a-plus,代码行数:42,代码来源:submissions_page_test.py


注:本文中的test_initializer.TestInitializer.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。