Esempio n. 1
0
    def test_monthly_transactions(self):

        start = datetime.date(2018, 4, 1)
        end = datetime.date(2018, 7, 1)

        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user('*****@*****.**', 'password')

        self.driver.get('{}/home?start=2018-04-01&end=2018-08-01'.format(
            self.live_server_url))

        homepage = HomePage(self.driver)
        transaction_form = homepage.transaction_form
        transaction_form.date = start
        transaction_form.transaction_size = -10
        transaction_form.description = 'phone contract'
        transaction_form.repeat_checkbox.click()

        repeat_options = transaction_form.repeat_options
        repeat_options.select('ends_on_date')
        repeat_options.set_frequency('monthly')
        import time
        time.sleep(10)
        repeat_options.set_end_date(end)
        time.sleep(10)
        repeat_options.submit()

        homepage = HomePage(self.driver)
        transactions = homepage.transaction_list.get_transactions()

        self.assertEqual(len(transactions), 4)

        t = transactions[0]
        self.assertEqual(t.date, start)
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-10.00')

        t = transactions[1]
        self.assertEqual(t.date, datetime.date(2018, 5, 1))
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-20.00')

        t = transactions[2]
        self.assertEqual(t.date, datetime.date(2018, 6, 1))
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-30.00')

        t = transactions[3]
        self.assertEqual(t.date, datetime.date(2018, 7, 1))
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-40.00')
Esempio n. 2
0
    def test_this_transaction_only_deletion(self):

        home_page = HomePage(self.driver)
        home_page.create_transaction(date=dt.date(2018, 1, 1),
                                     size=10,
                                     description='a',
                                     repeats='weekly',
                                     ends={'how': 'never_ends'})
        home_page.create_transaction(date=dt.date(2018, 1, 9),
                                     size=5,
                                     description='b')

        url = '{}/home?start={}&end={}'.format(self.live_server_url,
                                               '2018-01-01', '2018-01-15')
        self.driver.get(url)
        home_page = HomePage(self.driver)

        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        t = transactions[1]
        t.delete()

        ###
        WebDriverWait(self.driver, 5).until(
            EC.visibility_of_element_located(
                (By.ID, 'repeat-transaction-deletion-prompt')))

        prompt = RepeatTransactionDeletionPrompt(self.driver)
        prompt.select('delete_only_this_transaction')
        prompt.submit()

        ### put this in the transaction class

        self.driver.get(url)
        home_page = HomePage(self.driver)
        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        self.assertEqual(len(transactions), 3)

        t = transactions[0]
        self.assertEqual(t.date, dt.date(2018, 1, 1))

        t = transactions[1]
        self.assertEqual(t.date, dt.date(2018, 1, 9))
        self.assertEqual('£15.00', t.balance)

        t = transactions[2]
        self.assertEqual(t.date, dt.date(2018, 1, 15))
        self.assertEqual('£25.00', t.balance)
Esempio n. 3
0
    def test(self):

        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user('*****@*****.**', 'password')

        start=datetime.date(2018, 1, 1)
        end=datetime.date(2018, 1, 15)
        url = '{}/home?start={}&end={}'.format(self.live_server_url, start, end)
        self.driver.get(url)
        homepage = HomePage(self.driver)

        homepage.create_transaction(
            description='a',
            ends={'how': 'never_ends'},
            size=10,
            date=datetime.date(2018, 1, 1),
            steps=2,
            repeats='weekly',
        )
        
        homepage.reload()

        df_balances = homepage.get_balances()
        transactions = homepage.get_transactions()

        dates = pd.date_range(datetime.date(2018, 1, 1), datetime.date(2018, 1, 15))
        values = [10.0 for i in range(14)] + [20.0]
        df_expected = pd.DataFrame({'balance': values, 'date': dates})
        df_expected = df_expected.set_index('date')
        df_expected.index = pd.to_datetime(df_expected.index)

        self.assertTrue(df_balances.equals(df_expected), (df_balances, df_expected))
