Пример #1
0
class Test_SearchCustomerByEmail_004:
    baseURL = readconfig.getURL()
    username = readconfig.getuseremail()
    password = readconfig.getuserpassword()
    logger = LogGen.loggen()  # Logger

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

        self.lp = Login(self.driver)
        self.lp.setusername(self.username)
        self.lp.setpassword(self.password)
        self.lp.clicklogin()
        self.logger.info("************* Login succesful **********")

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

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        self.addcust.clickOnCustomersMenuItem()

        self.logger.info("************* searching customer by emailID **********")
        searchcust = SearchCustomer(self.driver)
        searchcust.setEmail("*****@*****.**")
        searchcust.clickSearch()
        time.sleep(5)
        status=searchcust.searchCustomerByEmail("*****@*****.**")
        self.driver.close()
        assert True==status
        self.logger.info("***************  TC_SearchCustomerByEmail_004 Finished  *********** ")
class Test_SearchCustomerByName_005:
    baseUrl = Readconfig.getApplicationURL()
    Username = Readconfig.getUserName()
    password = Readconfig.getPassword()
    logger = LogGen.loggen()

    def test_SearchCustomerbyName(self, setup):
        self.logger.info("************Test_004_Login*******************")
        self.driver = setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()

        self.lp = Login(self.driver)
        self.lp.setUserName(self.Username)
        self.lp.setPassword(self.password)
        self.lp.Click_Login()
        self.logger.info("**************Login succesfully*****************")

        self.Addcust = AddCustomer(self.driver)
        self.Addcust.clickOnCustomerMenu()
        self.Addcust.clickOnCustomerMenu_item()

        self.logger.info(
            "********searching for customer by Name***************")
        searchcust = SearchCustomer(self.driver)
        searchcust.setFirstName("John")
        searchcust.setLastName("Smith")
        searchcust.clickSearch()

        status = searchcust.searchCustomerByName("John Smith")
        assert True == status
        self.logger.info(
            "********Tc_ searchCustomerByName_005 passed***************")
