Esempio n. 1
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()
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  *********** ")
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***************")
Esempio n. 4
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")
Esempio n. 6
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  *********** ")
Esempio n. 7
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***************")
Esempio n. 8
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()
Esempio n. 9
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 **********")
Esempio n. 11
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 ************")
Esempio n. 12
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**")
Esempio n. 13
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***************")
Esempio n. 14
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!")
Esempio n. 17
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()
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")
Esempio n. 20
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_002_Ingest:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getPassword()

    logger = LogGen.loggen()

    def test_Ingest_ConvertToTable(self, setup):
        self.logger.info(
            "***************************Test_002_Ingest*************************"
        )

        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "***************************Table Convertion Validation *************************"
        )
        # selecting file from files module to convert into table
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//tbody[@role='rowgroup']//div[@title='marks_new']").click()
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "//img[@title='Convert to table']").click()
        time.sleep(8)
        self.IG = IngestPage(self.driver)
        self.IG.setSchemaName("Sandbox")
        time.sleep(5)
        self.driver.find_element_by_id("tableName").send_keys("File2Table")
        time.sleep(2)
        self.IG.setLoadType("Complete Refresh")
        time.sleep(5)
        self.IG.clickReviewandConvert()
        self.logger.info(
            "***************************ReviewandConvert Passed *************************"
        )
        time.sleep(10)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Datasets ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath(
            "//div[@title='File2Table']")
        print(element.text)
        if element.text == "File2Table":
            assert True
            self.driver.close()
            self.logger.info(
                "***************************ConvertToTable Passed *************************"
            )
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_ConvertToTable.png")
            self.driver.close()
            self.logger.error(
                "***************************ConvertToTable Failed *************************"
            )
            assert False

    def test_Ingest_ConvertToTable_Existing(self, setup):
        self.logger.info(
            "***************************Test_002_Ingest*************************"
        )
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "***************************File Selecting for Covertion *************************"
        )
        # selecting file from files module to convert into table
        time.sleep(8)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='marks_new']").click()
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "//img[@title='Convert to table']").click()
        time.sleep(8)
        self.logger.info(
            "***************************Existing Table Covertion Validation *************************"
        )
        self.IG = IngestPage(self.driver)
        self.driver.find_element_by_xpath(
            "//label[contains(text(),' Load to existing table ')]").click()
        time.sleep(3)
        self.IG.setSchemaName("Sandbox")
        time.sleep(2)
        self.IG.setTableName("FileToTable")
        time.sleep(5)
        self.IG.clickReviewandConvert()
        time.sleep(10)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Datasets ')]").click()
        time.sleep(5)

        element = self.driver.find_element_by_xpath(
            "//div[@title='File2Table']")
        print(element.text)
        if element.text == "File2Table":
            assert True
            self.driver.close()
            self.logger.info(
                "***************************ConvertToTable Ingest Passed *************************"
            )
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_ConvertToTable.png")
            self.driver.close()
            self.logger.error(
                "***************************ConvertToTable Ingestion Failed *************************"
            )
            assert False

    def test_Ingest_ConvertToTable_IncrementalLoad(self, setup):
        self.logger.info(
            "***************************Test_002_Ingest*************************"
        )
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "***************************ConvertToTable_IncrementalLoad Validation **********************"
        )
        # selecting file from files module to convert into table
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='marks_new']").click()
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "//img[@title='Convert to table']").click()
        time.sleep(8)
        self.IG = IngestPage(self.driver)
        self.IG.setSchemaName("Sandbox")
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "//input[@name='tableName']").send_keys("Incremental Load 20")
        time.sleep(2)
        self.IG.setLoadType("Incremental Load")
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/footer/div[2]/div/label").click(
            )
        time.sleep(2)
        self.IG.clickReviewandConvert()
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "/html/body/div[3]/div/div/div/div/span")

        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/div/div/div/div/div/div/table/thead/tr[1]/th[1]/div/div[1]/div[2]/label"
        ).click()
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/div/div/div/div/div/div/table/thead/tr[1]/th[2]/div/div[1]/div[2]/label"
        ).click()
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/div/div/div/div/div/div/table/thead/tr[1]/th[3]/div/div[1]/div[2]/label"
        ).click()
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/div/div/div/div/div/div/table/thead/tr[1]/th[5]/div/div[1]/div[2]/label"
        ).click()
        time.sleep(5)
        self.IG.clickReviewandConvert()
        time.sleep(10)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Datasets ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath(
            "//div[@title='Incremental Load 20']")
        print(element.text)
        if element.text == "Incremental Load 20":
            assert True
            self.driver.close()
            self.logger.info(
                "***************************Incremental Load Passed *************************"
            )
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_IncrementalLoad.png")
            self.driver.close()
            self.logger.error(
                "***************************Incremental Load Failed *************************"
            )
            assert False

    def test_Ingest_SameTableName_Conversion(self, setup):
        self.logger.info(
            "***************************Test_002_Ingest*************************"
        )

        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "***************************Table Convertion Validation *************************"
        )
        # selecting file from files module to convert into table
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='marks_new']").click()
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "//img[@title='Convert to table']").click()
        time.sleep(8)
        self.IG = IngestPage(self.driver)
        self.IG.setSchemaName("Sandbox")
        time.sleep(5)
        self.driver.find_element_by_id("tableName").send_keys("FileToTable")
        time.sleep(2)
        self.IG.setLoadType("Complete Refresh")
        time.sleep(5)
        self.IG.clickReviewandConvert()
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//button[contains(text(),'Yes')]").click()
        self.logger.info(
            "***************************ReviewandConvert Passed *************************"
        )
        time.sleep(10)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Datasets ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath(
            "//div[@title='FileToTable']")
        print(element.text)
        if element.text == "FileToTable":
            assert True
            self.driver.close()
            self.logger.info(
                "***************************ConvertToTable Passed *************************"
            )
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_ConvertToTable.png")
            self.driver.close()
            self.logger.error(
                "***************************ConvertToTable Failed *************************"
            )
            assert False

    def test_Ingest_Datatype_Happypath(self, setup):
        self.logger.info(
            "***************************Test_002_Ingest*************************"
        )

        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "***************************Table Convertion Validation *************************"
        )
        # selecting file from files module to convert into table
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Files ')]").click()
        time.sleep(8)
        self.driver.find_element_by_xpath("//div[@title='DataType']").click()
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "//img[@title='Convert to table']").click()
        time.sleep(20)
        self.IG = IngestPage(self.driver)
        self.IG.setDatatypenvarchar("nvarchar")
        time.sleep(2)
        self.IG.setDatatypeInt_decimal("decimal")
        time.sleep(2)

        self.IG.setDatatypeDateTime("nvarchar")
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/div/div/div/div/div/div/table/thead/tr[1]/th[7]/div/div[1]/div[1]/label"
        ).click()
        time.sleep(2)
        self.IG.setSchemaName("Sandbox")
        time.sleep(5)
        self.driver.find_element_by_id("tableName").send_keys("DatatypeHappy")
        time.sleep(2)
        self.IG.setLoadType("Complete Refresh")
        time.sleep(5)
        self.IG.clickReviewandConvert()
        self.logger.info(
            "***************************ReviewandConvert Passed *************************"
        )
        time.sleep(10)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Datasets ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath(
            "//div[@title='DatatypeHappy']")
        print(element.text)
        if element.text == "DatatypeHappy":
            assert True
            self.driver.close()
            self.logger.info(
                "***************************Datatype Validations Passed *************************"
            )
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_Datatype Validations.png")
            self.driver.close()
            self.logger.error(
                "***************************Datatype Validations Failed *************************"
            )
            assert False

    def test_Ingest_Datatype_Alternate(self, setup):
        self.logger.info(
            "***************************Test_002_Ingest*************************"
        )

        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "***************************Table Convertion Validation *************************"
        )
        # selecting file from files module to convert into table
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Files ')]").click()
        time.sleep(8)
        self.driver.find_element_by_xpath("//div[@title='DataType']").click()
        time.sleep(2)
        time.sleep(2)
        self.driver.find_element_by_xpath(
            "//img[@title='Convert to table']").click()
        time.sleep(25)
        self.IG = IngestPage(self.driver)
        time.sleep(10)
        self.IG.setDatatypenvarchar("int")
        time.sleep(2)
        self.IG.setDatatypeInt_decimal("datetime")
        time.sleep(2)
        self.IG.setDatatypeDateTime("bigint")
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/div/div/div/div/div/div/table/thead/tr[1]/th[7]/div/div[1]/div[1]/label"
        ).click()
        time.sleep(2)
        self.IG.setSchemaName("Sandbox")
        time.sleep(5)
        self.driver.find_element_by_id("tableName").send_keys(
            "DatatypeAlternate")
        time.sleep(2)
        self.IG.setLoadType("Complete Refresh")
        time.sleep(5)
        self.IG.clickReviewandConvert()
        time.sleep(5)
        element = self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/footer/div[4]/div")
        print(element.text)
        time.sleep(5)
        self.IG.setDatatypenvarchar("nvarchar")
        time.sleep(2)
        self.IG.setDatatypeInt_decimal("decimal")
        time.sleep(2)

        self.IG.setDatatypeDateTime("nvarchar")
        time.sleep(5)
        self.IG.clickReviewandConvert()

        self.logger.info(
            "***************************ReviewandConvert Passed *************************"
        )
        time.sleep(10)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Datasets ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath(
            "//div[@title='DatatypeAlternate']")
        print(element.text)
        if element.text == "DatatypeAlternate":
            assert True
            self.driver.close()
            self.logger.info(
                "***************************Datatype Validations Passed *************************"
            )
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_Datatype Validations.png")
            self.driver.close()
            self.logger.error(
                "***************************Datatype Validations Failed *************************"
            )
            assert False

    def test_Ingest_Delete(self, setup):
        self.logger.info(
            "***************************Test_002_Ingest*************************"
        )
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info(
            "*************************** File Delete Validation *************************"
        )
        # Delete
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='marks_new']").click()
        time.sleep(2)
        self.driver.find_element_by_xpath("//img[@alt='Delete']").click()
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "//button[contains(text(),'Delete')]").click()
Esempio n. 22
0
class Test_001_Login:
    baseURL = readconfig.getURL()
    username = readconfig.getuseremail()
    password = readconfig.getuserpassword()
    # baseURL = "https://admin-demo.nopcommerce.com"
    # username = "******"
    # password = "******"

    logger = LogGen.loggen()

    @pytest.mark.regression
    @allure.severity(allure.severity_level.MINOR)
    def test_homepageTitle(self, setup):
        self.logger.info("******** Test_001 Login ******")
        self.logger.info("******* Verifying home page title ********")
        # self.driver=webdriver.Chrome()
        self.driver = setup
        self.driver.get(self.baseURL)
        act_title = self.driver.title
        if act_title == "Your store. Login":
            assert True
            self.driver.close()
            self.logger.info(
                "********* home page title test is passed ********")

        else:
            allure.attach(self.driver.get_screenshot_as_png(),
                          name="testhomepagetitle",
                          attachment_type=AttachmentType.PNG)
            self.driver.close()
            self.logger.error("***** home page title test is failed ******")

            assert False

    @pytest.mark.sanity
    @pytest.mark.regression
    @allure.severity(allure.severity_level.BLOCKER)
    def test_login(self, setup):
        self.logger.info("********** Verifying Login test ***********")

        self.driver = setup
        self.driver.get(self.baseURL)
        # now need to create object of ba
        # se class (means we call the Login)
        self.lp = Login(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 administration13":
            assert True
            self.driver.close()
            self.logger.info("****** Login test is passed ******")

        else:
            # self.driver.save_screenshot(".\\Screenshots\\" + "test_login.png")
            allure.attach(self.driver.get_screenshot_as_png(),
                          name="testloginpage",
                          attachment_type=AttachmentType.PNG)

            self.driver.close()
            self.logger.error("********* Login test is failed **********")

            assert False
class Test_002_Ingest:
    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_Ingest_CSV(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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("***************************CSV File Ingestion *************************")
        time.sleep(5)
        self.IG = IngestPage(self.driver)
        self.IG.clickIngest()
        self.driver.find_element_by_xpath("//input[@type='file']").send_keys(
            "C:\\Users\\sonup\\PycharmProjects\\Project\\TestData\\marks_new.csv")
        time.sleep(2)
        self.IG.setDelimiter("Comma")
        time.sleep(3)
        self.driver.find_element_by_xpath("//button[contains(text(),'Ingest')]").click()
        time.sleep(5)
        self.logger.info("***************************CSV File Validation *************************")
        self.lp.clickDatsets()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(2)
        element = self.driver.find_element_by_xpath("//div[contains(text(),'marks_new')]")
        print(element.text)
        if element.text == "marks_new":
            assert True
            self.driver.close()
            self.logger.info("***************************CSV File Ingest Passed *************************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_CSV_File.png")
            self.driver.close()
            self.logger.error("***************************CSV File Ingestion Failed *************************")
            assert False

    def test_Ingest_TXT(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(10)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("***************************TXT File Ingest  *************************")
        time.sleep(5)
        self.IG = IngestPage(self.driver)
        self.IG.clickIngest()
        self.driver.find_element_by_xpath("//input[@type='file']").send_keys(
            "C:\\Users\\sonup\\PycharmProjects\\Project\\TestData\\Test_Uat_Tab.txt")
        time.sleep(2)
        self.IG.setDelimiter("Tab")
        time.sleep(3)
        self.driver.find_element_by_xpath("//button[contains(text(),'Ingest')]").click()
        time.sleep(5)
        self.logger.info("***************************TXT File Validation *************************")
        self.lp.clickDatsets()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath("//div[contains(text(),'Test_Uat_Tab')]")
        print(element.text)
        if element.text == "Test_Uat_Tab":
            assert True
            self.driver.close()
            self.logger.info("***************************TXT File Ingest Passed *************************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_TXT_File.png")
            self.driver.close()
            self.logger.error("***************************TXT File Ingestion Failed *************************")
            assert False

    def test_Ingest_Existing(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")

        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(10)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("***************************Existing File Ingestion *************************")
        time.sleep(5)
        self.IG = IngestPage(self.driver)
        self.IG.clickIngest()
        self.driver.find_element_by_xpath("//input[@type='file']").send_keys(
            "C:\\Users\\sonup\\PycharmProjects\\Project\\TestData\\marks_new.csv")
        time.sleep(3)
        self.IG.setDelimiter("Comma")
        time.sleep(3)

        self.driver.find_element_by_xpath("//button[contains(text(),'Ingest')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/div/div/div/div/div/div[2]/div/div[2]/div[2]/button").click()
        time.sleep(5)
        self.logger.info("***************************Existing File Validation *************************")
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(2)
        element = self.driver.find_element_by_xpath("//div[contains(text(),'marks_new')]")
        print(element.text)
        if element.text == "marks_new":
            assert True
            self.driver.close()
            self.logger.info("***************************Existing File Ingest Passed *************************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_Existing_File.png")
            self.driver.close()
            self.logger.error("***************************Existing File Ingestion Failed *************************")
            assert False

    def test_Ingest_Filesize_Exceed(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(10)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("*************************** File Size Exceed Validation *************************")
        time.sleep(5)
        self.IG = IngestPage(self.driver)
        self.IG.clickIngest()
        self.driver.find_element_by_xpath("//input[@type='file']").send_keys(
            "C:\\Users\\sonup\\PycharmProjects\\Project\\TestData\\SizeExceed.csv")
        time.sleep(2)
        # Validation of File exceed
        element = self.driver.find_element_by_xpath("/html/body/div[3]/div/div/div/div/span")
        print(element.text)
        if element.text == "The file size must not exceed 15MB and must be of one of the file extensions - csv,txt,xls,xlsx":
            assert True
            self.driver.close()
            self.logger.info("***************************File Exceed Passed *************************")
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_File_Exceed.png")
            self.driver.close()
            self.logger.error("***************************File ExceedFailed *************************")
            assert False

    def test_Ingest_PreviewAll(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("***************************File Preview Validation *************************")
        # file is present in datalake or not
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='marks_new']").click()
        time.sleep(2)
        self.driver.find_element_by_xpath("//img[@title='View all']").click()
        time.sleep(5)
        # Validation Preview All
        # Analyze Path Validation
        element = self.driver.find_element_by_xpath("//div[@class='object-name d-inline-block']")
        print(element.text)
        if element.text == "marks_new":
            assert True
            self.driver.close()
            self.logger.info("***************************File Preview Passed *************************")

        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_File_Preiview.png")
            self.driver.close()
            self.logger.error("***************************File Preview Failed *************************")
            assert False

    def test_Ingest_Download(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("***************************File Download Validation *************************")
        # Download
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='marks_new']").click()
        time.sleep(2)
        self.driver.find_element_by_xpath("//img[@title='Download']").click()
        time.sleep(5)
        # Validation Download
        element = self.driver.find_element_by_xpath("/html/body/div[2]/div/div/div/div/span")
        print(element.text)
        if element.text == "Downloaded Successfully":
            assert True
            self.driver.close()
            self.logger.info("***************************File Downloaded Successfully *************************")

        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_File_Download.png")
            self.driver.close()
            self.logger.error("***************************File Download is Failed *************************")
            assert False

    def test_Ingest_Copy(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("***************************File Copy Validation *************************")
        # Copy
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[@title='marks_new']").click()
        time.sleep(5)

        self.driver.find_element_by_xpath("//img[@title='Copy']").click()
        time.sleep(2)
        self.driver.find_element_by_id("toFileName").send_keys("FileCopied")
        time.sleep(2)
        self.driver.find_element_by_xpath("//button[contains(text(),'Copy')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath("//div[@title='FileCopied']")
        print(element.text)
        if element.text == "FileCopied":
            assert True
            self.driver.close()
            self.logger.info("***************************CSV File Ingest Passed *************************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_CSV_Failed.png")
            self.driver.close()
            self.logger.error("***************************CSV File Ingestion Failed *************************")
            assert False

    def test_Ingest_Database1(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(10)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("***************************DataBase Validation *************************")
        time.sleep(5)
        self.IG = IngestPage(self.driver)
        self.IG.clickIngest()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),'Databases ')]").click()
        # time.sleep(15)
        self.IG.setDatabases("Azure SQL Database")
        time.sleep(5)
        self.IG.setServer(self.server)
        time.sleep(2)
        self.IG.setPortNumber(self.portnumber)
        time.sleep(2)
        self.IG.setDatabaseName(self.Database)
        time.sleep(2)
        self.IG.setUser(self.user)
        time.sleep(2)
        self.IG.setPwd(self.pwd)
        time.sleep(2)
        self.IG.clickConnect()
        time.sleep(10)
        self.IG.setSourceSchema("IncorpTax")
        time.sleep(3)
        self.IG.setSourceTable("ti_dim_accountlets")
        time.sleep(3)
        self.IG.setTargetSchema("Sandbox")
        time.sleep(3)
        self.driver.find_element_by_id("target-table").send_keys("Accts")
        time.sleep(3)
        self.driver.find_element_by_xpath("//button[contains(text(),'Ingest')]").click()
        time.sleep(10)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Datasets ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath("//div[@title='Accts']")
        print(element.text)
        if element.text == "Accts":
            assert True
            self.driver.close()
            self.logger.info("***************************CSV File Ingest Passed *************************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_CSV_Failed.png")
            self.driver.close()
            self.logger.error("***************************CSV File Ingestion Failed *************************")
            assert False

    def test_Ingest_Database_Existing(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(3)
        self.lp.setPassword(self.password)
        self.lp.clickPswdSignIn()
        time.sleep(3)
        self.lp.clickYes()
        time.sleep(3)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        time.sleep(10)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("***************************DataBase Existing Validation *************************")
        time.sleep(5)
        self.IG = IngestPage(self.driver)
        self.IG.clickIngest()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),'Databases ')]").click()
        # time.sleep(15)
        self.IG.setDatabases("Azure SQL Database")
        time.sleep(5)
        self.IG.setServer(self.server)
        time.sleep(2)
        self.IG.setPortNumber(self.portnumber)
        time.sleep(2)
        self.IG.setDatabaseName(self.Database)
        time.sleep(2)
        self.IG.setUser(self.user)
        time.sleep(2)
        self.IG.setPwd(self.pwd)
        time.sleep(2)
        self.IG.clickConnect()
        time.sleep(8)
        self.IG.setSourceSchema("IncorpTax")
        time.sleep(3)
        self.IG.setSourceTable("ti_dim_accountlets")
        time.sleep(3)
        self.IG.setTargetSchema("Sandbox")
        time.sleep(3)
        self.driver.find_element_by_id("target-table").send_keys("Accts")
        time.sleep(5)
        self.driver.find_element_by_xpath("//button[contains(text(),'Ingest')]").click()
        time.sleep(10)
        self.driver.find_element_by_xpath(
            "/html/body/div[2]/div[1]/div/div/div/div/div/div/span/form/div/div[2]/div/div[4]/div[2]/button").click()
        time.sleep(10)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Datasets ')]").click()
        time.sleep(5)
        element = self.driver.find_element_by_xpath("//div[@title='Accts']")
        print(element.text)
        if element.text == "Accts":
            assert True
            self.driver.close()
            self.logger.info("***************************CSV File Ingest Passed *************************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_CSV_Failed.png")
            self.driver.close()
            self.logger.error("***************************CSV File Ingestion Failed *************************")
            assert False

    def test_Ingest_MultipleFiles(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(10)
        self.lp.ClickSearch()
        self.logger.info("***************************CSV File Ingestion *************************")
        time.sleep(5)
        self.IG = IngestPage(self.driver)
        self.IG.clickIngest()
        time.sleep(5)
        self.driver.find_element_by_xpath("//input[@type='file']").send_keys(
            "C:\\Users\\sonup\\PycharmProjects\\Project\\TestData\\marks_new.csv")

        time.sleep(3)
        self.driver.find_element_by_xpath("//input[@type='file']").send_keys(
            "C:\\Users\\sonup\\PycharmProjects\\Project\\TestData\\Students-Pipe.txt")
        time.sleep(3)
        self.driver.find_element_by_xpath("//input[@type='file']").send_keys(
            "C:\\Users\\sonup\\PycharmProjects\\Project\\TestData\\Students-Comma.csv")
        self.IG.setDelimiter("Comma")
        time.sleep(3)
        self.IG.setDelimiter1("Comma")
        time.sleep(5)
        self.IG.setDelimiter2("Comma")
        time.sleep(5)
        self.driver.find_element_by_xpath("//button[contains(text(),'Ingest')]").click()
        time.sleep(10)
        self.driver.find_element_by_xpath("//button[contains(text(),'Yes')]").click();

        self.logger.info("***************************Multiple Files Ingestion Validation*************************")
        time.sleep(5)
        self.driver.find_element_by_xpath("//div[contains(text(),' Files ')]").click()
        time.sleep(2)
        element = self.driver.find_element_by_xpath("//div[@title='marks_new']")
        print(element.text)
        if element.text == "marks_new":
            assert True
            self.driver.close()
            self.logger.info("***************************Multiple Files Ingest Passed *************************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_CSV_Failed.png")
            self.driver.close()
            self.logger.error("***************************Multiple Files Ingestion Failed *************************")
            assert False

    def test_UnSupportedFiles(self, setup):
        self.logger.info("***************************Test_002_Ingest*************************")
        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(5)
        self.lp.clickSignIn()
        time.sleep(15)
        self.lp.ClickSearch()
        self.logger.info("***************************CSV File Ingestion *************************")
        time.sleep(5)
        self.IG = IngestPage(self.driver)
        self.IG.clickIngest()
        self.driver.find_element_by_xpath("//input[@type='file']").send_keys(
            "C:\\Users\\sonup\\PycharmProjects\\Project\\TestData\\marks_new (4).CSV")
        time.sleep(2)
        self.IG.setDelimiter("Comma")
        time.sleep(3)
        self.driver.find_element_by_xpath("//button[contains(text(),'Ingest')]").click()
        time.sleep(10)
        self.logger.info(
            "***************************File name should not contain special charecters Validation*************************")

        element = self.driver.find_element_by_xpath("/html/body/div[2]/div[1]/div/div/div/div/div/div/div/div[2]/div/div[2]/div")

        print(element.text)

        if element.text == "Filename contains special characters ()":
            assert True
            self.driver.close()
            self.logger.info("***************************Unsupported file Passed *************************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" + "test_UnsupportedFile.png")
            self.driver.close()
            self.logger.error("***************************Unsupported File Ingestion Failed *************************")
            assert False
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")
Esempio n. 25
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_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 **********")
Esempio n. 27
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****************")
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
Esempio n. 29
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_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 ***")