From c151302b2ba6a526d0f54a2b06b47c8e90923b9d Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Mon, 10 May 2021 12:19:41 +0200 Subject: [PATCH] New selenium tests form edit --- tests/frontend_tests.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/frontend_tests.py b/tests/frontend_tests.py index f05e8b6..66cd337 100644 --- a/tests/frontend_tests.py +++ b/tests/frontend_tests.py @@ -1,4 +1,5 @@ import os +import unittest import urllib.request from flask import url_for @@ -122,8 +123,7 @@ class AccessTestCase(BaseFrontTestCase): class FormsTestCase(BaseFrontTestCase): - # Test agemt form - def test_agent_edit(self): + def test_agent_add(self): # load the form target_url = self.get_server_url() + url_for('main.agent_edit') self.driver.get(target_url) @@ -139,7 +139,24 @@ class FormsTestCase(BaseFrontTestCase): latest_agent = Agent.query.order_by(Agent.id.desc()).all()[0] self.assertEqual('Hitier', latest_agent.firstname) - # Test agemt form + # Test agent form + def test_agent_edit(self): + # load the form + target_url = self.get_server_url() + url_for('main.agent_edit', agent_id=1) + self.driver.get(target_url) + # fill it in + firstname_input = self.driver.find_elements_by_xpath("//input[@id='firstname']")[0] + self.assertEqual("Dubois", firstname_input.get_attribute('value')) + firstname_input.clear() + firstname_input.send_keys("Hitier") + # # submit + submit_button = self.driver.find_elements_by_xpath("//input[@type='submit']")[0] + submit_button.send_keys(Keys.ENTER) + # # check on database + latest_agent = Agent.query.filter(Agent.id == 1).one() + self.assertEqual('Hitier', latest_agent.firstname) + + # Test charge form add new def test_charge_add(self): # load the form target_url = self.get_server_url() + url_for('main.charge_add') @@ -171,3 +188,8 @@ class FormsTestCase(BaseFrontTestCase): latest_charge.period_id, latest_charge.charge_rate] ) + + # Test charge form edit existing + @unittest.skip("charge edit to be implemented") + def test_charge_edit(self): + pass -- libgit2 0.21.2