class Test_SearchCustomerByEmail_004:
    baseURL = "http://admin-demo.nopcommerce.com"
    username = "******"
    password = "******"
    logger = LogGen.loggen()  # Logger

    @pytest.mark.regression
    def test_searchCustomerByEmail(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.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()
        self.logger.info("************* Login succesful **********")

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

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        self.addcust.clickOnCustomersMenuItem()

        self.logger.info("************* searching customer by emailID **********")
        searchcust = SearchCustomer(self.driver)
        searchcust.setEmail("*****@*****.**")
        searchcust.clickSearch()
        time.sleep(5)
        status=searchcust.searchCustomerByEmail("*****@*****.**")
        self.driver.close()
        assert True == status
        self.logger.info("***************  TC_SearchCustomerByEmail_004 Finished  *********** ")
Пример #4
0
class Test_004_SearchCustomerbyEmail:
    baseURL = ReadConfig.getApplicationsURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getpassword()
    log = LogGen.loggen()

    @pytest.mark.regression
    def test_searchCustomerbyEmail(self, setup):
        self.log.info("********* Test_004_SearchCustomerbyEmail ********")
        self.log.info("********* Verifying Home Page Title ********")
        self.driver = setup
        self.driver.get(self.baseURL)
        page_title = self.driver.title
        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()
        self.log.info("********* Login Successful ********")
        self.log.info("********* Starting Search Customer Test ********")

        self.addCust = AddCustomerPage(self.driver)
        self.addCust.clickonCustomerMenu()
        self.addCust.clickonCustomerMenuItem()

        self.log.info("********* Searching Customer by EmailID ********")

        self.searchCust = SearchCustomer(self.driver)
        self.searchCust.setEmail("*****@*****.**")
        self.searchCust.clicksearch()
        time.sleep(3)
        status = self.searchCust.SearchbyEmail("*****@*****.**")
        assert True == status
        self.log.info("********* Test_004_SearchCustomer Finished ********")
        self.driver.close()
class TestHubSpot(BaseTest):

    logger = LogGen.logGen()

    @pytest.mark.parametrize("username, password",
                             [("*****@*****.**", "admin123"),
                              ("*****@*****.**", "Calgary_88")])
    def test_login(self, username, password):
        self.logger.info(
            "***********Verify Data Parameterization | Screenshot Capture***************"
        )
        self.logger.info(
            "***********Verify Config Property| Log Generation***************")
        #self.driver.get("https://app.hubspot.com/login")
        self.driver.get(ReadConfig.baseUrl()
                        )  #Reading data from config file using config.ini file
        self.logger.info("***********Launching the URL***************")
        self.driver.implicitly_wait(10)
        self.driver.find_element(By.ID, 'username').send_keys(username)
        self.logger.info("***********Entering Username***************")
        time.sleep(1)
        self.driver.find_element(By.ID, 'password').send_keys(password)
        self.logger.info("***********Entering Password***************")
        time.sleep(1)
        self.driver.find_element(By.ID, 'loginBtn').click()
        self.logger.info("***********Clicking on Login Button***************")
        time.sleep(1)
        x = datetime.datetime.now()
        hms = x.strftime("%H_%M_%S")
        self.driver.save_screenshot("../../../Screenshots/test_login_" +
                                    str(hms) + ".png")
        self.logger.info("***********Generating Screenshot***************")
Пример #6
0
class Test_ExportExcel_006:
    baseUrl = Readconfig.getApplicationURL()
    Username = Readconfig.getUserName()
    password = Readconfig.getPassword()
    logger = LogGen.loggen()

    @pytest.mark.sanity
    def test_ExportExcel(self,setup):
        self.logger.info("************Test_006_Login*******************")
        self.driver=setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()

        self.lp = Login(self.driver)
        self.lp.setUserName(self.Username)
        self.lp.setPassword(self.password)
        self.lp.Click_Login()
        self.logger.info("**************Login succesfully*****************")

        self.Addcust = AddCustomer(self.driver)
        self.Addcust.clickOnCustomerMenu()
        self.Addcust.clickOnCustomerMenu_item()

        self.logger.info("**************Test_Export the file to excel*****************")
        self.excelEx=ExportFile(self.driver)
        self.excelEx.excelPathDownload()
        self.excelEx.exportExcel()
Пример #7
0
class Test_001_Login:
    username = "******"
    password = "******"

    logger = LogGen.loggen()

    def test_incorrectLogin(self, setup):
        self.logger.info("************** Test_001_Login **************")
        self.logger.info("************** Incorrect Login **************")
        self.driver = setup
        self.lp = LoginPage(self.driver)
        self.lp.enterUserName(self.username)
        self.lp.enterPassword(self.password)
        self.lp.clickLogin()
        time.sleep(10)

        act_title = self.driver.title
        if act_title == "System List - MyHealthDirect":
            self.logger.info("************** Login Successful **************")
            assert True
            self.driver.close()
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_incorrectLogin.png")
            self.logger.info("************** Login Failed **************")
            assert False
            self.driver.close()
class Test_Get_Badges_Names:
    uri = ReadConfig.getUri()
    logger = LogGen.loggen()

    @pytest.fixture()
    def setup(self):
        url = self.uri + "/2.2/badges/name?order=desc&sort=rank&site=stackoverflow"
        response = requests.get(url)
        return response

    def test_validateStatusCode(self, setup):
        response = setup
        self.logger.info("Test case test_validateStatusCode started")
        assert response.status_code == 200
        self.logger.info("Test case test_validateStatusCode finished")

    def test_Count_of_expected_badges_names(self, setup):
        response = setup
        self.logger.info(
            "Test case test_Count_of_expected_badges_names started")
        responseJson = json.loads(response.text)
        badgecount = jsonpath.jsonpath(responseJson, 'items[*].badge_id')
        assert len(badgecount) == 30
        self.logger.info(
            "Tcest case test_Count_of_expected_badges_names finished")
Пример #9
0
class Test_SearchCustomerByEmail_004:
    baseUrl = Readconfig.getApplicationURL()
    Username = Readconfig.getUserName()
    password = Readconfig.getPassword()
    logger = LogGen.loggen()

    def test_SearchCustomerbyEmail(self,setup):
        self.logger.info("************Test_004_Login*******************")
        self.driver=setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()

        self.lp=Login(self.driver)
        self.lp.setUserName(self.Username)
        self.lp.setPassword(self.password)
        self.lp.Click_Login()
        self.logger.info("**************Login succesfully*****************")

        self.Addcust = AddCustomer(self.driver)
        self.Addcust.clickOnCustomerMenu()
        self.Addcust.clickOnCustomerMenu_item()

        self.logger.info("********searching for customer by emailId***************")
        searchcust=SearchCustomer(self.driver)
        searchcust.setEmail("*****@*****.**")
        searchcust.clickSearch()
        #time.sleep(5)
        status=searchcust.searchCustomerByEmail("*****@*****.**")
        assert True==status
        self.logger.info("********Tc_ searchCustomerByemailId_004 passed***************")
Пример #10
0
class BasePage:
    logger = LogGen.loggen()
    """Constructor of the class"""
    def __init__(self, driver):
        self.driver = driver
        self.delay = 15

    """this is used to click the element"""

    def do_click(self, by_locator):
        wait = WebDriverWait(self.driver, self.delay).until(
            EC.visibility_of_element_located(by_locator))
        self.driver.find_element(*by_locator).click()

    """this is used to enter the value for the element"""

    def do_send_keys(self, by_locator, text):
        element = WebDriverWait(self.driver, self.delay).until(
            EC.visibility_of_element_located(by_locator))
        element.clear()
        element.send_keys(text)

    """this is used to get the element text"""

    def get_element_text(self, by_locator):
        element = WebDriverWait(self.driver, self.delay).until(
            EC.visibility_of_element_located(by_locator))
        return element.text

    """this will check weather element is visible or not"""

    def is_visible(self, by_locator):
        element = WebDriverWait(self.driver, self.delay).until(
            EC.visibility_of_element_located(by_locator))
        return bool(element)

    """this is used to get the page title"""

    def get_title(self, title):
        WebDriverWait(self.driver, self.delay).until(EC.title_is, 'title')
        return self.driver.title

    """this is used to wait for page load"""

    def wait_for_page_load(self):
        WebDriverWait(self.driver, self.delay).until(EC.url_changes)

    """this is used to get the object of the element"""

    def get_element(self, by_locator):
        element = WebDriverWait(self.driver, self.delay).until(
            EC.visibility_of_element_located(by_locator))
        return element

    def get_item_from_select(self, by_locator, select_text):
        element = WebDriverWait(self.driver, self.delay).until(
            EC.visibility_of_element_located(by_locator))
        Select(element).select_by_visible_text(select_text)
        self.driver.find_element(*by_locator).click()
class Test_003_AddCustomer:
    baseURL = ReadConfig.getApplicationsURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getpassword()
    log = LogGen.loggen()

    @pytest.mark.sanity
    def test_homepage_title(self, setup):
        self.log.info("********* Test_003_AddCustomer ********")
        self.log.info("********* Verifying Home Page Title ********")
        self.driver = setup
        self.driver.get(self.baseURL)
        page_title = self.driver.title
        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()
        self.log.info("********* Login Successful ********")
        self.log.info("********* Starting Add Customer Test ********")

        self.addCust = AddCustomerPage(self.driver)
        self.addCust.clickonCustomerMenu()
        self.addCust.clickonCustomerMenuItem()
        self.addCust.clickAddNew()

        self.log.info("********* Entering new  Customer Details ********")
        self.email = random_generator() + "@gmail.com"
        self.addCust.setEmail(self.email)
        self.addCust.setPassword("test123")
        # self.addCust.setCustomerRoles("Guests")
        self.addCust.setFirstName("Talha")
        self.addCust.setLastName("Ghaffar")
        self.addCust.setGender("Female")
        self.addCust.enterDOB("1/1/1990")
        self.addCust.setCompanyName("AdvanceQA")
        self.addCust.setNewsletter()
        self.addCust.setCustomerRoles("Vendors")
        self.addCust.setManagerOfVendor("Vendor 2")
        self.addCust.setAdminComment("Hello, This is a new customer")
        self.addCust.clickOnSave()

        self.log.info("********* Saving new  Customer Details ********")
        self.log.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:
            assert True == True
            self.log.info("********* Add Customer Test Passed ********")
        else:
            self.driver.save_screenshot("./Screenshots/" +
                                        "test_addCustomer.png")
            self.log.error("********* Add Customer Test Failed ********")
            assert False

        self.driver.close()
        self.log.info("******* Ending Add customer test **********")
Пример #12
0
class Test_002_DDT_Login:
    baseURL = ReadConfig.getApplicationsURL()
    path = "./TestData/LoginData.xlsx"

    log = LogGen.loggen()

    @pytest.mark.regression
    def test_login_ddt(self, setup):
        self.log.info("********* Test_001_ddt_Login ********")
        self.log.info("********* Verifying Login Test ********")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)

        lst_status = []
        self.rows = XLUtils.getRowCount(self.path, "Sheet1")
        for r in range(2, self.rows + 1):
            self.user = XLUtils.readData(self.path, "Sheet1", r, 1)
            self.password = XLUtils.readData(self.path, "Sheet1", r, 2)
            self.exp = XLUtils.readData(self.path, "Sheet1", r, 3)

            self.lp.setUserName(self.user)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(5)
            page_title = self.driver.title
            if page_title == "Dashboard / nopCommerce administration":
                if self.exp == "Pass":
                    self.lp.clickLogout()
                    self.log.info("********* Passed ********")
                    lst_status.append("Pass")
                elif self.exp == "Fail":
                    self.log.info("********* Failed ********")
                    lst_status.append("Fail")
            elif page_title != "Dashboard / nopCommerce administration":
                if self.exp == "Pass":
                    self.log.info("********* Failed ********")
                    lst_status.append("Fail")
                elif self.exp == "Fail":
                    self.log.info("********* Passed ********")

        if "Fail" not in lst_status:
            self.log.info("Login DDT Test Passed")
            self.driver.close()
            assert True
        else:
            self.log.info("*********** Login DDT Test Failed ***********")
            self.driver.close()
            assert False

        self.log.info("*********** End of DDT Test ************")
        self.log.info("*********** Test_002_DDT_Login Completed ************")
