Ejemplo n.º 1
0
 def test_delete_expense(self):
     exp_month = login_pages.ExpensesMonthPage(browser=self.browser,
                                               expenses=3)
     exp_details = login_pages.ExpenseDetailsPage(
         browser=exp_month.expenses[2].details())
     exp_delete = login_pages.ExpenseDeletePage(
         browser=exp_details.delete())
     with self.assertRaises(NoSuchElementException):
         exp_month = login_pages.ExpensesMonthPage(
             browser=exp_delete.delete(), expenses=3)
Ejemplo n.º 2
0
 def test_approve_expense(self):
     action = actions.SignInHomePageAction(self.browser)
     exp_month = login_pages.ExpensesMonthPage(browser=action.run(
         username='******', password='******'),
                                               expenses=2)
     exp_details = login_pages.ExpenseDetailsPage(
         browser=exp_month.expenses[0].details())
     self.assertFalse(exp_details.approved)
     self.assertTrue(exp_details.can_approve)
     self.assertFalse(exp_details.can_edit)
     self.assertFalse(exp_details.can_delete)
     exp_approve = login_pages.ExpenseApprovePage(
         browser=exp_details.approve())
     exp_approve.approve_yes()
     exp_details = login_pages.ExpenseDetailsPage(
         browser=exp_approve.save())
     self.assertTrue(exp_details.approved)
     exp_month = login_pages.ExpensesMonthPage(
         browser=exp_details.side_bar_expenses(), expenses=2)
     self.assertTrue(exp_month.expenses[0].approved)
     exp_month.logout()
Ejemplo n.º 3
0
    def test_edit_expense(self):

        action = actions.EditFirstExpenseAction(browser=self.browser)
        exp_edit = login_pages.ExpenseEditPage(browser=action.run(expenses=2))
        exp_edit.form.set_input_text({'desc': 'School Books'},
                                     clear_form=False)
        exp_details = login_pages.ExpenseDetailsPage(browser=exp_edit.save())
        Lmodel_html = [
            'Description School Books', 'Place of purchase Book Store',
            'Purchased by john',
            helpers.format_today('Date of Purchase {today}'), u'Cost 130.0',
            u'Divorcee participate % 50', u'Notes'
        ]
        self.assertEqual(exp_details.model_html, Lmodel_html)
Ejemplo n.º 4
0
 def test_expense_details(self):
     exp_month = login_pages.ExpensesMonthPage(browser=self.browser,
                                               expenses=2)
     self.browser = exp_month.expenses[0].details()
     exp_details = login_pages.ExpenseDetailsPage(browser=self.browser)
     Lmodel_html = [
         'Description School', 'Place of purchase Book Store',
         'Purchased by john',
         helpers.format_today('Date of Purchase {today}'), u'Cost 130.0',
         u'Divorcee participate % 50', u'Notes'
     ]
     self.assertEqual(exp_details.model_html, Lmodel_html)
     self.assertFalse(exp_details.approved)
     self.assertTrue(exp_details.can_edit)
     self.assertTrue(exp_details.can_delete)
Ejemplo n.º 5
0
 def test_add_expense(self):
     exp_month = login_pages.ExpensesMonthPage(browser=self.browser,
                                               expenses=2)
     exp_add = login_pages.ExpenseAddPage(browser=exp_month.add_expense())
     Dinput = {
         'desc': 'Books1',
         'expense_sum': '100',
         'place_of_purchase': 'amazon.com',
         'notes': 'spare book'
     }
     exp_add.form.set_input_text(Dinput, clear_form=False)
     exp_details = login_pages.ExpenseDetailsPage(browser=exp_add.save())
     Lmodel_html = [
         'Description Books1', 'Place of purchase amazon.com',
         'Purchased by john',
         helpers.format_today('Date of Purchase {today}'), u'Cost 100.0',
         u'Divorcee participate % 50', u'Notes spare book'
     ]
     self.assertEqual(exp_details.model_html, Lmodel_html)
     exp_month = login_pages.ExpensesMonthPage(
         browser=exp_details.side_bar_expenses(), expenses=3)
     self.assertEqual(
         exp_month.expenses[2].text,
         helpers.format_today_full('Books1 john 100 50% {today} -'))