Exemplo n.º 1
0
    def test_login_throws_exception_for_invalid_password(self):
        fake_pw = "not a password"

        browser = HandshakeBrowser()
        login_page = LoginPage(homepage, browser)
        with self.assertRaises(InvalidPasswordError):
            login_page.login(email, fake_pw)
            browser.quit()
Exemplo n.º 2
0
    def test_throws_error_if_given_invalid_url(self):
        misspelled_school_url = "https://jhuu.joinhandshake.com/login"
        invalid_url = f"{homepage}/events"

        with self.assertRaises(InvalidURLError):
            login_page = LoginPage(misspelled_school_url, HandshakeBrowser())
        with self.assertRaises(InvalidURLError):
            login_page = LoginPage(invalid_url, HandshakeBrowser())
Exemplo n.º 3
0
    def test_login_throws_exception_for_invalid_email(self):
        fake_email = "f@[email protected]"
        fake_pw = ""

        browser = HandshakeBrowser()
        login_page = LoginPage(homepage, browser)
        with self.assertRaises(InvalidEmailError):
            login_page.login(fake_email, fake_pw)
            browser.quit()
Exemplo n.º 4
0
    def test_doesnt_throw_error_if_given_valid_url(self):
        valid_url = homepage
        valid_url_with_login = f"{homepage}/login"

        try:
            login_page = LoginPage(valid_url, HandshakeBrowser())
        except:
            self.fail()

        try:
            login_page = LoginPage(valid_url_with_login, HandshakeBrowser())
        except:
            self.fail()
    def test_element_exists_by_xpath(self):
        # tests valid as of 4/8/19
        browser = HandshakeBrowser()
        browser.get(BASE_URL)

        self.assertTrue(browser.element_exists_by_xpath('//div'))
        self.assertTrue(browser.element_exists_by_xpath("//a/span[@class='select2-chosen']"))

        self.assertFalse(browser.element_exists_by_xpath("//div[@class='this_isnt_a_real_class']"))

        browser.quit()
Exemplo n.º 6
0
    def test_throws_error_when_required_methods_not_implemented(self):
        with self.assertRaises(TypeError):

            class SomePage(Page):
                pass

            some_page = SomePage(BASE_URL, HandshakeBrowser())
Exemplo n.º 7
0
 def test_login_works_with_valid_credentials(self):
     browser = HandshakeBrowser()
     login_page = LoginPage(homepage, browser)
     login_page.login(email, password)
     browser.quit()
    def test_throws_error_if_given_invalid_url(self):
        completely_wrong_url = "https://www.google.com/"
        invalid_url = "https://jhu.joinhandhake.com/"
        not_a_url = "hello world"
        no_https = "jhu.joinhandshake.com"

        with self.assertRaises(InvalidURLError):
            browser = HandshakeBrowser()
            browser.get(completely_wrong_url)
            browser.quit()

        with self.assertRaises(InvalidURLError):
            browser = HandshakeBrowser()
            browser.get(invalid_url)
            browser.quit()

        with self.assertRaises(InvalidURLError):
            browser = HandshakeBrowser()
            browser.get(not_a_url)
            browser.quit()

        with self.assertRaises(InvalidURLError):
            browser = HandshakeBrowser()
            browser.get(no_https)
            browser.quit()