Пример #13
0
class Test_001_Login:

    baseurl = ReadConfig.getAppURL()
    username = ReadConfig.getusername()
    password = ReadConfig.getpassword()

    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_homepageTitle(self, setup):
        self.logger.info("**Test_001_Login**")
        self.logger.info("**Verify Home Page Title**")

        self.driver = setup
        self.driver.get(self.baseurl)
        act_title = self.driver.title

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

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_login(self, setup):
        self.logger.info("**Verify The Login function**")
        self.driver = setup
        self.driver.get(self.baseurl)
        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()
        act_title = self.driver.title

        if act_title == "Dashboard / nopCommerce administration":
            assert True
            self.driver.close()
            self.logger.info("**Login is successfule and Title Verified**")
        else:
            self.driver.save_screenshot(".\\screenShots\\" + "test_login.png")
            self.driver.close()
            assert False
            self.logger.error("**Login is Failed**")
Пример #14
0
class Test_001_Login:
    baseUrl = Readconfig.getApplicationURL()
    Username = Readconfig.getUserName()
    password = Readconfig.getPassword()

    logger=LogGen.loggen()

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_homePage(self, setup):
        self.logger.info("************Test_001_Login*************")
        self.logger.info("************verifiying homepage************")
        self.driver = setup
        self.driver.get(self.baseUrl)
        act_title = self.driver.title
        print(act_title)
        self.driver.close()
        if act_title == "Your store. Login":
            assert True
            self.logger.info("************homepage test passed*************")

        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_homePage1.png")
            assert False
            self.driver.close()
            self.logger.info("************homepage test failed*************")


    def test_Loginpage(self,setup):
        #self.driver =  webdriver.Chrome(ChromeDriverManager().install())
        self.driver = setup
        self.driver.get(self.baseUrl)
        self.lp = Login(self.driver)
        self.lp.setUserName(self.Username)
        self.lp.setPassword(self.password)
        self.lp.Click_Login()
        act_title = self.driver.title
        self.driver.close()
        if act_title == "Dashboard / nopCommerce administration":
            assert True
            self.logger.info("************test_Loginpage passed*************")

        else:
            #self.driver.save_screenshot(".\\Screenshots\\" + "test_Loginpage.png")
            self.driver.save_screenshot(".\\Screenshots\\" + "test_Loginpage1.png")
            assert False
            self.driver.close()
            self.logger.info("************test_Loginpage failed***************")
