Esempio n. 1
0
    def test_deny_join(self):
        email_1, password_1 = signup_teacher_directly()
        email_2, password_2 = signup_teacher_directly()
        name, postcode = create_organisation_directly(email_1)
        _, class_name, access_code = create_class_directly(email_1)
        create_school_student_directly(access_code)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium) \
            .go_to_login_page() \
            .login_no_school(email_2, password_2) \
            .join_organisation(name)

        assert page.__class__.__name__ == 'OnboardingRevokeRequestPage'

        page = page \
            .logout() \
            .go_to_login_page() \
            .login(email_1, password_1)

        assert page.has_join_request(email_2)
        page = page.deny_join_request()

        assert not page.has_join_request(email_2)

        page = page \
            .logout() \
            .go_to_login_page() \
            .login_no_school(email_2, password_2)

        assert page.__class__.__name__ == 'OnboardingOrganisationPage'
Esempio n. 2
0
    def test_create_empty(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium).go_to_login_page().login_no_school(
            email, password)

        page = page.create_organisation_empty()
        assert page.was_form_empty('form-create-organisation')
    def test_create_empty(self):
        email, password = signup_teacher_directly()
        org_name, postcode = create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium).go_to_login_page().login_no_students(
            email, password).create_students_empty()

        assert page.was_form_empty('form-create-students')
Esempio n. 4
0
    def test_create(self):
        email, password = signup_teacher_directly()
        org_name, postcode = create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium).go_to_login_page().login_no_students(
            email, password)

        page, student_name = create_school_student(page)
        assert page.student_exists(student_name)
Esempio n. 5
0
    def test_create_clash(self):
        email_1, password_1 = signup_teacher_directly()
        email_2, password_2 = signup_teacher_directly()
        name, postcode = create_organisation_directly(email_1)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium)\
            .go_to_login_page()\
            .login_no_school(email_2, password_2)\
            .create_organisation_failure(name, password_2, postcode)

        assert page.has_creation_failed()
    def test_login_failure(self):
        email, password = signup_teacher_directly()
        create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)
        student_name, student_password, _ = create_school_student_directly(
            access_code)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium)\
            .go_to_login_page()\
            .student_login_failure(student_name, access_code, 'some other password')

        assert page.has_student_login_failed()
    def test_create_duplicate(self):
        email, password = signup_teacher_directly()
        org_name, postcode = create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)

        student_name = 'bob'

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium).go_to_login_page().login_no_students(
            email, password)

        page = page.type_student_name(student_name).type_student_name(
            student_name).create_students_failure()
        assert page.adding_students_failed()
        assert page.duplicate_students(student_name)
Esempio n. 8
0
    def test_revoke(self):
        email_1, password_1 = signup_teacher_directly()
        email_2, password_2 = signup_teacher_directly()
        name, postcode = create_organisation_directly(email_1)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium)\
            .go_to_login_page()\
            .login_no_school(email_2, password_2)
        page = page.join_organisation(name)
        assert page.__class__.__name__ == 'OnboardingRevokeRequestPage'
        assert page.check_organisation_name(name, postcode)

        page = page.revoke_join()
        assert page.__class__.__name__ == 'OnboardingOrganisationPage'
    def logout(self):
        self.browser.find_element_by_id('logout_menu').click()

        self.browser.find_element_by_id('logout_button').click()
        from portal.tests.pageObjects.portal.home_page_new import HomePage

        return HomePage(self.browser)
Esempio n. 10
0
    def test_create(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium).go_to_login_page().login_no_school(
            email, password)

        page, name, postcode = create_organisation(page, password)
        assert is_organisation_created_message_showing(selenium, name)
Esempio n. 11
0
    def test_join_empty(self):
        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium) \
            .go_to_login_page() \
            .login_no_school(email, password) \
            .join_empty_organisation()

        assert page.__class__.__name__ == 'OnboardingOrganisationPage'
