def test_send_token_for_selected_users(self):
        """
        Setup test cases and login as admin.

        :return:
        """
        login_admin(self.driver)  # at first login as admin
        send_login_token_tests = [
            {
                "manipulate_dom": False,
                "user_ids": [1, ],
                "successful": bool(True)
            },
            {
                "manipulate_dom": False,
                "user_ids": [1, 2],
                "successful": bool(True)
            },
            {
                "manipulate_dom": True,
                "user_ids": [99999, ],
                "successful": bool(False)
            },
            {
                "manipulate_dom": False,
                "user_ids": [],
                "successful": str("warning")
            }
        ]

        self.handle_send_token_for_selected_users(send_login_token_tests)
    def test_error_page(self):
        """
        Test 404 error page.

        :return:
        """
        driver = self.driver
        driver.get(base_url)
        time.sleep(1)
        driver.get(base_url + "123")
        time.sleep(1)
        driver.find_element_by_id("error_actions").click()
        time.sleep(1)
        driver.get(admin_url)
        login_admin(self.driver)
        driver.get(admin_url + "measurement/import/3421+#")
        time.sleep(1)
        driver.find_element_by_id("error_actions").click()
        time.sleep(1)
        driver.get(users_url)
        time.sleep(1)
        driver.get(users_url + "@123")
        time.sleep(1)
        driver.find_element_by_id("error_actions").click()
        time.sleep(1)
        driver.get(login_url)
        time.sleep(1)
        driver.get(login_url + "@1213")
        time.sleep(1)
        driver.find_element_by_id("error_actions").click()
        time.sleep(1)
예제 #3
0
    def test_change_measurement(self):
        """
        Define the tests.

        :return:
        """
        change_measurement_tests = [
            {
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "49",
                self.hardness: "2,0",
                "successful": True
            },
            {
                self.potassium: "11,8",
                self.sodium: "2,9",
                self.calcium: "49,9",
                self.magnesium: "14,3",
                self.chloride: "12",
                self.nitrate: "13",
                self.sulfate: "",
                self.hardness: "2,0",
                "successful": False
            },
        ]

        login_admin(self.driver)

        for test in change_measurement_tests:
            self.handle_test(test)
    def test_import_measurement(self):
        """
        Define the tests.

        :return:
        """
        import_contacts_tests = [
            {
                self.contacts: test_dir + "contacts.csv",
                "successful": True
            },
            {
                self.contacts: test_dir + "contacts_force_rollback.csv",
                "successful": False
            },
            {
                self.contacts: test_dir + "contacts_wrong_structure.csv",
                "successful": False
            },
        ]

        login_admin(self.driver)

        for test in import_contacts_tests:
            self.handle_test(test)
    def test_go_back(self):
        """
        Execute go back Test.

        :return:
        """
        login_admin(self.driver)
        driver = self.driver
        driver.get(admin_url + "mineral_waters/edit/2/")
        driver.find_element_by_id("btnBack").click()
    def test_add_administrator(self):
        """
        Define the tests.

        :return:
        """
        login_admin(self.driver)
        add_admin_tests = [
            {
                self.username: self.user_to_delete,
                self.first_name: "user",
                self.last_name: "one",
                self.email: "*****@*****.**",
                "successful": True
            },
            {
                self.username: "",
                self.first_name: "user",
                self.last_name: "one",
                self.email: "*****@*****.**",
                "successful": False
            },
            {
                self.username: self.user_to_delete,
                self.first_name: "",
                self.last_name: "one",
                self.email: "*****@*****.**",
                "successful": False
            },
            {
                self.username: self.user_to_delete,
                self.first_name: "user",
                self.last_name: "",
                self.email: "*****@*****.**",
                "successful": False
            },
            {
                self.username: self.user_to_delete,
                self.first_name: "user",
                self.last_name: "one",
                self.email: "user.eins",
                "successful": False
            },
            {
                self.username: "",
                self.first_name: "",
                self.last_name: "",
                self.email: "",
                "successful": False
            }
        ]

        for test in add_admin_tests:
            self.handle_add_test(test)
