class Test_004_searchCust:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getApplicationusername()
    password = ReadConfig.getApplicationpassword()

    logger = logGen.loggen()

    @pytest.mark.sanity
    #@pytest.mark.regression
    def test_searchCustomer(self, setup):

        self.logger.info("*************Test_001_Login***********")
        self.driver = setup
        self.driver.get("https://admin-demo.nopcommerce.com/admin/")

        self.login = LoginPage(self.driver)
        self.login.set_username(self.username)
        self.login.set_password(self.password)
        self.login.clickLogin()
        time.sleep(8)

        self.srchcust = SearchCustomerPage(self.driver)
        self.srchcust.click_CustomersMenu()
        time.sleep(3)
        self.srchcust.click_CustomersMenuItem()
        time.sleep(3)
        self.srchcust.set_mail("*****@*****.**")
        self.srchcust.click_search()
        time.sleep(5)
        print(self.srchcust.get_no_of_rows())
        status = self.srchcust.search_Customer_by_Email(
            "*****@*****.**")
        time.sleep(5)
        assert status == True
    def test_searchCustomer(self, setup):

        self.logger.info("*************Test_001_Login***********")
        self.driver = setup
        self.driver.get("https://admin-demo.nopcommerce.com/admin/")

        self.login = LoginPage(self.driver)
        self.login.set_username(self.username)
        self.login.set_password(self.password)
        self.login.clickLogin()
        time.sleep(8)

        self.srchcust = SearchCustomerPage(self.driver)
        self.srchcust.click_CustomersMenu()
        time.sleep(3)
        self.srchcust.click_CustomersMenuItem()
        time.sleep(3)
        self.srchcust.set_mail("*****@*****.**")
        self.srchcust.click_search()
        time.sleep(5)
        print(self.srchcust.get_no_of_rows())
        status = self.srchcust.search_Customer_by_Email(
            "*****@*****.**")
        time.sleep(5)
        assert status == True
    def test_search_customer_by_email(self, setup):
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window()

        # login to application
        self.lp = LoginPage(self.driver)
        self.lp.set_email(self.email)
        self.lp.set_password(self.password)
        self.lp.click_login()
        time.sleep(5)

        # search customer
        self.addCustomer = AddCustomerPage(self.driver)
        self.addCustomer.click_on_customers_menu()
        self.addCustomer.click_on_customers_submenu()

        self.searchCustomer = SearchCustomerPage(self.driver)
        self.searchCustomer.set_email("*****@*****.**")
        self.searchCustomer.click_search_button()

        if self.searchCustomer.verify_email_result(
                "*****@*****.**"):
            assert True
        else:
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_search_customer_by_email.png")
            assert False

        self.driver.close()
class Test_004_SearchCustomerByEmail:

    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getPassword()
    logger = LogGen.loggen()

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_SearchCustomerByEmail(self, setup):

        self.logger.info(
            "************* TC004 Search Customer By Email Starting **********")
        self.driver = setup
        self.driver.maximize_window()
        self.driver.get(self.baseURL)

        #Login
        self.login = LoginPage(self.driver)
        self.login.setUsername(self.username)
        self.login.setPassword(self.password)
        self.login.clickLogin()

        self.logger.info("************* Login Successful **********")

        self.logger.info(
            "************* Navigating to Search Customer Page **********")
        self.cust = AddCustomerPage(self.driver)
        self.cust.clickOnCustomersMenu()
        self.cust.clickOnCustomersSubMenuItem()

        self.logger.info(
            "************* Search Customer By Email Starting **********")
        self.search = SearchCustomerPage(self.driver)
        self.search.setEmail('*****@*****.**')
        self.search.clickSearch()
        time.sleep(5)
        status = self.search.searchCustomerByEmail('*****@*****.**')
        print(status)
        if status == True:
            self.logger.info("Search Customer by Email passed successfully")
            assert True == True
        else:
            self.driver.save_screenshot(
                ".\\screenshots\\" + "test_search_customer_by_email_scr.png")
            self.logger.error("Search Customer by Email test case failed")
            assert True == False
        self.logger.info(
            "************* Search Customer By Email Finished **********")
        self.logger.info(
            "************* TC004 Search Customer By Email Completed **********"
        )
        self.driver.close()
Example #5
0
    def test_searchCustomerByName(self, setup):

        self.logger.info(
            "************* TC005 Search Customer By Name **********")
        self.driver = setup
        self.driver.maximize_window()
        self.driver.get(self.baseURL)

        # Login
        self.login = LoginPage(self.driver)
        self.login.setUsername(self.username)
        self.login.setPassword(self.password)
        self.login.clickLogin()

        self.logger.info("************* Login Successful **********")

        self.logger.info(
            "************* Navigating to Search Customer Page **********")
        self.cust = AddCustomerPage(self.driver)
        self.cust.clickOnCustomersMenu()
        self.cust.clickOnCustomersSubMenuItem()

        self.logger.info(
            "************* Starting Search Customer By Name **********")
        self.search = SearchCustomerPage(self.driver)
        self.search.setFname('John')
        self.search.setLname('Smith')
        self.search.clickSearch()
        time.sleep(5)
        status = self.search.searchCustomerByName('John Smith')
        print(status)
        if status == True:
            self.logger.info("Search Customer by Name passed successfully")
            assert True == True
        else:
            self.driver.save_screenshot(".\\screenshots\\" +
                                        "test_search_customer_by_name_scr.png")
            self.logger.error("Search Customer by Name test case failed")
            assert True == False
        self.logger.info(
            "************* Search Customer By Name Finished **********")
        self.logger.info(
            "************* TC005 Search Customer By Name Completed **********")
        self.driver.close()