def test_add_customer(self, setup):
     self.driver = setup
     self.driver.get(ConfigReader.get_application_url())
     self.lg = Login(self.driver)
     self.lg.set_username(ConfigReader.get_login_username())
     self.lg.set_password(ConfigReader.get_login_password())
     self.lg.click_login()
     self.logger.info("Login Successful")
     self.logger.info("starting add customer test")
     self.add_customer = AddCustomerTest(self.driver)
     self.add_customer.click_on_customer_main_manu()
     self.add_customer.click_on_customer_mainItem()
     self.add_customer.click_on_add_new_button()
     self.logger.info("Providing customer information")
     self.email = randon_generator() + "@gmail.com"
     self.add_customer.set_email(self.email)
     self.add_customer.set_password(randon_generator(15))
     self.add_customer.set_first_name(randon_generator(6))
     self.add_customer.set_last_name(randon_generator(6))
     self.add_customer.click_on_gender("male")
     self.add_customer.set_date_of_birth("12/02/1986")
     self.add_customer.set_company_name("moreyeahs")
     self.add_customer.click_on_is_tax_exempt()
     self.add_customer.set_customer_role()
     self.add_customer.set_new_letter("Your store name")
     self.add_customer.select_manager_of_vendor()
     self.add_customer.click_on_active_button()
     self.add_customer.click_on_comment(randon_generator(40))
     self.add_customer.click_on_save_button()
     self.add_customer.check_customer_added_successfully()
     self.driver.close()
Exemplo n.º 2
0
 def test_login ( self, setup ) :
     self.driver = setup
     self.driver.get ( ConfigReader.get_application_url () )
     self.lg = Login ( self.driver )
     self.lg.set_username ( ConfigReader.get_login_username () )
     self.lg.set_password ( ConfigReader.get_login_password () )
     self.lg.click_login ()
     login_page_title = self.driver.title
     if login_page_title == "Dashboard / nopCommerce administration":
         assert True
         self.driver.close()
     else:
         screenshot(self.driver)
         self.driver.close()
         assert False
Exemplo n.º 3
0
class Test_002_DDT_Login:

    logger = LogGen.loggen()
    app_url = ConfigReader.get_application_url()
    file_path = "C:\\Users\\sgite\\PycharmProjects\\HybridFrameWork\\TestData\\testData.xlsx"

    @pytest.mark.regression
    def test_login_ddt(self, setup):
        self.driver = setup
        self.driver.get(self.app_url)
        self.lg = Login(self.driver)
        self.rows = get_row_count(self.file_path, "Sheet1")
        print("Num of rows-- ", self.rows)
        list_status = []
        for row in range(2, self.rows + 1):
            self.username = read_data(self.file_path, 'Sheet1', row, 1)
            self.password = read_data(self.file_path, 'Sheet1', row, 2)
            self.exp_result = read_data(self.file_path, 'Sheet1', row, 3)
            self.lg.set_username(self.username)
            self.lg.set_password(self.password)
            self.lg.click_login()
            time.sleep(5)
            act_title = self.driver.title
            exp_title = "Dashboard / nopCommerce administration"
            if act_title == exp_title:
                if self.exp_result == "pass":
                    self.logger.info(("**Pass**"))
                    self.lg.click_logout()
                    list_status.append("Pass")
                elif self.exp_result == "fail":
                    self.logger.info(("**Pass**"))
                    self.lg.click_logout()
                    list_status.append("Fail")
            elif act_title != exp_title:
                if self.exp_result == "pass":
                    self.logger.info(("**Fail**"))
                    list_status.append("Fail")
                elif self.exp_result == "fail":
                    self.logger.info(("**Pass**"))
                    list_status.append("pass")
        if "Fail" not in list_status:
            self.driver.close()
            self.logger.info("Test Case Pass")
            assert True
        else:
            self.driver.close()
            self.logger.info("Test Case Pass")
            assert False
    def test_search_customer(self, setup):
        self.driver = setup
        self.driver.get(ConfigReader.get_application_url())
        self.lg = Login(self.driver)
        self.lg.set_username(ConfigReader.get_login_username())
        self.lg.set_password(ConfigReader.get_login_password())
        self.lg.click_login()
        self.logger.info("Login Successful")
        self.logger.info("starting search customer test")

        self.go_to_customer_page = AddCustomerTest(self.driver)
        self.go_to_customer_page.click_on_customer_main_manu()
        self.go_to_customer_page.click_on_customer_mainItem()

        self.searchCustomer = SearchCustomer(self.driver)
        flag = self.searchCustomer.search_customer_by_attribute(
            attribute=ConfigReader.getArrtibute())
        assert flag
        self.logger.info("Test search customer pass")
        self.driver.close()
Exemplo n.º 5
0
 def test_login_ddt(self, setup):
     self.driver = setup
     self.driver.get(self.app_url)
     self.lg = Login(self.driver)
     self.rows = get_row_count(self.file_path, "Sheet1")
     print("Num of rows-- ", self.rows)
     list_status = []
     for row in range(2, self.rows + 1):
         self.username = read_data(self.file_path, 'Sheet1', row, 1)
         self.password = read_data(self.file_path, 'Sheet1', row, 2)
         self.exp_result = read_data(self.file_path, 'Sheet1', row, 3)
         self.lg.set_username(self.username)
         self.lg.set_password(self.password)
         self.lg.click_login()
         time.sleep(5)
         act_title = self.driver.title
         exp_title = "Dashboard / nopCommerce administration"
         if act_title == exp_title:
             if self.exp_result == "pass":
                 self.logger.info(("**Pass**"))
                 self.lg.click_logout()
                 list_status.append("Pass")
             elif self.exp_result == "fail":
                 self.logger.info(("**Pass**"))
                 self.lg.click_logout()
                 list_status.append("Fail")
         elif act_title != exp_title:
             if self.exp_result == "pass":
                 self.logger.info(("**Fail**"))
                 list_status.append("Fail")
             elif self.exp_result == "fail":
                 self.logger.info(("**Pass**"))
                 list_status.append("pass")
     if "Fail" not in list_status:
         self.driver.close()
         self.logger.info("Test Case Pass")
         assert True
     else:
         self.driver.close()
         self.logger.info("Test Case Pass")
         assert False
Exemplo n.º 6
0
class Test_001_Login:

    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_home_page_title(self, setup ):
        self.logger.info("Generating log")
        self.driver = setup
        self.driver.get ( ConfigReader.get_application_url () )
        home_page_title = self.driver.title
        if home_page_title == "Your store. Login" :
            assert True
            self.driver.close ()
        else :
            screenshot ( self.driver )
            self.driver.close ()
            assert False

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_login ( self, setup ) :
        self.driver = setup
        self.driver.get ( ConfigReader.get_application_url () )
        self.lg = Login ( self.driver )
        self.lg.set_username ( ConfigReader.get_login_username () )
        self.lg.set_password ( ConfigReader.get_login_password () )
        self.lg.click_login ()
        login_page_title = self.driver.title
        if login_page_title == "Dashboard / nopCommerce administration":
            assert True
            self.driver.close()
        else:
            screenshot(self.driver)
            self.driver.close()
            assert False