Beispiel #1
0
    def test_visit_GivenUrlIsPassed_ThenCurrentUrlShouldBeValuePassed(self):
        # arrange
        session = Session(':fake')
        session.driver = FakeDriver()

        # act
        session.visit(r'http://example.com')

        # assert
        assert_that(session.current_url, is_(r'http://example.com'))
Beispiel #2
0
    def test_fill_in_GivenAnElementWithIdOnPage_ThenFindsTheElement(self):
        # arrange
        session = Session(':fake')
        session.driver = FakeDriver()

        # act
        element = session.fill_in('q', 'any text')

        # assert
        assert_that(element.id, is_('q'))
Beispiel #3
0
    def test_fill_in_GivenAnElementWithIdOnPage_ThenFindsTheElement(self):
        # arrange
        session = Session(':fake')
        session.driver = FakeDriver()

        # act
        element = session.fill_in('q', 'any text')

        # assert
        assert_that(element.id, is_('q'))
Beispiel #4
0
    def test_visit_GivenUrlIsPassed_ThenCurrentUrlShouldBeValuePassed(self):
        # arrange
        session = Session(':fake')
        session.driver = FakeDriver()

        # act
        session.visit(r'http://example.com')

        # assert
        assert_that(session.current_url, is_(r'http://example.com'))
Beispiel #5
0
    def test_should_have_content_GivenNoTextOnPageOrInTitle_TheExpectFalse(self):
        # arrange
        stubDriver = FakeDriver()

        session = Session(':fake')
        session.driver = stubDriver

        # act
        actual = session.should_have_content('text in page title')

        # assert
        assert_that(actual, is_(False))
Beispiel #6
0
    def test_should_have_content_GivenTextInPageTitle_ThenHasContentTrue(self):
        # arrange
        stubDriver = FakeDriver()
        stubDriver.stub_has_title = True

        session = Session(':fake')
        session.driver = stubDriver

        # act
        actual = session.should_have_content('text in page title')

        # assert
        assert_that(actual, is_(True))
Beispiel #7
0
    def test_should_have_content_GivenNoTextOnPageOrInTitle_TheExpectFalse(
            self):
        # arrange
        stubDriver = FakeDriver()

        session = Session(':fake')
        session.driver = stubDriver

        # act
        actual = session.should_have_content('text in page title')

        # assert
        assert_that(actual, is_(False))
Beispiel #8
0
    def test_should_have_content_GivenTextInPageTitle_ThenHasContentTrue(self):
        # arrange
        stubDriver = FakeDriver()
        stubDriver.stub_has_title = True

        session = Session(':fake')
        session.driver = stubDriver

        # act
        actual = session.should_have_content('text in page title')

        # assert
        assert_that(actual, is_(True))
Beispiel #9
0
    def test_init_GivenModeIsFake_ThenExpectDriverIsNone(self):
        # arrange
        # act
        session = Session(':fake')

        # assert
        assert_that(session.driver, is_(None))
Beispiel #10
0
    def test_init_GivenModeIsSelenium_ThenExpectDriverIsSelenium(self):
        # arrange
        # act
        session = Session(':selenium')

        # assert

        assert_that(session.driver, instance_of(Selenium))
Beispiel #11
0
    def test_init_GivenModeIsNone_ThenExpectAssertionError(self):
        # arrange
        exception_thrown = False

        # act
        actual = ''
        try:
            Session(None)
        except AssertionError, actual:
            exception_thrown = True