Esempio n. 12
0
    def test_edit_details(self):
        email, password = signup_teacher_directly()
        school_name, postcode = create_organisation_directly(email)
        _, class_name, access_code = create_class_directly(email)
        student_name, password, student = create_school_student_directly(
            access_code)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium) \
            .go_to_login_page() \
            .login(email, password)

        assert page.check_organisation_details({
            'name': school_name,
            'postcode': postcode
        })

        new_name = 'new ' + school_name
        new_postcode = 'OX2 6LE'

        page.change_organisation_details({
            'name': new_name,
            'postcode': new_postcode
        })
        assert page.check_organisation_details({
            'name': new_name,
            'postcode': new_postcode
        })
Esempio n. 13
0
    def test_multiple_schools(self):
        # There was a bug where join requests to school 35 say would go to school 3,
        # 62 would go to 6, etc... this test checks for that

        n = 12

        emails, passwords, names, postcodes = self.initialise_data(n)

        for i in range(n):
            emails[i], passwords[i] = signup_teacher_directly()
            names[i], postcodes[i] = create_organisation_directly(emails[i])

        email, password = signup_teacher_directly()

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium)\
            .go_to_login_page()\
            .login_no_school(email, password)

        page = page.join_organisation(names[n - 1])
        assert page.__class__.__name__ == 'OnboardingRevokeRequestPage'
        assert page.check_organisation_name(names[n - 1], postcodes[n - 1])
Esempio n. 14
0
    def test_edit_clash(self):
        email_1, password_1 = signup_teacher_directly()
        email_2, password_2 = signup_teacher_directly()
        school_name_1, postcode_1 = create_organisation_directly(email_1)
        create_organisation_directly(email_2)
        _, class_name_1, access_code_1 = create_class_directly(email_1)
        _, class_name_2, access_code_2 = create_class_directly(email_2)
        create_school_student_directly(access_code_1)
        create_school_student_directly(access_code_2)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium).go_to_login_page().login(email_2, password_2)

        assert not page.check_organisation_details({
            'name': school_name_1,
            'postcode': postcode_1
        })

        page = page.change_organisation_details({
            'name': school_name_1,
            'postcode': postcode_1
        })

        assert page.has_edit_failed()
Esempio n. 15
0
    def test_kick(self):
        email_1, password_1 = signup_teacher_directly()
        name, postcode = create_organisation_directly(email_1)
        _, class_name, access_code = create_class_directly(email_1)
        create_school_student_directly(access_code)

        title, first_name, last_name, email_2, password_2 = generate_details()

        new_last_name = "New Teacher"

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium) \
            .go_to_signup_page() \
            .signup(title, first_name, new_last_name, email_2, password_2, password_2)

        assert page.__class__.__name__ == 'EmailVerificationNeededPage'

        page = email_utils.follow_verify_email_link_to_onboarding(
            page, mail.outbox[0])
        mail.outbox = []

        page = page.login_no_school(email_2,
                                    password_2).join_organisation(name)

        assert page.__class__.__name__ == 'OnboardingRevokeRequestPage'

        page = page \
            .logout() \
            .go_to_login_page() \
            .login(email_1, password_1)

        page = page.accept_join_request()

        assert page.is_teacher_in_school(new_last_name)

        page = page.click_kick_button().confirm_dialog()

        assert page.is_not_teacher_in_school(new_last_name)
Esempio n. 16
0
    def test_disable_2FA(self):
        email_1, password_1 = signup_teacher_directly()
        email_2, password_2 = signup_teacher_directly()
        name, postcode = create_organisation_directly(email_1)
        _, class_name, access_code = create_class_directly(email_1)
        create_school_student_directly(access_code)
        join_teacher_to_organisation(email_2, name, postcode)

        selenium.get(self.live_server_url + "/portal/redesign/home")
        page = HomePage(selenium) \
            .go_to_login_page() \
            .login(email_1, password_1)

        assert page.__class__.__name__ == 'TeachDashboardPage'

        page = page.click_make_admin_button().confirm_dialog()

        assert page.is_teacher_admin()

        page = page.click_make_non_admin_button()

        assert page.is_teacher_non_admin()
 def go_to_homepage(self):
     path = reverse('home_new')
     self._go_to_path(path)
     return HomePage(selenium)