class TestHubSpot(BaseTest):

    logger = LogGen.logGen()
    #Excel File Path
    path = "TestData/LoginData.xlsx"

    #@pytest.mark.parametrize("username, password",
    #                        [
    #                             ("*****@*****.**","admin123"),
    #                            ("*****@*****.**","Calgary_88")
    #                       ])
    @pytest.mark.datadriven
    def test_login(self):
        self.logger.info("***********Verify Data Driven Excel | Screenshot Capture***************")
        self.logger.info("***********Verify Config Property| Log Generation***************")
        #self.driver.get("https://app.hubspot.com/login")
        self.driver.get(ReadConfig.baseUrl())  #Reading data from config file using config.ini file
        self.logger.info("***********Launching the URL***************")
        self.driver.implicitly_wait(10)


        #Get Data from Excel File
        self.rows = excelUtils.getRowCount(self.path,'Sheet1')
        self.columns = excelUtils.getColumnCount(self.path,'Sheet1')

        for row in range(2,self.rows+1):
            self.userName =excelUtils.readData(self.path,'Sheet1',row ,1)
            self.passWord = excelUtils.readData(self.path, 'Sheet1',row , 2)

        #Using Data read from Excel File
            time.sleep(2)
            self.driver.find_element(By.ID, 'username').clear()
            self.driver.find_element(By.ID,'username').send_keys(self.userName)
            self.logger.info("***********Entering Username***************")

            self.driver.find_element(By.ID, 'password').clear()
            time.sleep(1)
            self.driver.find_element(By.ID, 'password').send_keys(self.passWord)
            self.logger.info("***********Entering Password***************")
            time.sleep(1)
            self.driver.find_element(By.ID, 'loginBtn').click()
            self.logger.info("***********Clicking on Login Button***************")
            time.sleep(1)

            x = datetime.datetime.now()
            hms = x.strftime("%H_%M_%S")
            self.driver.save_screenshot("Screenshots/test_login_"+str(hms)+".png")
            self.logger.info("***********Generating Screenshot***************")
Пример #16
0
class Test_001_Login:
    baseURL = ReadConfig.getApplicationsURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getpassword()

    log = LogGen.loggen()

    @pytest.mark.regression
    def test_homepage_title(self, setup):
        self.log.info("********* Test_001_Login ********")
        self.log.info("********* Verifying Home Page Title ********")
        self.driver = setup
        self.driver.get(self.baseURL)
        page_title = self.driver.title
        if page_title == "Your store. Login":
            assert True
            self.driver.close()
            self.log.info("********* Home Page Title Test Passed ********")
        else:
            self.driver.save_screenshot("./Screenshots/" + "test_homepage_title.png")
            self.driver.close()
            self.log.info("********* Home Page Title Test Failed ********")
            self.log.error("********* Home Page Title Test Failed ********")
            assert False

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_login(self, setup):
        self.log.info("********* Verifying Login Test ********")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()
        page_title = self.driver.title
        if page_title == "Dashboard / nopCommerce administration":
            assert True
            self.driver.close()
            self.log.info("********* Login Test Passed ********")
        else:
            self.driver.save_screenshot("./Screenshots/" + "test_login.png")
            self.driver.close()
            self.log.info("********* Login Test Failed ********")
            self.log.error("********* Login Test Failed ********")
            assert False
class Test_001_Login:
    baseURL = "http://admin-demo.nopcommerce.com"
    username = "******"
    password = "******"
    logger = LogGen.loggen()

    def test_homePageTitle(self, setup):
        self.logger.info("*************** Test_001_Login *****************")
        self.logger.info("****Started Home page title test ****")
        self.driver = setup
        self.logger.info("****Opening URL****")
        self.driver.get(self.baseURL)
        act_title = self.driver.title
        if act_title == 'Your store. Login111':
            self.logger.info("**** Home page title test passed ****")
            self.driver.close()
            assert True
        else:
            self.logger.error("**** Home page title test failed****")
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_homePageTitle.png")
            self.driver.close()
            assert False

    def test_login(self, setup):
        self.logger.info("****Started Login Test****")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()
        act_title = self.driver.title
        if act_title == "Dashboard / nopCommerce administration234":
            self.logger.info("****Login test passed ****")
            self.driver.close()
            assert True

        else:
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_homePageTitle.png")
            self.logger.error("****Login test failed ****")
            self.driver.close()
            assert False
class Test_Get_Badges_ID:
    uri=ReadConfig.getUri()
    logger = LogGen.loggen()

    @pytest.fixture()
    def setup(self):
        url = self.uri+"/2.2/badges/5966?order=desc&sort=rank&site=stackoverflow"
        response = requests.get(url)
        return response

    def test_validateStatusCode(self,setup):
        response = setup
        self.logger.info("Test case test_validateStatusCode started")
        assert response.status_code == 200
        self.logger.info("Test case test_validateStatusCode finished!")

    def test_Count_of_expected_badges(self,setup):
        response = setup
        self.logger.info("Test case test_Count_of_expected_badges started")
        responseJson = json.loads(response.text)
        badgeidcount=len(jsonpath.jsonpath(responseJson, 'items[*].badge_id'))
        assert badgeidcount==1
        self.logger.info("Test case test_Count_of_expected_badges finished!")

    def test_validate_processedid_against_requestid_Passed(self,setup):
        response = setup
        self.logger.info("Test case test_validate_processedid_against_requestid_Passed started")
        responseJson = json.loads(response.text)
        resbadgeid =jsonpath.jsonpath(responseJson, 'items[0].badge_id')
        assert resbadgeid[0] == 5966
        self.logger.info("Test case test_validate_processedid_against_requestid_Passed finished!")

    def test_check_if_invalid_id_passed(self,setup):
        response = setup
        self.logger.info("Test case test_check_if_invalid_id_passed started")
        responseJson = json.loads(response.text)
        resitems = jsonpath.jsonpath(responseJson, 'items')
        lislength = resitems[0]
        assert len(lislength) !=0
        self.logger.info("Test case test_check_if_invalid_id_passed finished!")