예제 #7
0
    def test_delete_administrator(self):
        """
        Test to delete a created administrator.

        :return:
        """
        login_admin(self.driver)
        driver = self.driver
        driver.get(admin_url + "administrators")
        driver.find_element_by_id("delete" + self.user_to_delete).click()
        time.sleep(1)
        driver.find_element_by_id("delete-successful")
    def test_delete_administrator(self):
        """
        Test to delete a created administrator.

        :return:
        """
        login_admin(self.driver)
        driver = self.driver
        driver.get(admin_url + "administrators")
        driver.find_element_by_id("delete" + self.user_to_delete).click()
        time.sleep(1)
        driver.find_element_by_id("delete-successful")
예제 #9
0
    def test_import_measurement(self):
        """
        Define the tests.

        :return:
        """
        import_measurement_tests = [
            {
                self.region: "Heilbronn",
                self.locations: test_dir + "locations_hn.json",
                self.zones: test_dir + "zones_hn.json",
                "successful": True
            },
            {
                self.region: "Heilbronn",
                self.locations: test_dir + "wrong_type.html",
                self.zones: test_dir + "zones_hn.json",
                "successful": False
            },
            {
                self.region: "Heilbronn",
                self.locations: test_dir + "locations_hn.json",
                self.zones: test_dir + "wrong_type.html",
                "successful": False
            },
            {
                self.region: "Heilbronn",
                self.locations: test_dir + "wrong_structure.json",
                self.zones: test_dir + "zones_hn.json",
                "successful": False
            },
            {
                self.region: "Heilbronn",
                self.locations: test_dir + "locations_hn_force_rollback.json",
                self.zones: test_dir + "zones_hn_force_rollback.json",
                "successful": False
            },
            {
                self.region: "H",
                self.locations: test_dir + "locations_hn.json",
                self.zones: test_dir + "zones_hn.json",
                "successful": False
            },
        ]

        login_admin(self.driver)

        for test in import_measurement_tests:
            self.handle_test(test)
    def test_delete_water(self):
        """
        Test to delete a created water.

        :return:
        """
        login_admin(self.driver)  # login

        driver = self.driver
        driver.get(admin_url + "mineral_waters/show")
        driver.find_element_by_id("delete-mineral-water-" +
                                  self.key_to_delete).click()
        driver.implicitly_wait(2)
        driver.find_element_by_id(self.yes_id + self.key_to_delete).click()
        driver.implicitly_wait(2)
        driver.find_element_by_id("deleteMessage")  # check successful
    def test_delete_water(self):
        """
        Test to delete a created water.

        :return:
        """
        login_admin(self.driver)  # login

        driver = self.driver
        driver.get(admin_url + "mineral_waters/show")
        driver.find_element_by_id("delete-mineral-water-" +
                                  self.key_to_delete).click()
        driver.implicitly_wait(2)
        driver.find_element_by_id(self.yes_id + self.key_to_delete).click()
        driver.implicitly_wait(2)
        driver.find_element_by_id("deleteMessage")  # check successful
    def test_cancel_delete_water(self):
        """
        Test to delete a created water.

        :return:
        """
        login_admin(self.driver)
        self.handle_add_test()  # add sample water

        driver = self.driver
        driver.get(admin_url + "mineral_waters/show")
        driver.implicitly_wait(2)
        driver.find_element_by_id("delete-mineral-water-" +
                                  self.key_to_delete).click()
        driver.implicitly_wait(2)
        driver.find_element_by_id(self.cancel_id + self.key_to_delete).click()
    def test_cancel_delete_water(self):
        """
        Test to delete a created water.

        :return:
        """
        login_admin(self.driver)
        self.handle_add_test()  # add sample water

        driver = self.driver
        driver.get(admin_url + "mineral_waters/show")
        driver.implicitly_wait(2)
        driver.find_element_by_id("delete-mineral-water-" +
                                  self.key_to_delete).click()
        driver.implicitly_wait(2)
        driver.find_element_by_id(self.cancel_id + self.key_to_delete).click()
