'''
Frontend tests for registering users.
'''
from seleniumbase import BaseCase
from blog_test.conftest import base_url


class FrontEndHomePageTest(BaseCase):

    def test_register_success(self, *_):
        self.open(base_url + '/signup')
        self.type('#email', '<EMAIL>')
        self.type('#username', 'frontRegister')
        self.type('#password1', <PASSWORD>')
        self.type('#password2', <PASSWORD>')
        self.click('input[type="submit"]')

        self.assert_element(".alert-success")

    def test_register_fail(self, *_):
        self.open(base_url + '/signup')
        self.type('#email', '<EMAIL>')
        self.type('#username', 'no')
        self.type('#password1', 'no')
        self.type('#password2', 'no')
        self.click('input[type="submit"]')

        self.assert_element(".alert-error")