Пример #19
0
class Test_SearchCustomerByName_004:
    baseurl = ReadConfig.getAppURL()
    username = ReadConfig.getusername()
    password = ReadConfig.getpassword()
    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_searchCustomerByName(self, setup):
        self.logger.info("**Search Customer by Name**")
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window()

        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()
        self.logger.info("**Login Successful**")

        self.logger.info("**Starting Search Customer by NAME ***")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickonCustomerMenu()
        time.sleep(1)
        self.addcust.clickonCustomerMenuItem()

        self.logger.info("**Searching Customer by Name")
        searchcust = SearchCustomer(self.driver)
        searchcust.setFirstName("Victoria")
        searchcust.setLastName("Terces")
        searchcust.clickSearch()
        time.sleep(3)
        status = searchcust.searchCustomerByName("Victoria Terces ")
        time.sleep(2)
        assert True == status
        self.logger.info("**TC_Search Customer by Name Finished**")

        self.driver.close()
Пример #20
0
class Test_API:

    # Additional headers
    headers = {'Content-Type': 'application/json', 'charset': 'UTF-8'}
    url = 'https://dog.ceo/api/breeds/'
    logger = LogGen.log_gen()

    def test_validate_single_random_img_dogs_collection(self):
        self.logger.info(
            "test_validate_single_random_img_dogs_collection started")
        # Arrange
        url = self.url + 'image/random'
        # Act
        resp = requests.get(url, headers=self.headers)
        json_data = (json.loads(resp.text))
        # Assert
        assert resp.status_code == 200
        assert_valid_schema(json_data, 'singleDog.json')
        assert 'https:' in json_data['message']
        self.logger.info(
            "test_validate_single_random_img_dogs_collection completed")

    def test_validate_multiple_random_img_dogs_collection(self):
        self.logger.info(
            "test_validate_multiple_random_img_dogs_collection started")
        # Arrange
        n = random.randint(1, 100)
        url2 = self.url + 'image/random/' + str(n)
        # Act
        resp = requests.get(url2, headers=self.headers)
        json_data = (json.loads(resp.text))
        # Assert
        assert resp.status_code == 200
        assert_valid_schema(json_data, 'multipleDogs.json')
        assert (len(json_data['message']) == n
                if n < 50 else len(json_data['message']) == 50)
        self.logger.info(
            "test_validate_multiple_random_img_dogs_collection completed")
class Test_Get_Badges_ID_Recipients:
    uri = ReadConfig.getUri()
    logger = LogGen.loggen()

    @pytest.fixture()
    def setup(self):
        url = self.uri + "/2.2/badges/5966/recipients?site=stackoverflow"
        response = requests.get(url)
        return response

    @pytest.mark.skip(reason="Skiping this is just for testing purpose")
    def test_validateStatusCode(self, setup):
        response = setup
        self.logger.info("Test case test_validateStatusCode started")
        assert response.status_code == 200
        self.logger.info("Test case test_validateStatusCode finished")

    def test_Count_of_expected_recipients(self, setup):
        response = setup
        self.logger.info("Test case test_Count_of_expected_recipients started")
        responseJson = json.loads(response.text)
        usercount = len(jsonpath.jsonpath(responseJson, 'items[*].user'))
        assert usercount == 1  # Failing intentionally, expected count is 2
        self.logger.info(
            "Test case test_Count_of_expected_recipients finished")

    def test_validate_processedid_against_requestid_Passed(self, setup):
        response = setup
        self.logger.info(
            "Test case test_validate_processedid_against_requestid_Passed started"
        )
        responseJson = json.loads(response.text)
        resbadgeid = jsonpath.jsonpath(responseJson, 'items[0].badge_id')
        assert resbadgeid[0] == 5966
        self.logger.info(
            "Test case test_validate_processedid_against_requestid_Passed finished"
        )
class Test_Get_Badge_Recipients:
    uri = ReadConfig.getUri()
    logger = LogGen.loggen()

    @pytest.fixture()
    def setup(self):
        url = self.uri + "/2.2/badges/recipients?site=stackoverflow"
        response = requests.get(url)
        return response

    def test_validateStatusCode(self, setup):
        response = setup
        self.logger.info("Test case test_validateStatusCode started")
        assert response.status_code == 200
        self.logger.info("Test case test_validateStatusCode finished")

    def test_Count_of_expected_recipients(self, setup):
        response = setup
        self.logger.info("Test case test_Count_of_expected_recipients started")
        responseJson = json.loads(response.text)
        usercount = jsonpath.jsonpath(responseJson, 'items[*].user')
        assert len(usercount) == 30
        self.logger.info(
            "Test case test_Count_of_expected_recipients finished")
Пример #23
0
class Test_002_DDT_Login():
    baseURL = readconfig.getURL()
    path = ".//testData/LoginData.xlsx"
    logger = LogGen.loggen()  # Logger

    @pytest.mark.regression
    def test_login_ddt(self, setup):
        self.logger.info("******* Starting Test_002_DDT_Login Test **********")
        self.logger.info("******* Starting Login DDT Test **********")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        self.lp = Login(self.driver)

        self.rows = ExcelUtils.getRowCount(self.path, 'Sheet1')
        print('Number of rows...', self.rows)
        lst_status = []

        for r in range(2, self.rows + 1):
            self.user = ExcelUtils.readData(self.path, 'Sheet1', r, 1)
            self.password = ExcelUtils.readData(self.path, 'Sheet1', r, 2)
            self.exp = ExcelUtils.readData(self.path, 'Sheet1', r, 3)

            self.lp.setusername(self.user)
            self.lp.setpassword(self.password)
            time.sleep(3)
            self.lp.clicklogin()
            time.sleep(3)

            act_title = self.driver.title
            exp_title = "Dashboard / nopCommerce administration"

            if act_title == exp_title:
                if self.exp == 'Pass':
                    self.logger.info("**** passed ****")
                    self.lp.clicklogout()
                    lst_status.append("Pass")
                elif self.exp == 'Fail':
                    self.logger.info("**** failed ****")
                    self.lp.clicklogout()
                    lst_status.append("Fail")

            elif act_title != exp_title:
                if self.exp == 'Pass':
                    self.logger.info("**** failed ****")
                    lst_status.append("Fail")
                elif self.exp == 'Fail':
                    self.logger.info("**** passed ****")
                    lst_status.append("Pass")
            print(lst_status)
        if "Fail" not in lst_status:
            self.logger.info("******* DDT Login test passed **********")
            self.driver.close()
            assert True
        else:
            self.logger.error("******* DDT Login test failed **********")
            self.driver.close()
            assert False

        self.logger.info("******* End of Login DDT Test **********")
        self.logger.info(
            "**************** Completed  TC_LoginDDT_002 ************* ")
