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
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)
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)