Esempio n. 4
0
    def test_updates_future_transactions(self):

        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user('*****@*****.**', 'password')

        start = datetime.date(2018, 1, 1)
        end = datetime.date(2018, 1, 15)
        homepage = HomePage(self.driver, self.live_server_url, start, end)

        homepage.create_transaction(date=datetime.date(2018, 1, 7),
                                    size=1,
                                    description='a')

        homepage = homepage.reload()
        homepage.create_transaction(date=datetime.date(2018, 1, 1),
                                    size=2,
                                    description='b',
                                    repeats='weekly',
                                    ends={'how': 'never_ends'})

        balances = homepage.get_balances()
        transactions = homepage.get_transactions()

        dates = pd.date_range(datetime.date(2018, 1, 1),
                              datetime.date(2018, 1, 15))
        values = [
            2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,
            5.0, 7.0
        ]
        balances_expected = pd.DataFrame({'date': dates, 'balance': values})
        balances_expected = balances_expected.set_index('date')

        self.assertTrue(balances.equals(balances_expected),
                        (balances, balances_expected))

        values = [(t.date, t.size, t.description, t.balance)
                  for t in transactions]
        transactions = pd.DataFrame(
            values, columns=['date', 'size', 'description', 'closing_balance'])

        transactions_expected = [
            (datetime.date(2018, 1, 1), 2.0, 'b', '£2.00'),
            (datetime.date(2018, 1, 7), 1.0, 'a', '£3.00'),
            (datetime.date(2018, 1, 8), 2.0, 'b', '£5.00'),
            (datetime.date(2018, 1, 15), 2.0, 'b', '£7.00')
        ]

        transactions_expected = pd.DataFrame(
            transactions_expected,
            columns=['date', 'size', 'description', 'closing_balance'])

        self.assertTrue(transactions.equals(transactions_expected),
                        (transactions, transactions_expected))
    def setUp(self):
        super().setUp()

        url = '{}/home?start=2018-01-01&end=2018-01-22'.format(self.live_server_url)
        self.driver.get(url)
        
        home_page = HomePage(self.driver)
        home_page.create_transaction(
            date=dt.date(2018, 1, 1),
            size=1,
            description='a',
            repeats='weekly',
            ends={'how': 'never_ends'})
                                     
        home_page.show_repeat_transactions_view()

        repeat_transactions = home_page.get_repeat_transactions()
        self.assertEqual(len(repeat_transactions), 1)

        rt = repeat_transactions[0]
        self.assertEqual(rt.start_date, dt.date(2018, 1, 1))
        self.assertEqual(rt.size, 1)
        self.assertEqual(rt.description, 'a')
        self.assertEqual(rt.frequency, 'weekly')
        self.assertEqual(rt.ends, 'never')

        self.repeat_transaction = rt
        self.home_page = home_page
Esempio n. 6
0
    def test(self):

        self.driver.get(self.live_server_url)
        homepage = HomePage(self.driver)

        menu = homepage.menu
        menu.sign_out_button.click()

        self.assertEqual(self.driver.title, 'Welcome')