class Test_003_AddCustomer:
    baseURL = readconfig.getURL()
    username = readconfig.getuseremail()
    password = readconfig.getuserpassword()

    logger = LogGen.loggen()

    @pytest.mark.sanity
    def test_addcustomer(self, setup):
        self.logger.info("*********Test_003_AddCustomer ************")
        self.driver = setup
        self.driver.get(self.baseURL)

        self.lp = Login(self.driver)
        self.lp.setusername(self.username)
        self.lp.setpassword(self.password)
        self.lp.clicklogin()
        self.logger.info("*****Login Successfull***********")

        self.logger.info("*****Starting Add customer test ***********")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        self.addcust.clickOnCustomersMenuItem()
        self.addcust.clickOnAddnew()

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

        self.email = random_generator() + "@gmail.com"
        self.addcust.setEmail(self.email)
        self.addcust.setPassword("test123")
        self.addcust.setFirstName("Ayushree")
        self.addcust.setLastName("Tagde")
        self.addcust.setGender("Female")
        self.addcust.setDob("7/05/1985")  # Format: D / MM / YYY
        self.addcust.setCompanyName("busyQA")
        # self.addcust.setNewsletter("Test store 2")
        # newsletter is similar to roles, but not executed yet bcz of inc xpath
        # (will do later)
        self.addcust.setCustomerRoles("Guests")
        self.addcust.setManagerOfVendor("Vendor 2")

        self.addcust.setAdminContent("This is for testing.........")
        self.addcust.clickOnSave()

        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:
            assert True
            self.logger.info("********* Add customer Test Passed *********")
        else:
            self.driver.save_screenshot(
                ".\\Screenshots\\" + "test_addCustomer_scr.png")  # Screenshot
            self.logger.error(
                "********* Add customer Test Failed ************")
            assert False

        self.driver.close()
        self.logger.info("******* Ending Add customer test **********")
class Test_002_DDT_Login:

    baseurl = ReadConfig.getAppURL()
    path = ".//testData/LoginData.xlsx"
    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_login(self, setup):
        self.logger.info("**Test_002_DDT_Login**")
        self.logger.info("**Verify The Login DDT function**")
        self.driver = setup
        self.driver.get(self.baseurl)
        self.lp = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')

        # List variable to capture to results of the test

        lst_status = []  # Empty list variable

        for r in range(2, self.rows + 1):
            self.username = XLUtils.readData(self.path, 'Sheet1', r, 1)
            self.password = XLUtils.readData(self.path, 'Sheet1', r, 2)
            self.expected = XLUtils.readData(self.path, 'Sheet1', r, 3)

            self.lp.setUserName(self.username)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(2)

            act_title = self.driver.title
            exp_tile = "Dashboard / nopCommerce administration"

            if act_title == exp_tile:
                if self.expected == "Pass":
                    self.logger.info("***Test Passed***" + self.username)
                    self.lp.clickLogout()
                    lst_status.append("Pass")
                elif self.expected == "Fail":
                    self.logger.error("***Test Failed***" + self.username)
                    self.lp.clickLogout()
                    lst_status.append("Fail")
            elif act_title != exp_tile:
                if self.expected == "Pass":
                    self.logger.error("***Test Failed***" + self.username)
                    lst_status.append("Fail")
                elif self.expected == "Fail":
                    self.logger.info("***Test Passed***" + self.username)
                    lst_status.append("Pass")

        if "Fail" not in lst_status:
            self.logger.info("***Login DDT Test Passed***")
            self.driver.close()
            assert True
        else:
            self.logger.error("***Login DDT Test Failed***")
            self.driver.close()
            assert False

        self.logger.info("***End of DDT Test**")
        self.logger.info("***Completed the Test ***")
