class SignInTest(unittest.TestCase):
    def setUp(self):
        self.browser = Browser()
        self.driver = self.browser.start()
        self.driver.get('http://staging.in-ter-stel-lar.com/')

    def test_logging_teacher_should_succeed(self):
        #given
        user = '******'
        password = '******'

        #when
        sign_in_page = IndexPage(self.driver).open_sign_in_page()
        post_sign_in_page = sign_in_page.log_in(user, password)

        #then
        assert_that(post_sign_in_page.get_page_source(),
                    contains_string('Login successful!'))

    def test_with_invalid_credentials(self):
        #given
        user = '******'
        password = 1234567
        incorrect_password = '******'

        #when
        sign_in_page = IndexPage(self.driver).open_sign_in_page()
        post_sign_in_page = sign_in_page.log_in(user, password)

        #then
        assert_that(post_sign_in_page.get_page_source(),
                    contains_string(incorrect_password))

    def test_with_fake_data(self):
        #given
        user = '******'
        password = '******'

        #when
        sign_in_page = IndexPage(self.driver).open_sign_in_page()
        post_sign_in_page = sign_in_page.log_in(user, password)

        #then
        #then
        assert_that(post_sign_in_page.get_page_source(),
                    contains_string("Invalid username"))

    def test_forgot_password(self):
        #given
        email = '*****@*****.**'
        alert = 'Instructions to reset your password have been emailed to you.'

        #when
        forgot_password_page = IndexPage(
            self.driver).open_forgot_password_page()
        post_forgot_password_page = forgot_password_page.type_password(email)

        #then
        assert_that(post_forgot_password_page.get_page_source(),
                    contains_string(alert))
Exemple #2
0
class SignInTest(unittest.TestCase):
    def setUp(self):
        self.browser = Browser()
        self.driver = self.browser.start()
        self.driver.get('http://staging.in-ter-stel-lar.com/')

    def test_logging_teacher_should_succeed(self):
        #given
        user = '******'
        password = '******'

        #when
        var = IndexPage(self.driver).open_sign_in_page
        post_sign_in_page.log_in(user, password)
Exemple #3
0
 def setUp(self):
     self.browser = Browser()
     self.driver = self.browser.start()
     self.driver.get('http://staging.in-ter-stel-lar.com/')
class EditProfileTest(unittest.TestCase):
    def setUp(self):
        self.browser = Browser()
        self.driver = self.browser.start()
        self.driver.get('http://staging.in-ter-stel-lar.com/')

    def login(self):
        user = '******'
        password = '******'
        #when
        sign_in_page = IndexPage(self.driver).open_sign_in_page()
        post_sign_in_page = sign_in_page.log_in(user, password)

    def test_edit_profile(self):
        #given
        first_name = "Tom", +randint(1, 100)
        last_name = "Cox", +randint(1, 10)
        phone = "500123456"
        bio = "SAasldhasjdjasldkalksdjhasdj,dasasdsadsadas"
        #when
        self.login()
        #then
        teacher_index_page = TeacherIndexPage(
            self.driver).open_teacher_profile_page()
        post_edit_teacher_profile_page = teacher_index_page.edit_form(
            first_name, last_name, phone, bio)
        assert_that(post_edit_teacher_profile_page.get_page_source(),
                    contains_string('Your account has been updated.'))

    def test_change_password(self):
        #given
        password = '******'
        confirmation_pass = '******'
        #when
        self.login()
        #then
        teacher_index_page = TeacherIndexPage(
            self.driver).open_teacher_profile_page()
        post_teacher_index_page = teacher_index_page.change_password(
            password, confirmation_pass)

    def test_edit_school(self):
        #given
        school = "Hogwarts", +randint(1, 1000)
        city = "alaska", +randint(1, 1000)
        #when
        self.login()
        #then
        teacher_index_page = TeacherIndexPage(
            self.driver).open_teacher_profile_page()
        post_teacher_index_page = teacher_index_page.edit_school(school, city)

    def test_upload_avatar(self):
        #given
        avatar_path = "logo", randint(1, 5), ".jpg"
        #when
        self.login()
        #then
        teacher_index_page = TeacherIndexPage(
            self.driver).open_teacher_profile_page()
        post_edit_teacher_profile_page = teacher_index_page.upload_avatar(
            avatar_path)
        assert_that(post_edit_teacher_profile_page.get_page_source(),
                    contains_string('Your account has been updated'))
Exemple #5
0
class SignUpTest(unittest.TestCase):
    def setUp(self):
        print('test')
        self.browser = Browser()
        self.driver = self.browser.start()
        self.driver.get('http://staging.in-ter-stel-lar.com/')

    def test_registration_should_succeed(self):
        for x in range(1, 100):
            first_name = "Tony", +randint(1, 10000)
            last_name = "Montana", +randint(1, 999)
            email = "tony.montana", +randint(1, 1000), "@netguru.pl"
            req_password = '******'
            req_password2 = '123456'
            school_name = 'hogwarts'
            school_city = 'tol bared'
            sign_up_page = IndexPage(self.driver).open_sign_up_page()
            post_sign_up_page = sign_up_page.sign_up(first_name, last_name,
                                                     email, req_password,
                                                     req_password2,
                                                     school_name, school_city)
            TeacherIndexPage(self.driver).log_out()

    def test_user_does_not_type_any_password(self):
        #given
        first_name = "Jimmy", +randint(1, 100)
        last_name = "Bond"
        email = "*****@*****.**"
        req_password = ''
        req_password2 = ''
        school_name = 'Beauxbautons'
        school_city = 'Paris'

        # when
        sign_up_page = IndexPage(self.driver).open_sign_up_page()
        post_sign_up_page = sign_up_page.sign_up(first_name, last_name, email,
                                                 req_password, req_password2,
                                                 school_name, school_city)
        # then
        assert_that(
            sign_up_page.get_page_source(),
            contains_string('Password must have a minimum of 6 characters.'))
        assert_that(
            sign_up_page.get_page_source(),
            contains_string(
                'Password confirmation must have a minimum of 6 characters.'))

    def test_user_types_one_password(self):
        first_name = "Jimmy", +randint(1, 100)
        last_name = "Bond"
        email = "*****@*****.**"
        req_password = ''
        school_name = 'Beauxbautons'
        school_city = 'Paris'

        # when
        sign_up_page = IndexPage(self.driver).open_sign_up_page()
        post_sign_up_page = sign_up_page.sign_up(first_name, last_name, email,
                                                 req_password, req_password2,
                                                 school_name, school_city)

    def test_user_does_not_type_school_name(self):
        #given
        first_name = "Jimmy", +randint(1, 100)
        last_name = "Bond"
        email = "*****@*****.**"
        req_password = '******', +randint(1, 100)
        req_password2 = 'powermetal', +randint(1, 100)
        school_name = ''
        school_city = 'Paris'
        #when
        sign_up_page = IndexPage(self.driver).open_sign_up_page()
        post_sign_up_page = sign_up_page.sign_up(first_name, last_name, email,
                                                 req_password, req_password2,
                                                 school_name, school_city)
        #then
        assert_that(sign_up_page.get_page_source(),
                    contains_string('Name can\'t be blank.'))