class Test_SearchCustomerByEmail_004:
    baseURL = ReadConfig.get_app_url()
    username = ReadConfig.get_username()
    password = ReadConfig.get_password()
    logger = LogGen.log_gen()

    @pytest.mark.regression
    def test_search_customer_by_email(self, setup):
        self.logger.info("***** SearchCustomerByEmail_004 *****")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()

        self.lp = LoginPage(self.driver)
        self.lp.set_username(self.username)
        self.lp.set_password(self.password)
        self.lp.click_login()
        self.logger.info("***** Login successful *****")

        self.logger.info("***** Starting Search Customer By Email *****")

        self.add_cst = AddCustomer(self.driver)
        self.add_cst.click_on_customers_menu()
        self.add_cst.click_on_customers_menu_item()

        self.logger.info("***** Searching customer by emailID *****")
        search_cst = SearchCustomer(self.driver)
        search_cst.set_email("*****@*****.**")
        search_cst.click_search()
        time.sleep(5)
        status = search_cst.search_customer_by_email(
            "*****@*****.**")
        self.driver.close()
        self.logger.info("*****  TC_SearchCustomerByEmail_004 Finished  *****")
        assert status is True
Exemplo n.º 2
0
class Test_003_AddCustomer:
    base_url = ReadConfig.get_app_url()
    username = ReadConfig.get_username()
    password = ReadConfig.get_password()
    logger = LogGen.log_gen()

    @pytest.mark.regression
    def test_add_customer(self, setup):
        self.logger.info("***** Test_003_AddCustomer *****")
        self.driver = setup
        self.driver.get(self.base_url)
        self.driver.maximize_window()

        self.lp = LoginPage(self.driver)
        self.lp.set_username(self.username)
        self.lp.set_password(self.password)
        self.lp.click_login()
        self.logger.info("***** Login successful *****")

        self.logger.info("***** Starting Add Customer Test *****")

        self.add_cust = AddCustomer(self.driver)
        self.add_cust.click_on_customers_menu()
        self.add_cust.click_on_customers_menu_item()

        self.add_cust.click_on_add_new()

        self.logger.info("***** Providing customer info *****")

        self.email = random_generator() + "@gmail.com"
        self.add_cust.set_email(self.email)
        self.add_cust.set_password("test123")
        self.add_cust.set_customer_roles("Guests")
        self.add_cust.set_manager_of_vendor("Vendor 2")
        self.add_cust.set_gender("Male")
        self.add_cust.set_first_name("Vlad")
        self.add_cust.set_last_name("Nire")
        self.add_cust.set_dob("7/05/1989")  # Format: D / MM / YYYY
        self.add_cust.set_company_name("QA")
        self.add_cust.set_admin_content("This is for testing.")
        self.add_cust.click_on_save()

        self.logger.info("***** Saving customer info *****")

        self.logger.info("***** Add customer validation started *****")

        self.msg = self.driver.find_element_by_tag_name("body").text

        #print(self.msg)
        if 'customer has been added successfully.' in self.msg:
            self.logger.info("***** Add customer Test Passed *****")
            assert True
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_add_customer_scr.png")
            self.logger.error("***** Add customer Test Failed *****")
            assert False

        self.driver.close()
        self.logger.info("***** Ending Add customer test *****")
Exemplo n.º 3
0
class Test_001_Login:
    base_url = ReadConfig.get_app_url()
    username = ReadConfig.get_username()
    password = ReadConfig.get_password()
    logger = LogGen.log_gen()

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_home_page_title(self, setup):
        self.logger.info("***** Test_001_Login *****")
        self.logger.info("***** Verifying Home Page Title *****")
        self.driver = setup
        self.driver.get(self.base_url)
        actual_title = self.driver.title

        if actual_title == "Your store. Login":
            self.driver.close()
            self.logger.info("***** Home Page Title Passed *****")
            assert True
        else:
            self.driver.save_screenshot(".\\screenshots\\" +
                                        "test_home_page_title.png")
            self.driver.close()
            self.logger.error("***** Home Page Title Failed *****")
            assert False

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_login(self, setup):
        self.logger.info("***** Test_002_Login *****")
        self.logger.info("***** Verifying Login *****")
        self.driver = setup
        self.driver.get(self.base_url)
        self.lp = LoginPage(self.driver)
        self.lp.set_username(self.username)
        self.lp.set_password(self.password)
        self.lp.click_login()
        actual_title = self.driver.title

        if actual_title == "Dashboard / nopCommerce administration":
            self.logger.info("***** Login Passed *****")
            self.driver.close()
            assert True
        else:
            self.driver.save_screenshot(".\\screenshots\\" + "test_login.png")
            self.logger.error("***** Login Failed *****")
            self.driver.close()
            assert False
Exemplo n.º 4
0
class Test_001_Login:
    baseURL = ReadConfig.get_application_url()
    username = ReadConfig.get_username()
    password = ReadConfig.get_password()

    logger = LogGen.loggen()

    path_to_screenshots = os.path.join('.', 'screenshots')

    def test_home_page_title(self, setup):
        self.logger.info("***Test_001_Login***")
        self.logger.info("***Verifying Home Page Title***")
        self.driver = setup
        self.driver.get(self.baseURL)
        actual_title = self.driver.title
        if actual_title == "Your store. Login":
            assert True
            self.logger.info("*** Home page title test is passed ***")
            self.driver.close()
        else:
            path_to_failed_home_page_title_test = os.path.join(self.path_to_screenshots,
                                                               'test_home_page_title_failed.png')
            self.driver.save_screenshot(path_to_failed_home_page_title_test)
            self.logger.error("*** Home page title test is failed ***")
            self.driver.close()
            assert False

    def test_login(self, setup):
        self.logger.info("***Verifying Login test***")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)
        self.lp.set_user_name(self.username)
        self.lp.set_password(self.password)
        self.lp.click_login_button()
        actual_title = self.driver.title
        if actual_title == "Dashboard / nopCommerce administration":
            self.logger.info("*** Login test is passed ***")
            self.driver.close()
            assert True
        else:
            path_to_failed_login_test = os.path.join(self.path_to_screenshots, 'test_login_failed.png')
            self.driver.save_screenshot(path_to_failed_login_test)
            self.logger.error("*** Login test is failed ***")
            self.driver.close()
            assert False