Пример #26
0
class Test_Get_Badges:
    uri = ReadConfig.getUri()
    logger = LogGen.loggen()
    datafilepath = ReadConfig.getfilepath()

    @pytest.fixture()
    def setup(self):
        url = self.uri + "/2.2/badges?order=desc&sort=rank&site=stackoverflow"
        response = requests.get(url)
        return response

    def test_validateStatusCode(self, setup):
        response = setup
        self.logger.info("Test case test_validateStatusCode started")
        assert response.status_code == 200
        self.logger.info("Test case test_validateStatusCode finished")

    def test_Count_of_expected_badges(self, setup):
        response = setup
        self.logger.info("Test case test_Count_of_expected_badges started")
        responseJson = json.loads(response.text)
        badgeidcount = len(jsonpath.jsonpath(responseJson,
                                             'items[*].badge_id'))
        assert badgeidcount == 30
        self.logger.info("Test case test_Count_of_expected_badges finished")

    def test_validate_Data_Header_Present(self, setup):
        response = setup
        self.logger.info("Test case test_validate_Data_Header_Present started")
        assert response.headers.get('date')
        self.logger.info(
            "Test case test_validate_Data_Header_Present finished")

    def test_validate_if_response_is_empty(self, setup):
        response = setup
        self.logger.info(
            "Test case test_validate_if_response_is_empty started")
        responseJson = json.loads(response.text)
        badgeidcount = len(jsonpath.jsonpath(responseJson,
                                             'items[*].badge_id'))
        assert badgeidcount != 0
        self.logger.info(
            "Test case test_validate_if_response_is_empty finished")

    def test_validate_response_for_bad_parameter_pass(self, setup):
        response = setup
        self.logger.info(
            "Test case test_validate_response_for_bad_parameter_pass started")
        assert response.status_code != 400
        self.logger.info(
            "Test case test_validate_response_for_bad_parameter_pass finished")

    def test_validate_resposesize_not_greaterthan_10000bytes(self, setup):
        response = setup
        self.logger.info(
            "Test case test_validate_resposesize_not_greaterthan_10000bytes started"
        )
        resSize = len(response.content)
        assert resSize < 10000
        self.logger.info(
            "Test case test_validate_resposesize_not_greaterthan_10000bytes finished"
        )

    def test_schema_datatype_validations(self, setup):
        self.logger.info("Test case test_schema_datatype_validations started")
        schema = {
            "type": "object",
            "properties": {
                "quota_max": {
                    "type": "number"
                },
                "items": {
                    "type": "array",
                    "maxItems": 1,  # Check max items in array
                    "items": {
                        "type": "object",
                        "properties": {
                            "badge_type": {
                                "type": "string"
                            },
                            "award_count": {
                                "type": "number"
                            },
                            "badge_id": {
                                "type": "number"
                            },
                        },
                        "required": ["badge_id"]
                    }
                }
            },
            "required": ["quota_max"]
        }

        Draft6Validator.check_schema(schema)
        self.logger.info("Test case test_schema_datatype_validations finished")

    def test_validate_if_any_duplciate_badgeid_present_in_respose(self, setup):
        response = setup
        self.logger.info(
            "Test case test_validate_if_any_duplciate_badgeid_present_in_respose started"
        )
        responseJson = json.loads(response.text)
        badgeId = jsonpath.jsonpath(responseJson, 'items[*].badge_id')
        duplicate = []
        for i in range(len(badgeId)):
            k = i + 1
            for j in range(k, len(badgeId)):
                if badgeId[i] == badgeId[j] and badgeId[i] not in duplicate:
                    duplicate.append(badgeId[i])
        print(duplicate)
        assert len(duplicate) != 1
        self.logger.info(
            "Test case test_validate_if_any_duplciate_badgeid_present_in_respose finished"
        )

    def test_validate_badgeIds_against_expected_badgeids(self, setup):
        response = setup
        self.logger.info(
            "Test case test_validate_badgeIds_against_expected_badgeids started"
        )
        responseJson = json.loads(response.text)
        resbadgeId = jsonpath.jsonpath(responseJson, 'items[*].badge_id')

        #Get the ids from expected data file
        df = pd.read_csv(self.datafilepath, skiprows=[1])
        csvbadgeid = df.values.tolist()
        flat_list = [item for sublist in csvbadgeid for item in sublist
                     ]  # Created flat list from list of list
        diff_list = [
            i for i in resbadgeId + flat_list
            if i not in resbadgeId or i not in flat_list
        ]
        print(diff_list)
        assert len(diff_list) == 0
        self.logger.info(
            "Test case test_validate_badgeIds_against_expected_badgeids finished"
        )
class Test_002_DataCatalog:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getPassword()
    server = ReadConfig.getServer()
    portnumber = ReadConfig.getPortNumber()
    Database = ReadConfig.getDatabases()
    user = ReadConfig.getUser()
    pwd = ReadConfig.getPass()

    logger = LogGen.loggen()

    def test_003_Table_Copy(self, setup):
        self.logger.info(
            "***************************Test_003_DataCatalog*************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.clickNext()
        time.sleep(2)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(2)
        self.lp.clickYes()
        time.sleep(2)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(10)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "***************************Table Copy Validation *************************"
        )
        # Copy
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='File2Table']").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//img[@title='Copy']").click()
        time.sleep(2)
        self.DCP = DataCatalogPage(self.driver)
        self.DCP.setTableName("ABC")
        time.sleep(2)
        self.DCP.setSchemaName("Sandbox")
        time.sleep(2)
        self.DCP.ClickCopy()
        time.sleep(5)
        self.DCP.ClickFiles()
        time.sleep(5)
        self.DCP.ClickDatasets()
        time.sleep(5)
        element = self.driver.find_element_by_xpath("//div[@title='ABC']")
        print(element.text)
        if element.text == "ABC":
            assert True
            self.driver.close()
            self.logger.info(
                "***************************Table Copy Passed *************************"
            )
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_Table_Copy.png")
            self.driver.close()
            self.logger.error(
                "***************************Table Copy Failed *************************"
            )
            assert False

    def test_Table_Preview(self, setup):
        self.logger.info(
            "***************************Test_003_DataCatalog*************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.clickNext()
        time.sleep(2)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(2)
        self.lp.clickYes()
        time.sleep(2)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(10)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "***************************Table Preview Validation *************************"
        )
        # Copy
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='dfg']").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//img[@title='View all']").click()
        time.sleep(2)
        self.logger.info(
            "***************************Select Operator CONTAINS Validation *************************"
        )
        DCP = DataCatalogPage(self.driver)
        DCP.setSelectOne("Loginemail")
        time.sleep(2)
        DCP.setSelectOperator("CONTAINS")
        time.sleep(5)
        DCP.setSearch("*****@*****.**")
        time.sleep(5)
        DCP.ClickSearchIcon()
        time.sleep(5)
        status = DCP.searchLoginEmail_Contains("*****@*****.**")
        assert True == status
        self.logger.info(
            "***************************Select Operator CONTAINS PASSED *************************"
        )
        self.driver.back()
        time.sleep(5)
        self.lp.ClickSearch()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='dfg']").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//img[@title='View all']").click()
        time.sleep(2)
        self.logger.info(
            "***************************Select Operator CONTAINS Validation *************************"
        )
        DCP = DataCatalogPage(self.driver)
        DCP.setSelectOne("Loginemail")
        time.sleep(2)
        DCP.setSelectOperator("NOT CONTAINS")
        time.sleep(5)
        DCP.setSearch("*****@*****.**")
        time.sleep(5)
        DCP.ClickSearchIcon()
        time.sleep(5)

        element = self.driver.find_element_by_xpath(
            "//td[contains(text(),'*****@*****.**')]")

        if element == True:
            print("Successfull")
