Ejemplo n.º 1
0
class LoginFeatureTests(BaseTest):
    def __init__(self, *args, **kwargs):
        super(LoginFeatureTests, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__login = LoginPage()
        self.__create_bot = CreateBotPage()
        self.__register = RegisterPage()
        self.__data_set = DataUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()

    def test_login_unsuccessfully_due_to_blank_fields(self):
        accounts = self.__data_set.get_data(INVALID_LOGIN_DATA)
        expected_errors = [account[2] for account in accounts[1:]]
        actual_errors = []
        for account in accounts[1:]:
            email = account[0]
            password = account[1]
            self.__login.open_login_page()
            self.__login.login_with_account(email,
                                            password)
            actual_errors.append(self.__login.lbl_error_message.get_element_text())
        self.assertEqual(expected_errors, actual_errors,
                         "Assert Error : {0} != {1}".format(expected_errors, actual_errors))
        self.assertTrue(self.__login.txt_header_text.lower() in self.__login.driver.page_source.lower(),
                        "'{0}' text does not present in DOM".format(self.__login.txt_header_text))
        self.assertTrue(self.__login.path_page in self.__login.driver.current_url,
                        "{0} is not included in url".format(self.__login.path_page))
 def __init__(self, *args, **kwargs):
     unittest.TestCase.__init__(self, *args, **kwargs)
     self.__api_test = os.environ.get('api', False)
     self.TEST_CLASS = self
     self.__login = LoginPage()
     self.__register = RegisterPage()
     self.__dashboard = DashboardPage()
     self.__create_bot = CreateBotPage()
     self.__data = DataGenerateUtils()
Ejemplo n.º 3
0
 def __init__(self, *args, **kwargs):
     super(RegisterFeatureTests, self).__init__(*args, **kwargs)
     self.__data = DataGenerateUtils()
     self.__register = RegisterPage()
     self.__create_bot = CreateBotPage()
     self.__data_set = DataUtils()
     self.valid_name = self.__data.create_name()
     self.valid_email = self.__data.create_email()
     self.valid_password = self.__data.create_password()
class KnowledgeFeatureTests(BaseTest):
    def __init__(self, *args, **kwargs):
        super(KnowledgeFeatureTests, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__login = LoginPage()
        self.__create_bot = CreateBotPage()
        self.__register = RegisterPage()
        self.__appearance = AppearancePage()
        self.__knowledge_validation = KnowledgeValidation()
        self.__dashboard = DashboardPage()
        self.__knowledge = KnowledgePage()
        self.__data_set = DataUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()
        self.faq_url = YAML_CONFIG.get("stub_manual_faq_url")
        self.invalid_faq = YAML_CONFIG.get("stub_invalid_faq_url")

    def setUp(self):
        super().setUp()
        self.bot_name = self.__data.create_uuid_number()
        self.setUpMethod()

    def setUpMethod(self):
        try:
            self.sign_in_for_ui_test(self.valid_username, self.valid_email, self.valid_password,
                                     self.bot_name, self.invalid_faq, False)
            self.__knowledge.open_page(self.__knowledge.path_page)
        except Exception as e:
            raise TestContextException(e)

    def test_add_manual_faq_successfully(self):
        self.__knowledge.wait_for_create_page(30)
        self.__knowledge.add_manual_faq_url(self.faq_url)

        self.__knowledge.wait_for_knowledge_section_visible(self.faq_url)
        self.__knowledge_validation.should_added_correctly_url_data(self.bot_name,
                                                                    self.__knowledge.get_faq_url_data_in_gui(
                                                                        self.faq_url))

    def test_add_manual_question_pair_successfully(self):
        question = "Test with question sample"
        answer = "Test with answer sample"
        self.__knowledge.wait_for_create_page(30)
        self.__knowledge.init_manual_question_pair_table()
        self.__knowledge_validation.should_create_question_pair_table_with_empty_data()

        self.__knowledge.add_question_answer_data(question, answer)

        knowledge = self.__knowledge.get_question_pair_data_in_gui()
        assert len(knowledge) == 1, \
            f"Expect 1 pair is added but {len(knowledge)} is displayed"
        assert knowledge[0]["answer"] == answer, \
            f"{answer} is added but {knowledge[0]['answer']} is displayed"
        assert len(knowledge[0]["questions"]) == 1, \
            f"Expect that there is 1 question but {len(knowledge[0]['question'])}"
        assert knowledge[0]["questions"][0] == question, f"Added question is different with input"
 def __init__(self, *args, **kwargs):
     super(CreateBotFeatureTests, self).__init__(*args, **kwargs)
     self.__data = DataGenerateUtils()
     self.__login = LoginPage()
     self.__create_bot = CreateBotPage()
     self.__register = RegisterPage()
     self.__appearance = AppearancePage()
     self.__create_bot_validation = CreateBotValidation()
     self.__drop_down_list = DropDownList()
     self.__data_set = DataUtils()
     self.valid_email = self.__data.create_email()
     self.valid_username = self.__data.create_name()
     self.valid_password = self.__data.create_password()
     self.faq_url = YAML_CONFIG.get("stub_faq_url")
Ejemplo n.º 6
0
class RegisterFeatureTests(BaseTest):
    def __init__(self, *args, **kwargs):
        super(RegisterFeatureTests, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__register = RegisterPage()
        self.__create_bot = CreateBotPage()
        self.__data_set = DataUtils()
        self.valid_name = self.__data.create_name()
        self.valid_email = self.__data.create_email()
        self.valid_password = self.__data.create_password()

    def test_register_new_account_successful(self):
        self.__register.open_register_page()
        self.__register.login_with_new_account(self.valid_name,
                                               self.valid_email,
                                               self.valid_password)
        self.__create_bot.wait_for_create_page()
        self.assertTrue(
            self.__create_bot.txt_header_text.lower()
            in self.__create_bot.get_header_text().lower(),
            "Expect header '{0}' but '{1}' found".format(
                self.__create_bot.txt_header_text,
                self.__create_bot.get_header_text()))
        self.assertTrue(
            self.__create_bot.path_page in self.__register.driver.current_url,
            "Current page url {0}".format(self.__register.driver.current_url))

    def test_register_new_account_unsuccessful_with_invalid_inputs(self):
        accounts = self.__data_set.get_data(INVALID_REGISTER_DATA)
        expected_errors = [account[3] for account in accounts[1:]]
        errors = []
        for account in accounts[1:]:
            fullname = account[0]
            email = account[1]
            password = account[2]
            self.__register.open_register_page()
            self.__register.login_with_new_account(fullname, email, password)
            errors.append(self.__register.lbl_error_message.get_element_text())
        self.assertEqual(
            expected_errors, errors,
            "Assert Error : {0} != {1}".format(expected_errors, errors))
        self.assertTrue(
            self.__register.txt_header_text.lower()
            in self.__register.driver.page_source.lower(),
            "'{0}' does not present in DOM".format(
                self.__register.txt_header_text))
        self.assertTrue(
            self.__register.path_page in self.__register.driver.current_url,
            "{0} is not included in url".format(self.__register.path_page))
Ejemplo n.º 7
0
    def __init__(self, *args, **kwargs):
        super(TestAuthenticationPages, self).__init__(*args, **kwargs)
        self.__login = LoginPage()
        self.__register = RegisterPage()
        self.__forgot_password = ForgotPasswordPage()

        self.__data = DataGenerateUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()

        self.bot_name = "Test"
        self.invalid_faq = "google.com"
        self.eyes = Eyes()
        self.eyes.api_key = YAML_CONFIG.get("eyes_api_key")
Ejemplo n.º 8
0
 def __init__(self):
     super().__init__("/auth/sign_up")
     self.__data = DataGenerate()
     self.__email = self.__data.create_email()
     self.__user_name = self.__data.create_name()
     self.__default_pass = "******"
     self.__jwt_token = None
Ejemplo n.º 9
0
class PredictServiceTest(BaseTest):

    def __init__(self, *args, **kwargs):
        super(BaseTest, self).__init__(*args, **kwargs)
        self.is_api_test = True
        self.__data = DataGenerateUtils()
        self.__predict = PredictService()

    def setUp(self):
        super().setUp()

    def tearDown(self):
        super().tearDown()

    @RepeatedTest(2, parallel=False, thread_count=2)
    def test_init_data_service_return_enough_data(self):
        data_path = path.join(FAQ_DATA_PATH, KATALON_DATA_FILE_NAME)
        company_id = self.__data.create_name()
        with open(data_path, "r", encoding='utf-8') as f:
            data = f.read()
            code, body = self.__predict.init_predict_data(company_id, data)

        _, initialized_faq = self.__predict.get_all_faq_data(company_id)
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, code, 200),
        )
    '''
 def __init__(self, *args, **kwargs):
     super(KnowledgeFeatureTests, self).__init__(*args, **kwargs)
     self.__data = DataGenerateUtils()
     self.__login = LoginPage()
     self.__create_bot = CreateBotPage()
     self.__register = RegisterPage()
     self.__appearance = AppearancePage()
     self.__knowledge_validation = KnowledgeValidation()
     self.__dashboard = DashboardPage()
     self.__knowledge = KnowledgePage()
     self.__data_set = DataUtils()
     self.valid_email = self.__data.create_email()
     self.valid_username = self.__data.create_name()
     self.valid_password = self.__data.create_password()
     self.faq_url = YAML_CONFIG.get("stub_manual_faq_url")
     self.invalid_faq = YAML_CONFIG.get("stub_invalid_faq_url")
Ejemplo n.º 11
0
 def __init__(self, *args, **kwargs):
     super(AppearanceTests, self).__init__(*args, **kwargs)
     self.__data = DataGenerateUtils()
     self.__login = LoginPage()
     self.__create_bot = CreateBotPage()
     self.__register = RegisterPage()
     self.__appearance = AppearancePage()
     self.__create_bot_validation = CreateBotValidation()
     self.__drop_down_list = DropDownList()
     self.__chat_box_simulator = ClientSimulator()
     self.__loader = LoaderComponent()
     self.__data_set = DataUtils()
     self.valid_email = self.__data.create_email()
     self.valid_username = self.__data.create_name()
     self.valid_password = self.__data.create_password()
     self.bot_name = self.__data.create_uuid_number()
     self.faq_url = YAML_CONFIG.get("stub_faq_url")
Ejemplo n.º 12
0
 def __init__(self, *args, **kwargs):
     super(ChangePasswordTests, self).__init__(*args, **kwargs)
     self.__data = DataGenerateUtils()
     self.__login = LoginPage()
     self.__create_bot = CreateBotPage()
     self.__register = RegisterPage()
     self.__dashboard = DashboardPage()
     self.__appearance = AppearancePage()
     self.__create_bot_validation = CreateBotValidation()
     self.__drop_down_list = DropDownList()
     self.__change_password = ChangePasswordPage()
     self.__data_set = DataUtils()
     self.valid_email = self.__data.create_email()
     self.valid_username = self.__data.create_name()
     self.valid_password = self.__data.create_password()
     self.bot_name = "Test"
     self.invalid_faq = "google.com"
 def __init__(self, *args, **kwargs):
     super(TestConversationDuration, self).__init__(*args, **kwargs)
     self.__data = DataGenerateUtils()
     self.__create_bot = CreateBotPage()
     self.__register = RegisterPage()
     self.__appearance = AppearancePage()
     self.__integration = IntegrationPage()
     self.__create_bot_validation = CreateBotValidation()
     self.__html_file = HTMLFileUtils()
     self.__client_simulator = ClientSimulator()
     self.__conversation = ConversationPage()
     self.valid_email = self.__data.create_email()
     self.valid_username = self.__data.create_name()
     self.valid_password = self.__data.create_password()
     self.bot_name = self.__data.create_uuid_number()
     self.invalid_faq = YAML_CONFIG.get("stub_invalid_faq_url")
     self.integrated_page_path = ""
     self.root_path = os.path.dirname(
         os.path.dirname(os.path.abspath(__file__)))
     self.file_path = os.path.normpath(
         os.path.join(self.root_path, 'TestGUI', 'index.html'))
Ejemplo n.º 14
0
class SignUp(BaseApi):
    def __init__(self):
        super().__init__("/auth/sign_up")
        self.__data = DataGenerate()
        self.__email = self.__data.create_email()
        self.__user_name = self.__data.create_name()
        self.__default_pass = "******"
        self.__jwt_token = None

    @property
    def jwt_token(self):
        return self.__jwt_token

    @property
    def default_user_email(self):
        return self.__email

    def create_new_user_account(self,
                                username=None,
                                email=None,
                                password: str = None,
                                zone_name="Asia/Saigon"):
        password = hashlib.pbkdf2_hmac('sha256', password.encode('utf-8'), b'',
                                       100, 256).hex() if password else None
        self.post_data = {
            "username": username,
            "email": email,
            "password": password,
            "zoneName": zone_name
        }
        self.post(data=self.post_data)
        return self.response_code, self.response_body

    def create_default_user_account(self):
        self.create_new_user_account(self.__user_name, self.__email,
                                     self.__default_pass)
        self.__jwt_token = "JWT " + self.get_value_in_json_response_body(
            "jwtToken")
Ejemplo n.º 15
0
 def __init__(self, *args, **kwargs):
     super(TestAdminPages, self).__init__(*args, **kwargs)
     self.__data = DataGenerateUtils()
     self.__login = LoginPage()
     self.__create_bot = CreateBotPage()
     self.__register = RegisterPage()
     self.__dashboard = DashboardPage()
     self.__appearance = AppearancePage()
     self.__create_bot_validation = CreateBotValidation()
     self.__drop_down_list = DropDownList()
     self.__change_password = ChangePasswordPage()
     self.__knowledge = KnowledgePage()
     self.__data_set = DataUtils()
     self.__faq_knowledge_data_table_component = FaqKnowledgeDataTableComponent(
     )
     self.valid_email = self.__data.create_email()
     self.valid_username = self.__data.create_name()
     self.valid_password = self.__data.create_password()
     self.bot_name = "Test"
     self.invalid_faq = "google.com"
     self.eyes = Eyes()
     self.eyes.api_key = YAML_CONFIG.get("eyes_api_key")
     self.eyes.force_full_page_screenshot = True
     self.eyes.stitch_mode = StitchMode.CSS
class CreateBotFeatureTests(BaseTest):
    def __init__(self, *args, **kwargs):
        super(CreateBotFeatureTests, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__login = LoginPage()
        self.__create_bot = CreateBotPage()
        self.__register = RegisterPage()
        self.__appearance = AppearancePage()
        self.__create_bot_validation = CreateBotValidation()
        self.__drop_down_list = DropDownList()
        self.__data_set = DataUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()
        self.faq_url = YAML_CONFIG.get("stub_faq_url")

    def setUp(self):
        super().setUp()
        self.__register.open_register_page()
        self.__register.login_with_new_account(self.valid_username,
                                               self.valid_email,
                                               self.valid_password)
        self.__create_bot.wait_for_create_page()

    def test_create_bot_unsuccessfully_with_invalid_inputs(self):
        bot_infos = self.__data_set.get_data(INVALID_BOT_INFO_DATA)
        expected_errors = [bot_info[2] for bot_info in bot_infos[1:]]
        actual_errors = []
        for bot_info in bot_infos[1:]:
            bot_name = bot_info[0]
            bot_url = bot_info[1]
            self.__create_bot.open_create_page()
            self.__create_bot.create_bot_with_data(bot_name, bot_url)
            actual_errors.append(
                self.__create_bot.lbl_error_message.get_element_text())
        self.assertEqual(expected_errors, actual_errors)

    @unittest.skip("Update logic with ignore for offline network")
    def test_create_bot_unsuccessfully_with_offline_connection(self):
        DriverFactory.get_driver().core_driver.set_network_conditions(
            offline=True, latency=5, throughput=500 * 1024)
        self.__create_bot.open_create_page()
        self.__create_bot.create_bot_with_data('Random Name',
                                               'www.katalon.com')
        self.assertEqual(
            self.__create_bot.lbl_error_message.get_element_text(),
            'Failed to fetch')

    def test_create_bot_successfully(self):
        bot_name = "Bot_name"
        website = self.faq_url
        self.__create_bot.open_create_page()
        self.__create_bot.create_bot_with_data(bot_name, website)
        print(self.__appearance.get_header_title_text())
        print(self.__appearance.get_expected_title(bot_name=bot_name))
        assert self.__appearance.get_header_title_text(
        ) == self.__appearance.get_expected_title(bot_name=bot_name)
        self.__create_bot_validation.wait_and_verify_notification_message()
        self.__create_bot_validation.should_init_correct_total_faq_questions(
            self.valid_email, bot_name)
        self.__create_bot_validation.should_init_correct_question_data()

    def test_create_bot_with_existed_bot_name_successfully(self):
        new_bot_name = "Bot_name"
        new_bot_website = "www.google.com"
        # Create a bot
        self.test_create_bot_successfully()
        # Open create bot page again
        self.__create_bot.open_create_page()
        self.__create_bot.create_bot_with_data(new_bot_name, new_bot_website)
        # Verify that new bot name is displayed
        self.__create_bot_validation.new_bot_should_be_current_selected_bot(
            new_bot_name, new_bot_website)
        self.__create_bot_validation.wait_and_verify_notification_message()
        self.__create_bot_validation.should_init_correct_total_faq_questions(
            self.valid_email, new_bot_name)
        self.__create_bot_validation.should_init_correct_question_data()

    def test_create_bot_with_existed_website_successfully(self):
        new_bot_name = "Another name"
        new_bot_website = self.faq_url
        # Create a bot
        self.test_create_bot_successfully()
        # Open create bot page again
        self.__create_bot.open_create_page()
        self.__create_bot.create_bot_with_data(new_bot_name, new_bot_website)
        # Verify that new bot name is displayed
        self.__create_bot_validation.new_bot_should_be_current_selected_bot(
            new_bot_name, new_bot_website)
        self.__create_bot_validation.wait_and_verify_notification_message()
        self.__create_bot_validation.should_init_correct_total_faq_questions(
            self.valid_email, new_bot_name)
        self.__create_bot_validation.should_init_correct_question_data()
Ejemplo n.º 17
0
class ChangePasswordTests(BaseTest):
    def __init__(self, *args, **kwargs):
        super(ChangePasswordTests, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__login = LoginPage()
        self.__create_bot = CreateBotPage()
        self.__register = RegisterPage()
        self.__dashboard = DashboardPage()
        self.__appearance = AppearancePage()
        self.__create_bot_validation = CreateBotValidation()
        self.__drop_down_list = DropDownList()
        self.__change_password = ChangePasswordPage()
        self.__data_set = DataUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()
        self.bot_name = "Test"
        self.invalid_faq = "google.com"

    def setUp(self):
        super().setUp()
        try:
            self.sign_in_for_ui_test(self.valid_username, self.valid_email,
                                     self.valid_password, self.bot_name,
                                     self.invalid_faq, False)
        finally:
            self.__change_password.open_change_password_page()

    def test_change_password_unsuccessfully_with_invalid_data(self):
        invalid_data = self.__data_set.get_data(
            INVALID_DATA_FOR_CHANGE_PASSWORD)
        for data in invalid_data:
            old_password = data[0]
            new_password = data[1]
            confirm_password = data[2]
            error_message = data[3]
            self.__change_password.change_password(old_password, new_password,
                                                   confirm_password)
            print(data)
            assert self.__change_password.get_error_message() == error_message, \
                f"Expect error message '{error_message}' but '{self.__change_password.get_error_message()}' is returned"
            assert self.__change_password.btn_submit.get_element_text() == "RETRY", \
                f"Expect button submit change to 'RETRY' but '{self.__change_password.btn_submit.get_element_text()}'"
        # Incorrect current password
        self.__change_password.change_password(self.valid_password + "123",
                                               "password", "password")
        assert self.__change_password.get_error_message() == "Your current password is not correct.", \
            f"Expect error message 'Your current password is not correct.' " \
            f"but '{self.__change_password.get_error_message()}' is returned"
        assert self.__change_password.btn_submit.get_element_text() == "RETRY", \
            f"Expect button submit change to 'RETRY' but '{self.__change_password.btn_submit.get_element_text()}'"

    def test_change_password_unsuccessfully_with_wrong_current_password(self):
        # Make old password become incorrect
        old_password = self.valid_password + "123"
        new_password = "******"
        expected_error_message = "Your current password is not correct."
        self.__change_password.change_password(old_password, new_password,
                                               new_password)
        actual_error_message = self.__change_password.get_error_message()
        assert actual_error_message == expected_error_message, \
            f"Expect '{expected_error_message}' but '{actual_error_message}' is displayed"
        assert self.__change_password.btn_submit.get_element_text() == "RETRY", \
            f"Expect button submit change to 'RETRY' but '{self.__change_password.btn_submit.get_element_text()}'"

    def test_change_password_successfully(self):
        new_password = "******"
        success_message = "Your password has been updated successfully."
        # Change Password
        self.__change_password.change_password(self.valid_password,
                                               new_password, new_password)
        # Verify
        actual_message = self.__change_password.get_success_message()
        assert actual_message == success_message, \
            f"Expect '{success_message}' but '{actual_message}' is displayed"
        self.__change_password.wait_for_button_back_to_dashboard_display()
        # Sign out
        self.__change_password.log_out()
        self.__login.wait_for_log_in_page()
        # Verify login successfully with new password
        self.__login.login_with_account(self.valid_email, new_password)
        self.__dashboard.wait_for_dashboard_page()
Ejemplo n.º 18
0
class SignUpTest(BaseTest):
    INVALID_PARAM = 13
    EXISTING_EMAIL = 12

    def __init__(self, *args, **kwargs):
        super(BaseTest, self).__init__(*args, **kwargs)
        self.is_api_test = True
        self.__sign_up = SignUp()
        self.__data = DataGenerate()

    def tearDown(self):
        super().tearDown()
        self.API_PAY_LOAD.append(self.__sign_up.post_data)

    def test_sign_up_successfully_with_valid_data(self):
        self.__sign_up.create_new_user_account(username=self.__data.create_name(),
                                               email=self.__data.create_email(),
                                               password=self.__data.create_password())
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 200),
            self.assert_container(self.assertIn, self.__sign_up.post_data['username'], self.__sign_up.response_body),
            self.assert_container(self.assertIn, self.__sign_up.post_data['email'], self.__sign_up.response_body),
            self.assert_container(self.assertGreater,
                                  len(JSONUtils.get_value_json_string(self.__sign_up.response_body, "jwtToken")), 20)
        )

    def test_sign_up_unsuccessfully_with_existing_email(self):
        username = self.__data.create_name()
        email = self.__data.create_email()
        password = self.__data.create_password()
        self.__sign_up.create_new_user_account(username=username,
                                               email=email,
                                               password=password)
        self.API_PAY_LOAD.append(self.__sign_up.post_data)
        self.__sign_up.create_new_user_account(username=username,
                                               email=email,
                                               password=password)
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 400),
            self.assert_container(self.assertEqual, self.EXISTING_EMAIL,
                                  JSONUtils.get_value_json_string(self.__sign_up.response_body, "error")['code'])
        )

    def test_sign_up_unsuccessfully_with_blank_username(self):
        self.__sign_up.create_new_user_account(email=self.__data.create_email(),
                                               password=self.__data.create_number())
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 400),
            self.assert_container(self.assertEqual, self.INVALID_PARAM,
                                  JSONUtils.get_value_json_string(self.__sign_up.response_body, "error")['code'])
        )

    def test_sign_up_unsuccessfully_with_blank_email(self):
        self.__sign_up.create_new_user_account(username=self.__data.create_name(),
                                               password=self.__data.create_number())
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 400),
            self.assert_container(self.assertEqual, self.INVALID_PARAM,
                                  JSONUtils.get_value_json_string(self.__sign_up.response_body, "error")['code'])
        )

    def test_sign_up_unsuccessfully_with_blank_password(self):
        self.__sign_up.create_new_user_account(username=self.__data.create_name(),
                                               email=self.__data.create_email())
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 400),
            self.assert_container(self.assertEqual, self.INVALID_PARAM,
                                  JSONUtils.get_value_json_string(self.__sign_up.response_body, "error")['code'])
        )

    def test_sign_up_unsuccessfully_with_blank_username_email(self):
        self.__sign_up.create_new_user_account(password=self.__data.create_number())
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 400),
            self.assert_container(self.assertEqual, self.INVALID_PARAM,
                                  JSONUtils.get_value_json_string(self.__sign_up.response_body, "error")['code'])
        )

    def test_sign_up_unsuccessfully_with_blank_username_password(self):
        self.__sign_up.create_new_user_account(email=self.__data.create_email())
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 400),
            self.assert_container(self.assertEqual, self.INVALID_PARAM,
                                  JSONUtils.get_value_json_string(self.__sign_up.response_body, "error")['code'])
        )

    def test_sign_up_unsuccessfully_with_blank_email_password(self):
        self.__sign_up.create_new_user_account(username=self.__data.create_name())
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 400),
            self.assert_container(self.assertEqual, self.INVALID_PARAM,
                                  JSONUtils.get_value_json_string(self.__sign_up.response_body, "error")['code'])
        )

    def test_sign_up_unsuccessfully_with_blank_all(self):
        self.__sign_up.create_new_user_account()
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual, self.__sign_up.response_code, 400),
            self.assert_container(self.assertEqual, self.INVALID_PARAM,
                                  JSONUtils.get_value_json_string(self.__sign_up.response_body, "error")['code'])
        )
Ejemplo n.º 19
0
 def __init__(self, *args, **kwargs):
     super(BaseTest, self).__init__(*args, **kwargs)
     self.is_api_test = True
     self.__data = DataGenerateUtils()
     self.__predict = PredictService()
Ejemplo n.º 20
0
class AppearanceTests(BaseTest):
    def __init__(self, *args, **kwargs):
        super(AppearanceTests, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__login = LoginPage()
        self.__create_bot = CreateBotPage()
        self.__register = RegisterPage()
        self.__appearance = AppearancePage()
        self.__create_bot_validation = CreateBotValidation()
        self.__drop_down_list = DropDownList()
        self.__chat_box_simulator = ClientSimulator()
        self.__loader = LoaderComponent()
        self.__data_set = DataUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()
        self.bot_name = self.__data.create_uuid_number()
        self.faq_url = YAML_CONFIG.get("stub_faq_url")

    def setUp(self):
        super().setUp()
        try:
            self.sign_in_for_ui_test(self.valid_username, self.valid_email,
                                     self.valid_password, self.bot_name,
                                     self.faq_url, False)
            self.__appearance.open_appearance_page()
            self.__appearance.wait_for_appearance_page()
        except Exception as e:
            raise TestContextException(e)

    def test_change_chat_bot_title_successfully(self):
        new_title = "test_debug"
        print(self.__appearance.txb_title.get_element_text())
        self.__appearance.change_bot_title(new_title)
        self.__appearance.driver.core_driver.refresh()
        self.__appearance.wait_for_appearance_page()
        assert self.__appearance.txb_title.get_element_text_value() == new_title, \
            f"Title is '{self.__appearance.txb_title.get_element_text_value()}' instead of '{new_title}'"

    def test_change_bot_name_successfully(self):
        new_name = "test_debug"
        self.__appearance.change_bot_name(new_name)
        self.__appearance.driver.core_driver.refresh()
        self.__appearance.wait_for_appearance_page()
        assert self.__appearance.txb_bot_name.get_element_text_value() == new_name, \
            f"Bot name is '{self.__appearance.txb_bot_name.get_element_text_value()}' instead of '{new_name}'"

    def test_update_avatar_successfully(self):
        valid_avatar = get_valid_avatar()
        last_avatar_src = self.__appearance.img_avatar.get_element_attribute(
            "src")
        self.__appearance.update_avatar(valid_avatar)
        self.__loader.wait_for_component_invisible()
        current_avatar_src = self.__appearance.img_avatar.get_element_attribute(
            "src")
        assert current_avatar_src != last_avatar_src, "Avatar has not been changed"
        assert self.__chat_box_simulator.get_bot_avatar_source() != last_avatar_src, \
            "Avatar in simulation has not been changed"

    def test_update_avatar_with_invalid_size_unsuccessfully(self):
        error_message = "File size must be less than 1MB."
        list_invalid_file = get_list_invalid_size_avatar()
        last_avatar_src = self.__appearance.img_avatar.get_element_attribute(
            "src")
        for value in list_invalid_file:
            self.upload_avatar_and_verify_error_message(value, error_message)
            self.verify_avatar_source_does_not_change(last_avatar_src)

    def test_update_avatar_with_invalid_file_type_unsuccessfully(self):
        error_message = "This file type is not supported."
        list_invalid_file = get_list_invalid_type_avatar()
        last_avatar_src = self.__appearance.img_avatar.get_element_attribute(
            "src")
        for value in list_invalid_file:
            self.upload_avatar_and_verify_error_message(value, error_message)
            self.verify_avatar_source_does_not_change(last_avatar_src)

    def test_update_avatar_with_invalid_format_unsuccessfully(self):
        error_message = "Uploaded file is not a valid image."
        list_invalid_file = get_list_invalid_format_avatar()
        last_avatar_src = self.__appearance.img_avatar.get_element_attribute(
            "src")
        for value in list_invalid_file:
            self.upload_avatar_and_verify_error_message(value, error_message)
            self.verify_avatar_source_does_not_change(last_avatar_src)

    def upload_avatar_and_verify_error_message(self, file_path, error_message):
        self.__appearance.driver.core_driver.refresh()
        self.__appearance.wait_for_appearance_page()
        self.__appearance.img_avatar.click()
        self.__appearance.input_ava.send_keys(file_path)
        actual_error_message = self.__appearance.lbl_error_message_of_upload_avatar.get_element_text(
        )
        assert actual_error_message == error_message, \
            f"'{actual_error_message}' is displayed when upload invalid format avatar {file_path}"

    def verify_avatar_source_does_not_change(self, current_avatar_src):
        self.__appearance.btn_cancel_upload_avatar.click()
        self.__appearance.driver.core_driver.refresh()
        self.__appearance.wait_for_appearance_page()
        actual_avatar_src = self.__appearance.img_avatar.get_element_attribute(
            "src")
        assert actual_avatar_src == current_avatar_src, "Avatar has been changed"

    @unittest.skip("TODO TEST")
    def test_integration_website_reflect_change_on_appearance(self):
        pass
class BaseTest(unittest.TestCase):
    API_PAY_LOAD = []
    GUI_SCREEN_SHOT = []

    def __init__(self, *args, **kwargs):
        unittest.TestCase.__init__(self, *args, **kwargs)
        self.__api_test = os.environ.get('api', False)
        self.TEST_CLASS = self
        self.__login = LoginPage()
        self.__register = RegisterPage()
        self.__dashboard = DashboardPage()
        self.__create_bot = CreateBotPage()
        self.__data = DataGenerateUtils()

    def setUp(self):
        self.API_PAY_LOAD = []
        if not self.is_api_test:
            DriverFactory.create_driver()

    def repeated_setup(self):
        pass

    def repeated_teardown(self):
        pass

    def tearDown(self):
        if not self.is_api_test:
            DriverFactory.dispose_driver()

    @property
    def is_api_test(self):
        return self.__api_test

    @is_api_test.setter
    def is_api_test(self, is_api_test):
        self.__api_test = is_api_test

    def sign_in_for_ui_test(self,
                            username=None,
                            email=None,
                            password=None,
                            bot_name=None,
                            faq_url=None,
                            is_debugging=False):
        try:
            if not is_debugging:
                # Generate data
                email = email or self.__data.create_email()
                username = username or self.__data.create_name()
                password = password or self.__data.create_password()
                bot_name = bot_name or self.__data.create_uuid_number()
                invalid_faq = faq_url or YAML_CONFIG.get(
                    "stub_invalid_faq_url")

                self.__register.open_register_page()
                self.__register.login_with_new_account(username, email,
                                                       password)
                self.__create_bot.wait_for_create_page()
                self.__create_bot.create_bot_with_data(bot_name, invalid_faq)
            else:
                email = email or YAML_CONFIG.get("email_for_debugging")
                password = password or YAML_CONFIG.get("pass_for_debugging")
                self.__login.login_with_account(email, password)
                self.__dashboard.wait_for_dashboard_page()

        except Exception as e:
            raise TestContextException(e)

    @staticmethod
    def assert_container(func, expected, actual):
        return lambda: func(expected, actual)
class TestConversationDuration(BaseTest):
    def __init__(self, *args, **kwargs):
        super(TestConversationDuration, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__create_bot = CreateBotPage()
        self.__register = RegisterPage()
        self.__appearance = AppearancePage()
        self.__integration = IntegrationPage()
        self.__create_bot_validation = CreateBotValidation()
        self.__html_file = HTMLFileUtils()
        self.__client_simulator = ClientSimulator()
        self.__conversation = ConversationPage()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()
        self.bot_name = self.__data.create_uuid_number()
        self.invalid_faq = YAML_CONFIG.get("stub_invalid_faq_url")
        self.integrated_page_path = ""
        self.root_path = os.path.dirname(
            os.path.dirname(os.path.abspath(__file__)))
        self.file_path = os.path.normpath(
            os.path.join(self.root_path, 'TestGUI', 'index.html'))

    def setUp(self):
        # TODO(namndoan): Register a new account and create integrated html file
        # Currently, I used exist account for manual check
        pass

    def test_duration(self):
        # TODO(namndoan): Random a list of duration time then create conversation
        self.create_conversation_chatting_in__minutes(150)
        time.sleep(10)
        self.__client_simulator.send_message("Thanks")
        time.sleep(10)
        self.__client_simulator.send_message("It's great")
        time.sleep(60)
        self.chat_continuously_in(60)
        # self.__client_simulator.send_message("Last message after 230 secs")
        # self.clear_storage()
        # self.create_conversation_chatting_in__minutes(150)
        # self.clear_storage()
        # self.create_conversation_chatting_in__minutes(200)
        # self.clear_storage()
        # TODO(namndoan): Get duration info from admin page and assert
        # Currently, I checked duration manually

    def create_conversation_chatting_in__minutes(self, duration: int):
        # Open integrated web
        self.__integration.driver.core_driver.get(self.file_path)

        print("Duration: {}".format(duration))
        timestamp = 0
        # Chat
        self.__client_simulator.send_message("First message")
        print("Timestamp: {}".format(timestamp))
        while timestamp < duration:
            wait_time = 30
            if duration - timestamp < 30:
                wait_time = duration - timestamp
            print("Wait time: {}".format(wait_time))
            time.sleep(wait_time)
            timestamp += wait_time
            print("Timestamp: {}".format(timestamp))
            self.__client_simulator.send_message(
                "Message after {} secs".format(timestamp))

    def chat_continuously_in(self, duration):
        print("Duration: {}".format(duration))
        timestamp = 0
        # Chat
        self.__client_simulator.send_message("First message")
        print("Timestamp: {}".format(timestamp))
        while timestamp < duration:
            wait_time = 30
            if duration - timestamp < 30:
                wait_time = duration - timestamp
            print("Wait time: {}".format(wait_time))
            time.sleep(wait_time)
            timestamp += wait_time
            print("Timestamp: {}".format(timestamp))
            self.__client_simulator.send_message(
                "Message after {} secs".format(timestamp))

    def clear_storage(self):
        self.__client_simulator.driver.core_driver.delete_all_cookies()
        self.__client_simulator.driver.core_driver.execute_script(
            "localStorage.clear()")
        self.__client_simulator.driver.core_driver.execute_script(
            "sessionStorage.clear()")
Ejemplo n.º 23
0
class TestAdminPages(BaseTest):
    def __init__(self, *args, **kwargs):
        super(TestAdminPages, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__login = LoginPage()
        self.__create_bot = CreateBotPage()
        self.__register = RegisterPage()
        self.__dashboard = DashboardPage()
        self.__appearance = AppearancePage()
        self.__create_bot_validation = CreateBotValidation()
        self.__drop_down_list = DropDownList()
        self.__change_password = ChangePasswordPage()
        self.__knowledge = KnowledgePage()
        self.__data_set = DataUtils()
        self.__faq_knowledge_data_table_component = FaqKnowledgeDataTableComponent(
        )
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()
        self.bot_name = "Test"
        self.invalid_faq = "google.com"
        self.eyes = Eyes()
        self.eyes.api_key = YAML_CONFIG.get("eyes_api_key")
        self.eyes.force_full_page_screenshot = True
        self.eyes.stitch_mode = StitchMode.CSS

    def setUp(self):
        super().setUp()
        self.sign_in_for_ui_test(
            email=YAML_CONFIG.get("visual_test_user"),
            password=YAML_CONFIG.get("visual_test_password"),
            # Use is_debugging flag to login instead of register new account
            is_debugging=True)

    def test_for_bot_knowledge_appearance(self):
        try:
            self.eyes.open(driver=self.__login.driver.core_driver,
                           app_name='sample_app',
                           test_name='Bot Knowledge Page',
                           viewport_size={
                               'width': 1440,
                               'height': 887
                           })
            self.__knowledge.open_knowledge_page()
            self.__knowledge.wait_for_create_page()
            # self.eyes.check_window("Default state of Knowledge Page")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div", "Default state")

            self.__knowledge.btn_add_knowledge.click()
            self.eyes.check_region_by_selector(
                by=By.CSS_SELECTOR,
                value="#add-knowledge-dropdown > div",
                tag="Add knowledge dropdown")

            self.__knowledge.btn_from_faq_url.click()
            # self.eyes.check_window("Knowledge page when adding faq url")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div", "Adding FAQ URL")

            self.__knowledge.init_manual_question_pair_table()
            # self.eyes.check_window("Knowledge page when init manual faq table")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div",
                "Initiated manual FAQ")

            manual_section = FaqKnowledgeDataTableComponent.get_table_component_with_group_faqs(
                "Manual Q&A")
            manual_section.collapse_section()
            self.eyes.check_region_by_element(
                manual_section.base_component_element(
                    SeleniumElement).get_wrapper_element,
                "Manual section after collapsing")

            web_content_section = FaqKnowledgeDataTableComponent.get_table_component_with_group_faqs(
                "Web Content")
            web_content_section.open_section()
            # TODO(namndoan): capture full element
            self.eyes.check_region_by_element(
                web_content_section.base_component_element(
                    SeleniumElement).get_wrapper_element,
                "Web content section after open")

            web_content_section.collapse_section()
            # self.eyes.check_window("Knowledge page after closing Web Content section")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div",
                "Closed Web Content section")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div[2]",
                "Chat box in knowledge")
        finally:
            res = self.eyes.close(raise_ex=True)
            print(res)
            self.eyes.abort_if_not_closed()

    def tearDown(self):
        super().tearDown()
Ejemplo n.º 24
0
class TestAuthenticationPages(BaseTest):
    def __init__(self, *args, **kwargs):
        super(TestAuthenticationPages, self).__init__(*args, **kwargs)
        self.__login = LoginPage()
        self.__register = RegisterPage()
        self.__forgot_password = ForgotPasswordPage()

        self.__data = DataGenerateUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()

        self.bot_name = "Test"
        self.invalid_faq = "google.com"
        self.eyes = Eyes()
        self.eyes.api_key = YAML_CONFIG.get("eyes_api_key")

    def setUp(self):
        super().setUp()

    def test_login_page_appearance(self):
        try:
            self.eyes.open(driver=self.__login.driver.core_driver,
                           app_name='sample_app',
                           test_name='Login Page',
                           viewport_size={'width': 1440, 'height': 887})
            self.__login.open_login_page()
            self.__login.wait_for_log_in_page()
            self.eyes.check_window("Default Login Page")
            self.__login.check_remember_me(False)
            self.eyes.check_window("Login Page without remember me")
            self.__login.login_with_account("", "")
            self.eyes.check_window("Login Page with error message")
        finally:
            res = self.eyes.close(raise_ex=True)
            print(res)
            self.eyes.abort_if_not_closed()

    def test_register_page_appearance(self):
        try:
            self.eyes.open(driver=self.__login.driver.core_driver,
                           app_name='sample_app',
                           test_name='Register Page',
                           viewport_size={'width': 1440, 'height': 887})
            self.__register.open_register_page()
            self.__register.wait_for_register_page()
            self.eyes.check_window("Default Register Page")
            self.__register.txt_email.click()
            self.eyes.check_window("Register with tips for email")
            self.__register.txt_password.click()
            self.eyes.check_window("Register with tips for password")
            self.__register.login_with_new_account("", "", "")
            self.eyes.check_window("Register with error message")
        finally:
            res = self.eyes.close(raise_ex=True)
            print(res)
            self.eyes.abort_if_not_closed()

    def test_forgot_password_page_appearance(self):
        try:
            self.eyes.open(driver=self.__login.driver.core_driver,
                           app_name='sample_app',
                           test_name='Forgot Password Page',
                           viewport_size={'width': 1440, 'height': 887})
            self.__forgot_password.open_forgot_password_page()
            self.__forgot_password.wait_for_forgot_password_page()
            self.eyes.check_window("Default Forgot password page")
            self.__forgot_password.submit_email("")
            self.eyes.check_window("Submit empty email")
            self.__forgot_password.submit_email("*****@*****.**")
            self.eyes.check_window("Submit with wrong email format")
            self.__forgot_password.submit_email(YAML_CONFIG.get("sample_app_user"))
            self.eyes.check_window("Submit successfully")
        finally:
            res = self.eyes.close(raise_ex=True)
            print(res)
            self.eyes.abort_if_not_closed()

    def tearDown(self):
        super().tearDown()
 def __init__(self, *args, **kwargs):
     super(BaseTest, self).__init__(*args, **kwargs)
     self.is_api_test = True
     self.__data = DataGenerateUtils()
     self.__sign_in = SignIn()
class SignInTest(BaseTest):
    # Currently these are the prepared data
    # We want to quick start the API Test so we set it here
    DEFAULT_PASSWORD = "******"
    INVALID_EMAIL = "*****@*****.**"
    INVALID_PASSWORD = "******"
    INVALID_INPUT = 14
    INVALID_PARAM = 13
    BLANK_FIELD_CODE = 14
    NO_EMAIL_CODE = 14

    def __init__(self, *args, **kwargs):
        super(BaseTest, self).__init__(*args, **kwargs)
        self.is_api_test = True
        self.__data = DataGenerateUtils()
        self.__sign_in = SignIn()

    def setUp(self):
        super().setUp()
        self.__email = self.__data.create_email()
        self.__sign_up = SignUp()
        self.__sign_up.create_new_user_account(self.__email, self.__email,
                                               self.DEFAULT_PASSWORD)

    def tearDown(self):
        super().tearDown()
        self.API_PAY_LOAD.append(self.__sign_up.post_data)
        self.API_PAY_LOAD.append(self.__sign_in.post_data)

    def test_sign_in_successfully_with_valid_data(self):
        self.__sign_in.sign_in(email=self.__email,
                               password=self.DEFAULT_PASSWORD)
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 200),
            self.assert_container(
                self.assertGreater,
                len(
                    JSONUtils.get_value_json_string(
                        self.__sign_in.response_body, "jwtToken")), 20))

    def test_sign_in_unsuccessfully_with_invalid_email(self):
        self.__sign_in.sign_in(email=self.INVALID_EMAIL,
                               password=self.DEFAULT_PASSWORD)
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 400),
            self.assert_container(
                self.assertEqual, self.BLANK_FIELD_CODE,
                JSONUtils.get_value_json_string(self.__sign_in.response_body,
                                                "error")['code']))

    def test_sign_in_unsuccessfully_with_invalid_password(self):
        self.__sign_in.sign_in(email=self.__email,
                               password=self.INVALID_PASSWORD)
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 400),
            self.assert_container(
                self.assertEqual, self.INVALID_PARAM,
                JSONUtils.get_value_json_string(self.__sign_in.response_body,
                                                "error")['code']))

    def test_sign_in_unsuccessfully_with_invalid_email_password(self):
        self.__sign_in.sign_in(email=self.INVALID_EMAIL,
                               password=self.INVALID_PASSWORD)
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 400),
            self.assert_container(
                self.assertEqual, self.BLANK_FIELD_CODE,
                JSONUtils.get_value_json_string(self.__sign_in.response_body,
                                                "error")['code']))

    def test_sign_in_unsuccessfully_with_invalid_param_invalid_email(self):
        self.__sign_in.sign_in(email="invalid_email",
                               password=self.DEFAULT_PASSWORD)
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 400),
            self.assert_container(
                self.assertEqual, self.NO_EMAIL_CODE,
                JSONUtils.get_value_json_string(self.__sign_in.response_body,
                                                "error")['code']))

    def test_sign_in_unsuccessfully_with_invalid_param_no_email(self):
        self.__sign_in.sign_in(email="", password=self.DEFAULT_PASSWORD)
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 400),
            self.assert_container(
                self.assertEqual, self.INVALID_PARAM,
                JSONUtils.get_value_json_string(self.__sign_in.response_body,
                                                "error")['code']))

    def test_sign_in_unsuccessfully_with_invalid_param_no_password(self):
        self.__sign_in.sign_in_with_invalid_pass(email=self.__email,
                                                 password="")
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 400),
            self.assert_container(
                self.assertEqual, self.INVALID_PARAM,
                JSONUtils.get_value_json_string(self.__sign_in.response_body,
                                                "error")['code']))

    def test_sign_in_unsuccessfully_with_invalid_param_invalid_password(self):
        self.__sign_in.sign_in_with_invalid_pass(email=self.__email,
                                                 password="******")
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 400),
            self.assert_container(
                self.assertEqual, self.INVALID_PARAM,
                JSONUtils.get_value_json_string(self.__sign_in.response_body,
                                                "error")['code']))

    def test_sign_in_unsuccessfully_with_invalid_param_no_email_password(self):
        self.__sign_in.sign_in()
        APIAssert.should_run_api_successfully(
            self.assert_container(self.assertEqual,
                                  self.__sign_in.response_code, 400),
            self.assert_container(
                self.assertEqual, self.INVALID_PARAM,
                JSONUtils.get_value_json_string(self.__sign_in.response_body,
                                                "error")['code']))