Esempio n. 7
0
    def test_never_ends(self):

        today = datetime.date.today()

        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user('*****@*****.**', 'password')

        homepage = HomePage(self.driver)
        transaction_form = homepage.transaction_form
        transaction_form.date = today
        transaction_form.transaction_size = -10
        transaction_form.description = 'phone contract'
        transaction_form.repeat_checkbox.click()

        repeat_options = transaction_form.repeat_options
        repeat_options.submit()

        homepage = HomePage(self.driver)
        transactions = homepage.transaction_list.get_transactions()

        # self.assertEqual(len(transactions), 3)
        # TODO: more dynamic test, maybe get date range and calculate how many transactions
        # should be in there

        t = transactions[0]
        self.assertEqual(t.date, today)
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-10.00')

        t = transactions[1]
        self.assertEqual(t.date, today + datetime.timedelta(days=7))
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-20.00')

        t = transactions[2]
        self.assertEqual(t.date, today + datetime.timedelta(days=14))
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-30.00')
Esempio n. 8
0
    def test(self):

        today = datetime.date.today()

        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user('*****@*****.**', 'password')

        homepage = HomePage(self.driver)
        transaction_form = homepage.transaction_form
        transaction_form.date = today
        transaction_form.transaction_size = -10
        transaction_form.description = 'phone contract'
        transaction_form.repeat_checkbox.click()
        transaction_form.repeat_options.submit()

        homepage = HomePage(self.driver)
        transactions = homepage.transaction_list.get_transactions()

        # self.assertEqual(len(transactions), 3)
        # TODO: check number of transactions for date range

        t = transactions[0]
        self.assertEqual(t.date, today)
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-10.00')

        t = transactions[1]
        self.assertEqual(t.date, today + datetime.timedelta(days=7))
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-20.00')

        t = transactions[2]
        self.assertEqual(t.date, today + datetime.timedelta(days=14))
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-30.00')
Esempio n. 9
0
    def test_ends_after_2_occurrences(self):

        today = datetime.date.today()

        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user('*****@*****.**', 'password')

        homepage = HomePage(self.driver)
        transaction_form = homepage.transaction_form
        transaction_form.date = today
        transaction_form.transaction_size = -10
        transaction_form.description = 'phone contract'
        transaction_form.repeat_checkbox.click()

        repeat_options = transaction_form.repeat_options
        repeat_options.select('ends_after_#_transactions')
        repeat_options.set_n_transactions(2)
        repeat_options.submit()

        homepage = HomePage(self.driver)
        transactions = homepage.transaction_list.get_transactions()

        self.assertEqual(len(transactions), 2)

        t = transactions[0]
        self.assertEqual(t.date, today)
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-10.00')

        t = transactions[1]
        self.assertEqual(t.date, today + datetime.timedelta(days=7))
        self.assertEqual(t.size, -10)
        self.assertEqual(t.description, 'phone contract')
        self.assertEqual(t.balance, '£-20.00')
    def test(self):

        url = '{}/home?start=2018-01-01&end=2018-01-22'.format(self.live_server_url)
        self.driver.get(url)
        
        home_page = HomePage(self.driver)
        home_page.create_transaction(
            date=dt.date(2018, 1, 1),
            size=1000,
            description='a',
            repeats='weekly',
            ends={'how': 'ends_after_#_transactions', 'when': 2})
                                     
        home_page.show_repeat_transactions_view()

        repeat_transactions = home_page.get_repeat_transactions()
        self.assertEqual(len(repeat_transactions), 1)

        rt = repeat_transactions[0]
        self.assertEqual(rt.start_date, dt.date(2018, 1, 1))
        self.assertEqual(rt.size, 1000)
        self.assertEqual(rt.description, 'a')
        self.assertEqual(rt.frequency, 'weekly')
        self.assertEqual(rt.ends, dt.date(2018, 1, 8))

        # change date
        rt.ends = dt.date(2018, 1, 15)
        import time
        time.sleep(15)
        rt.save()

        home_page.reload()

        expected = [
            (dt.date(2018, 1, 1), 1000, 'a', '£1,000.00'),
            (dt.date(2018, 1, 8), 1000, 'a', '£2,000.00'),
            (dt.date(2018, 1, 15), 1000, 'a', '£3,000.00'),
        ]

        check_transactions(self, home_page, expected)
    def test(self):
        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user(email="*****@*****.**",
                                password="******")

        today = datetime.date.today()
        last_month = today - datetime.timedelta(days=41)

        homepage = HomePage(self.driver)
        homepage.create_transaction(date=last_month,
                                    size=100,
                                    description='a',
                                    update=True)

        homepage.create_transaction(date=today,
                                    size=-50,
                                    description='b',
                                    update=True)

        balance_chart = homepage.balance_chart

        self.assertEqual(balance_chart.bars[0].balance, 100)
        self.assertEqual(
            balance_chart.bars[len(balance_chart.bars) // 2].balance, 50)

        date_selector = homepage.date_selector
        self.assertEqual(date_selector.start,
                         today - datetime.timedelta(days=41))
        self.assertEqual(date_selector.end,
                         today + datetime.timedelta(days=42))

        date_selector.start = last_month
        date_selector.end = last_month + datetime.timedelta(days=7)
        date_selector.submit()

        homepage = HomePage(self.driver)
        balance_chart = homepage.balance_chart

        self.assertEqual(len(balance_chart.bars), 8)
        self.assertEqual(balance_chart.bars[0].balance, 100)
        self.assertEqual(balance_chart.bars[0].date, last_month)
        self.assertEqual(balance_chart.bars[7].balance, 100)
        self.assertEqual(balance_chart.bars[7].date,
                         last_month + datetime.timedelta(days=7))
Esempio n. 12
0
    def test(self):

        home_page = HomePage(self.driver)
        home_page.create_transaction(date=dt.date(2018, 1, 1),
                                     size=10,
                                     description='a',
                                     repeats='weekly',
                                     ends={'how': 'never_ends'})

        home_page.show_repeat_transactions_view()

        repeat_transaction = {
            'date': dt.date(2018, 1, 1),
            'size': 10,
            'description': 'a',
            'repeats': 'weekly',
            'ends': ''
        }
        
        self.assertIn(repeat_transaction, home_page.repeat_transactions_list.items)
Esempio n. 13
0
 def test(self):
     homepage = HomePage(self.driver)
Esempio n. 14
0
    def test(self):
        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user(email='*****@*****.**',
                                password='******')

        homepage = HomePage(self.driver)
        today = datetime.date.today()

        self.assertEqual(
            homepage.transaction_form.date_input.get_attribute('value'),
            today.isoformat())

        self.create_transaction(today, 1000, 'pay day')

        transactions = self.get_transactions()
        self.assertEqual(len(transactions), 1)

        t = transactions[0]
        self.assertEqual(t.date, today)
        self.assertEqual(t.size, 1000)
        self.assertEqual(t.description, 'pay day')
        self.assertEqual(t.balance, '£1,000.00')

        homepage = HomePage(self.driver)
        balance_chart = homepage.balance_chart
        bars = balance_chart.bars
        self.assertEqual(len(bars), 84)

        bar_today = bars[41]
        self.assertEqual(bar_today.date, today)
        self.assertEqual(bars[0].date, today - datetime.timedelta(days=41))
        self.assertEqual(bars[-1].date, today + datetime.timedelta(days=42))

        self.assertEqual(bar_today.balance, 1000)
        self.assertEqual(bars[0].balance, 0)
        self.assertEqual(bars[-1].balance, 1000)

        y_ticks = balance_chart.y_ticks
        for tick in y_ticks:
            number_int = int(
                tick.replace('£', '').replace(',', '').replace('.', ''))
            number_float = float(
                tick.replace('£', '').replace(',', '').replace('.', ''))
            self.assertTrue(tick.startswith('£'))
            self.assertEqual(number_int, number_float)  # int numbers only

        ## creates another transaction before the first
        ## transaction - check balances calculted properly

        yesterday = today - datetime.timedelta(days=1)
        self.create_transaction(yesterday, 500, 'dividends received')

        transactions = self.get_transactions()
        self.assertEqual(len(transactions), 2)

        t = transactions[0]
        self.assertEqual(t.date, yesterday)
        self.assertEqual(t.size, 500)
        self.assertEqual(t.description, 'dividends received')
        self.assertEqual(t.balance, '£500.00')

        t = transactions[1]
        self.assertEqual(t.date, today)
        self.assertEqual(t.size, 1000)
        self.assertEqual(t.description, 'pay day')
        self.assertEqual(t.balance, '£1,500.00')

        # test modifying existing transactions
        t = transactions[1]
        tomorrow = today + datetime.timedelta(days=1)
        t.date = tomorrow
        t.save()

        transactions = self.get_transactions()
        self.assertEqual(len(transactions), 2)

        t = transactions[1]
        self.assertEqual(t.date, tomorrow)
        self.assertEqual(t.size, 1000)
        self.assertEqual(t.description, 'pay day')
        self.assertEqual(t.balance, '£1,500.00')

        # add test for when transaction gets updated to before a previous transaction, will need to recalculate the closing balance
        # set the latter transaction to happening before the first
        t = transactions[1]
        day_before_yesterday = yesterday - datetime.timedelta(days=1)
        t.date = day_before_yesterday
        t.save()

        homepage = HomePage(self.driver)
        transaction_list = homepage.transaction_list
        transactions = transaction_list.get_transactions()
        self.assertEqual(len(transactions), 2)

        t = transactions[0]
        self.assertEqual(t.date, day_before_yesterday)
        self.assertEqual(t.size, 1000)
        self.assertEqual(t.description, 'pay day')
        self.assertEqual(t.balance, '£1,000.00')

        t = transactions[1]
        self.assertEqual(t.date, yesterday)
        self.assertEqual(t.size, 500)
        self.assertEqual(t.description, 'dividends received')
        self.assertEqual(t.balance, '£1,500.00')

        # change transaction size
        t = transactions[0]
        t.size = 2000
        t.save()

        transactions = self.get_transactions()
        self.assertEqual(len(transactions), 2)

        t = transactions[0]
        self.assertEqual(t.date, day_before_yesterday)
        self.assertEqual(t.size, 2000)
        self.assertEqual(t.description, 'pay day')
        self.assertEqual(t.balance, '£2,000.00')

        t = transactions[1]
        self.assertEqual(t.date, yesterday)
        self.assertEqual(t.size, 500)
        self.assertEqual(t.description, 'dividends received')
        self.assertEqual(t.balance, '£2,500.00')
Esempio n. 15
0
 def get_transactions(self):
     homepage = HomePage(self.driver)
     transaction_list = homepage.transaction_list
     transactions = transaction_list.get_transactions()
     return transactions
Esempio n. 16
0
 def create_transaction(self, date, size, description):
     homepage = HomePage(self.driver)
     f = homepage.transaction_form
     f.create_transaction(date, size, description)
Esempio n. 17
0
    def test_update_repeat_transaction_description_only_all_transactions(self):

        url = '{}/home?start={}&end={}'.format(self.live_server_url,
                                               '2018-01-01', '2018-01-15')
        self.driver.get(url)
        home_page = HomePage(self.driver)
        home_page.create_transaction(date=dt.date(2018, 1, 1),
                                     size=10,
                                     description='a',
                                     repeats='weekly',
                                     ends={'how': 'never_ends'})
        home_page.create_transaction(date=dt.date(2018, 1, 9),
                                     size=5,
                                     description='b')

        home_page = HomePage(self.driver)

        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        self.assertEqual(len(transactions), 4)

        t = transactions[0]
        self.assertEqual(t.date, dt.date(2018, 1, 1))
        self.assertEqual(t.description, 'a')

        t = transactions[1]
        self.assertEqual(t.date, dt.date(2018, 1, 8))
        self.assertEqual(t.description, 'a')

        t = transactions[1]
        t.description = 'c'
        t.save()

        WebDriverWait(self.driver, 5).until(
            EC.visibility_of_element_located(
                (By.ID, 'repeat-transaction-update-prompt')))

        prompt = RepeatTransactionUpdatePrompt(self.driver)
        prompt.select('update_all_transactions_of_this_kind')
        prompt.submit()

        home_page = HomePage(self.driver)
        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        self.assertEqual(len(transactions), 4)

        t = transactions[0]
        self.assertEqual(t.date, dt.date(2018, 1, 1))
        self.assertEqual('c', t.description)

        t = transactions[1]
        self.assertEqual(t.date, dt.date(2018, 1, 8))
        self.assertEqual('c', t.description)

        t = transactions[2]
        self.assertEqual(t.date, dt.date(2018, 1, 9))
        self.assertEqual('b', t.description)

        t = transactions[3]
        self.assertEqual(t.date, dt.date(2018, 1, 15))
        self.assertEqual('c', t.description)
        self.assertEqual('£35.00', t.balance)

        url = '{}/home?start={}&end={}'.format(self.live_server_url,
                                               '2018-01-01', '2018-01-22')
        self.driver.get(url)
        home_page = HomePage(self.driver)

        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        self.assertEqual(len(transactions), 5)

        t = transactions[4]
        self.assertEqual(t.date, dt.date(2018, 1, 22))
        self.assertEqual('c', t.description)
        self.assertEqual('£45.00', t.balance)
Esempio n. 18
0
    def test_date_and_description_changed(self):

        home_page = HomePage(self.driver)
        home_page.create_transaction(date=dt.date(2018, 1, 1),
                                     size=10,
                                     description='a',
                                     repeats='weekly',
                                     ends={'how': 'never_ends'})
        home_page.create_transaction(date=dt.date(2018, 1, 9),
                                     size=5,
                                     description='b')

        url = '{}/home?start={}&end={}'.format(self.live_server_url,
                                               '2018-01-01', '2018-01-15')
        self.driver.get(url)
        home_page = HomePage(self.driver)

        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        self.assertEqual(len(transactions), 4)

        t = transactions[0]
        self.assertEqual(t.date, dt.date(2018, 1, 1))
        self.assertEqual(t.description, 'a')

        t = transactions[1]
        self.assertEqual(t.date, dt.date(2018, 1, 8))
        self.assertEqual(t.description, 'a')

        t = transactions[1]
        t.date = dt.date(2018, 1, 7)
        t.description = 'c'
        t.save()

        self.driver.get(url)
        home_page = HomePage(self.driver)
        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        self.assertEqual(len(transactions), 4)

        t = transactions[0]
        self.assertEqual(t.date, dt.date(2018, 1, 1))
        self.assertEqual(t.description, 'a')
        self.assertEqual('£10.00', t.balance)

        t = transactions[1]
        self.assertEqual(t.date, dt.date(2018, 1, 7))
        self.assertEqual(t.description, 'c')
        self.assertEqual('£20.00', t.balance)

        t = transactions[2]
        self.assertEqual(t.date, dt.date(2018, 1, 9))
        self.assertEqual('£25.00', t.balance)
        self.assertEqual(t.description, 'b')

        t = transactions[3]
        self.assertEqual(t.date, dt.date(2018, 1, 15))
        self.assertEqual('£35.00', t.balance)
        self.assertEqual(t.description, 'a')
Esempio n. 19
0
    def test_deletion_of_all_transactions_of_this_type(self):

        url = '{}/home?start={}&end={}'.format(self.live_server_url,
                                               '2018-01-01', '2018-01-15')
        self.driver.get(url)
        home_page = HomePage(self.driver)
        home_page.create_transaction(date=dt.date(2018, 1, 1),
                                     size=10,
                                     description='a',
                                     repeats='weekly',
                                     ends={'how': 'never_ends'})
        home_page.create_transaction(date=dt.date(2018, 1, 9),
                                     size=5,
                                     description='b')

        url = '{}/home?start={}&end={}'.format(self.live_server_url,
                                               '2018-01-01', '2018-01-15')
        self.driver.get(url)
        home_page = HomePage(self.driver)

        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        t = transactions[1]
        t.delete()

        WebDriverWait(self.driver, 20).until(
            EC.visibility_of_element_located(
                (By.ID, 'repeat-transaction-deletion-prompt')))

        prompt = RepeatTransactionDeletionPrompt(self.driver)
        prompt.select('all_transactions_of_this_type')
        prompt.submit()

        self.driver.get(url)
        home_page = HomePage(self.driver)
        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        self.assertEqual(len(transactions), 1)

        t = transactions[0]
        self.assertEqual(t.date, dt.date(2018, 1, 9))
        self.assertEqual(t.description, 'b')
        self.assertEqual('£5.00', t.balance)

        url = '{}/home?start={}&end={}'.format(self.live_server_url,
                                               '2018-01-01', '2018-01-22')
        self.driver.get(url)
        home_page = HomePage(self.driver)

        t_list = home_page.transaction_list
        transactions = t_list.get_transactions()

        self.assertEqual(len(transactions), 1)

        t = transactions[0]
        self.assertEqual(t.date, dt.date(2018, 1, 9))
        self.assertEqual('£5.00', t.balance)

        rts = home_page.get_repeat_transactions()
        self.assertEqual(len(rts), 0)
    def test(self):
        self.driver.get(self.live_server_url)
        welcome_page = WelcomePage(self.driver)
        welcome_page.login_user(email="*****@*****.**",
                                password="******")

        today = datetime.date.today()
        homepage = HomePage(self.driver)
        homepage.create_transaction(date=today,
                                    size=10,
                                    description='a',
                                    update=True)

        week_forward_button = self.driver.find_element_by_id(
            'week-forward-button')
        week_backward_button = self.driver.find_element_by_id(
            'week-backward-button')

        date_range = homepage.get_date_range()
        homepage.move_date_range_forward(days=7)
        WebDriverWait(self.driver,
                      timeout=2).until(lambda b: homepage.get_date_range() == [
                          today - datetime.timedelta(days=34), today + datetime
                          .timedelta(days=49)
                      ])

        date_range = homepage.get_date_range()
        homepage.move_date_range_backward(days=7)
        WebDriverWait(self.driver,
                      timeout=2).until(lambda b: homepage.get_date_range() == [
                          date_range[0] - datetime.timedelta(days=7),
                          date_range[1] - datetime.timedelta(days=7)
                      ])

        date_range = homepage.get_date_range()
        homepage.move_date_range_backward(days=7)
        WebDriverWait(self.driver,
                      timeout=2).until(lambda b: homepage.get_date_range() == [
                          date_range[0] - datetime.timedelta(days=7),
                          date_range[1] - datetime.timedelta(days=7)
                      ])