def test_login(self):
        lp = LoginPage(self.driver)
        #lp.clickSignIn()

        lp.setUserName(self.username)
        lp.clickNext()
        time.sleep(5)

        lp.setPassword(self.password)
        lp.clickPswdSignIn()
        time.sleep(5)
        lp.clickYes()
        time.sleep(5)
        self.driver.get("https://tiplatform-uat.azurewebsites.net/")
        lp.clickSignIn()
        time.sleep(10)
        self.driver.find_element_by_xpath("//button[@type='submit']").click()
        self.assertEqual("Tesser Pro", self.driver.title, "not matched title")
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")
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
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_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()