Пример #28
0
class Test_003_Login:
    baseUrl = Readconfig.getApplicationURL()
    Username = Readconfig.getUserName()
    password = Readconfig.getPassword()
    logger = LogGen.loggen()

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_addCustomer(self, setup):
        self.logger.info("************Test_003_Login*******************")
        self.driver = setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()

        self.lp = Login(self.driver)
        self.lp.setUserName(self.Username)
        self.lp.setPassword(self.password)
        self.lp.Click_Login()
        self.logger.info("**************Login succesfully*****************")

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

        self.Addcust = AddCustomer(self.driver)
        self.Addcust.clickOnCustomerMenu()
        self.Addcust.clickOnCustomerMenu_item()

        self.Addcust.click_ADDnew()

        self.logger.info("********Providing customer info***************")
        self.email = random_generator() + "@gmail.com"
        self.Addcust.set_email(self.email)
        self.Addcust.set_Password(self.password)
        #self.Addcust.setcustomerRoles("Guests")
        self.Addcust.setManagerofVendor_xpath("Vendor 2")
        self.Addcust.setGender("Female")
        self.Addcust.setFirstName("Lavanya")
        self.Addcust.setlastName("P")
        self.Addcust.setDOB("10/08/1995")  #Format :DD/MM/YYYY
        self.Addcust.setCompanyName("Capgemini")
        self.Addcust.SetAdminContent("This is for testing data...............")
        self.Addcust.clickOnSave()

        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:
            assert True == True
            self.logger.info("******Add customer Test Passed******")
        else:
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_addCustoer_scr.png")
            self.logger.info(
                "*************Add customer failed*******************")
            assert False == False
        time.sleep(5)
        self.driver.quit()
        self.logger.info(
            "***********End of Homepage title test****************")
class Test_001_Login:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getPassword()

    logger = LogGen.loggen()

    def test_signinPageTitle(self, setup):
        self.logger.info(
            "***************************Test_001_Login*************************"
        )
        self.logger.info(
            "***************************Sign In Page Title Validation *************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)

        act_title = self.driver.title

        if act_title == "Sign in to your account":
            assert True
            self.driver.close()
            self.logger.info(
                "***************************Sign In Page Title Passed *************************"
            )

        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_homePageTitle.png")
            self.driver.close()
            self.logger.error(
                "***************************Sign In Page Title Failed *************************"
            )
            assert False

    def test_login(self, setup):
        self.logger.info(
            "***************************Login Validation *************************"
        )

        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.clickNext()
        time.sleep(5)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(5)
        self.lp.clickYes()
        time.sleep(5)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        self.lp.clickSignIn()
        time.sleep(7)
        self.driver.find_element_by_xpath("//button[@type='submit']").click()
        act_title = self.driver.title
        if act_title == "Tesser Pro":
            self.driver.close()
            assert True
            self.logger.info(
                "***************************Login Passed *************************"
            )
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_homePageTitle.png")
            self.driver.close()
            self.logger.error(
                "***************************Login Failed *************************"
            )
            assert False
Пример #30
0
class Test_002_DDT_Login:
    baseUrl = Readconfig.getApplicationURL()
    path = ".//Testdata/LoginData.xlsx"
    #Username = R eadconfig.getUserName()
    #password = Readconfig.getPassword()
    logger = LogGen.loggen()

    def test_Loginpage_DDT(self, setup):
        #self.driver =  webdriver.Chrome(ChromeDriverManager().install())
        self.logger.info("************Test_002_DDT_Login************")
        self.logger.info(
            "************test_Loginpage_DDT veriying*************")
        self.driver = setup
        self.driver.get(self.baseUrl)

        self.lp = Login(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print("numbers of rows", self.rows)
        lst_status = []  #empty list

        for r in range(2, self.rows + 1):
            self.user = XLUtils.readData(self.path, 'Sheet1', r, 1)
            self.password = XLUtils.readData(self.path, 'Sheet1', r, 2)
            self.exp = XLUtils.readData(self.path, 'Sheet1', r, 3)

            self.lp.setUserName(self.user)
            self.lp.setPassword(self.password)
            self.lp.Click_Login()
            time.sleep(5)

            act_title = self.driver.title
            print(act_title)
            exp_title = "Dashboard / nopCommerce administration"
            print(exp_title)
            if act_title == exp_title:
                if self.exp == "Pass":
                    self.logger.info("*******condition passed*******")
                    print("at=et")
                    self.lp.Click_Logout()
                    lst_status.append("Pass")
                elif self.exp == "Fail":
                    self.logger.info("*******condition failed*******")
                    self.lp.Click_Logout()
                    lst_status.append("Fail")
            elif act_title != exp_title:
                if self.exp == "Pass":
                    self.logger.info("*******condition failed*******")
                    #self.lp.Click_Logout()
                    lst_status.append("Fail")
                elif self.exp == "Fail":
                    self.logger.info("*******condition passed*******")
                    #self.lp.Click_Logout()
                    lst_status.append("Pass")
        if "Fail" not in lst_status:
            self.logger.info("******Login DDT test passed********")
            print("Login DDT test passed")
            self.driver.close()
            assert True
        else:
            self.logger.info("*********Login DDT test failed***************")
            print("Login DDT test failed")
            self.driver.close()
            assert False
        self.logger.info("**********End of Login DDT test****************")