예제 #14
0
    def test_add_administrator(self):
        """
        Define the tests.

        :return:
        """
        login_admin(self.driver)
        add_admin_tests = [{
            self.username: self.user_to_delete,
            self.first_name: "user",
            self.last_name: "one",
            self.email: "*****@*****.**",
            "successful": True
        }, {
            self.username: "",
            self.first_name: "user",
            self.last_name: "one",
            self.email: "*****@*****.**",
            "successful": False
        }, {
            self.username: self.user_to_delete,
            self.first_name: "",
            self.last_name: "one",
            self.email: "*****@*****.**",
            "successful": False
        }, {
            self.username: self.user_to_delete,
            self.first_name: "user",
            self.last_name: "",
            self.email: "*****@*****.**",
            "successful": False
        }, {
            self.username: self.user_to_delete,
            self.first_name: "user",
            self.last_name: "one",
            self.email: "user.eins",
            "successful": False
        }, {
            self.username: "",
            self.first_name: "",
            self.last_name: "",
            self.email: "",
            "successful": False
        }]

        for test in add_admin_tests:
            self.handle_add_test(test)
    def test_change_password(self):
        """
        Define the tests.

        :return:
        """
        login_admin(self.driver)
        change_password_test = [
            {
                self.new_password: "******",
                self.new_password_repeat: "newPassword",
                "successful": True
            },
            {
                self.new_password: "",
                self.new_password_repeat: "newPassword",
                "successful": False
            },
            {
                self.new_password: "******",
                self.new_password_repeat: "",
                "successful": False
            },
            {
                self.new_password: "",
                self.new_password_repeat: "",
                "successful": False
            },
            {
                self.new_password: "******",
                self.new_password_repeat: "newPasswordX",
                "successful": False
            },
            {
                self.new_password: "******",  # set default password
                self.new_password_repeat: "AdminWasser",
                "successful": True
            }
        ]

        for test in change_password_test:
            self.handle_change_password_test(test)
예제 #16
0
    def test_change_password(self):
        """
        Define the tests.

        :return:
        """
        login_admin(self.driver)
        change_password_test = [
            {
                self.new_password: "******",
                self.new_password_repeat: "newPassword",
                "successful": True
            },
            {
                self.new_password: "",
                self.new_password_repeat: "newPassword",
                "successful": False
            },
            {
                self.new_password: "******",
                self.new_password_repeat: "",
                "successful": False
            },
            {
                self.new_password: "",
                self.new_password_repeat: "",
                "successful": False
            },
            {
                self.new_password: "******",
                self.new_password_repeat: "newPasswordX",
                "successful": False
            },
            {
                self.new_password: "******",  # set default password
                self.new_password_repeat: "AdminWasser",
                "successful": True
            }
        ]

        for test in change_password_test:
            self.handle_change_password_test(test)
    def test_edit_mineral_water(self):
        """
        Define the tests.

        :return:
        """
        change_measurement_tests = [
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "49",
                "successful": True
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "13.6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "11,8",
                self.sodium: "2,9",
                self.calcium: "49,9",
                self.magnesium: "14,3",
                self.chloride: "12",
                self.nitrate: "13",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "",
                self.sources: "www.google.de",
                self.potassium: "11,8",
                self.sodium: "2,9",
                self.calcium: "49,9",
                self.magnesium: "14,3",
                self.chloride: "12",
                self.nitrate: "13",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "",
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "13,6",
                self.sodium: "",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "",
                self.nitrate: "13,6",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "",
                self.sulfate: "49",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "teusser",
                self.sources: "www.google.de",
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "",
                "successful": False
            },
            {
                self.name: "Teusser",
                self.key: "volvic",
                self.sources: "www.google.de",
                self.potassium: "13,6",
                self.sodium: "1,9",
                self.calcium: "75,0",
                self.magnesium: "16,1",
                self.chloride: "19",
                self.nitrate: "13,6",
                self.sulfate: "",
                "successful": False
            }
        ]

        login_admin(self.driver)

        for test in change_measurement_tests:
            self.handle_edit_test(test)