Esempio n. 1
0
class Test_001_Login:
    logger=LogGen.loggen()
    baseUrl=configure.getUrl()
    company=configure.getCompany()
    username=configure.getUsername()

    @pytest.mark.function
    def test_homePageTitle(self,setup):
        self.logger.info("**********Begin testcase: Test for good logging***********")
        self.driver=setup

        self.logger.info("Go to Treasury page")
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp=Login(self.driver)
        self.logger.info("Enter company name:")
        self.lp.setCompany(self.company)
        #time.sleep(2)
        self.logger.info("Enter username:"******"Click Login button:")
        self.lp.clickLogin()
        #time.sleep(1)
        if self.driver.title=="Trace & Treasury":
            self.logger.info("Goed loging")
            assert True,"Succesfully Login Tresury"
            self.driver.quit()
        else:
            self.logger.info("Wrong username or companyname")
            self.driver.quit()
            assert False,"Wrong CompanyName or UserName"
class Test_002_Leningen:
    baseUrl = configure.getUrl()
    company = configure.getCompany()
    username = configure.getUsername()
    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_NoRealtie(self, setup):
        self.logger.info(
            "********************Testcase 002: Enter wrong relatie in the lening form****************"
        )
        self.driver = setup
        self.logger.info("Go to Treasury page")
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp = Login(self.driver)
        self.logger.info("Enter company name")
        self.lp.setCompany(self.company)
        # time.sleep(2)
        self.logger.info("Enter username")
        self.lp.setUsername(self.username)
        # time.sleep(1)
        self.logger.info("Click Login button")
        self.lp.clickLogin()
        time.sleep(1)
        self.len = Leningen(self.driver)
        self.logger.info("Click menu Financiële instrumenten")
        self.len.clickMenuFinanInstrumenten()
        time.sleep(3)
        self.logger.info("Choice Leningen item")
        self.len.clickMenuitemLeningen()
        time.sleep(2)
        self.logger.info("click Nieuws button to add a new leningen")
        self.len.clickNieuws()
        time.sleep(2)
        self.logger.info("Go to popup screen to choice a soort from leningen")
        self.logger.info("Click item leningen")
        self.len.clickItemDrop("leningen")
        time.sleep(2)
        self.logger.info("Click Ok button")
        self.len.clickOk()
        time.sleep(5)
        self.logger.info("Fulling lening screen")
        self.logger.info("Choice Leningen item")
        self.len.clickLeningItem("Leningen")
        self.logger.info("Generate number from lening")
        self.len.click_Geneer()
        self.logger.info("Enter amount")
        self.len.set_NominaleWaarde(10000)
        self.logger.info("Click dropdown list Relaties ")
        self.len.click_RealtieExpand()
        time.sleep(3)
        self.logger.info(
            "Search relatie 10, this number actually doesn't exists in database"
        )
        number = self.len.set_RealatieNumber('10')
        # time.sleep(4)
        val = self.len.get_NoRelatie()
        self.logger.info("Validate fault message")
        if val == "Er zijn geen resultaten gevonden.":
            self.logger.info("There are no number in database")
            assert True
            self.driver.quit()
        else:
            self.logger.info("The number exists")
            self.driver.quit()
            assert False

    @pytest.mark.regression
    def test_CheckRelatie(self, setup):
        self.logger.info(
            "********************Testcase 003: Enter a goed relatie number in the lening form****************"
        )
        self.driver = setup
        self.logger.info("Go to Treasury page")
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp = Login(self.driver)
        self.logger.info("Enter company name")
        self.lp.setCompany(self.company)
        # time.sleep(2)
        self.logger.info("Enter username")
        self.lp.setUsername(self.username)
        # time.sleep(1)
        self.logger.info("Click Login button")
        self.lp.clickLogin()
        time.sleep(1)
        self.len = Leningen(self.driver)
        self.logger.info("Click menu Financiële instrumenten")
        self.len.clickMenuFinanInstrumenten()
        time.sleep(3)
        self.logger.info("Choice Leningen item")
        self.len.clickMenuitemLeningen()
        time.sleep(2)
        self.logger.info("click Nieuws button to add a new leningen")
        self.len.clickNieuws()
        time.sleep(2)
        self.logger.info("Go to popup screen to choice a soort from leningen")
        self.logger.info("Click item leningen")
        self.len.clickItemDrop("leningen")
        time.sleep(2)
        self.logger.info("Click Ok button")
        self.len.clickOk()
        time.sleep(5)
        self.logger.info("Fulling lening screen")
        self.logger.info("Choice Leningen item")
        self.len.clickLeningItem("Leningen")
        self.logger.info("Generate number from lening")
        self.len.click_Geneer()
        self.logger.info("Enter amount")
        self.len.set_NominaleWaarde(10000)
        self.logger.info("Click dropdown list Relaties ")
        self.len.click_RealtieExpand()
        time.sleep(3)
        self.logger.info("Search relatie")
        number = self.len.set_RealatieNumber('2')
        time.sleep(4)
        val = self.len.get_1stCel()
        self.logger.info(
            "Validate the information from relation in the first row")
        if number == val:
            self.logger.info(
                "The number exists, and the infomation in the first row")
            self.len.click_1stCel()
            assert True
            self.driver.quit()
        else:
            self.logger.info("There are no number in database")
            self.driver.quit()
            assert False

    @pytest.mark.function
    def test_AllGoodFulling(self, setup):
        self.logger.info(
            "********************Testcase 004: If all required velds are entered, validate message****************"
        )
        self.driver = setup
        self.logger.info("Go to Treasury page")
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp = Login(self.driver)
        self.logger.info("Enter company name")
        self.lp.setCompany(self.company)
        # time.sleep(2)
        self.logger.info("Enter username")
        self.lp.setUsername(self.username)
        # time.sleep(1)
        self.logger.info("Click Login button")
        self.lp.clickLogin()
        time.sleep(1)
        self.len = Leningen(self.driver)
        self.logger.info("Click menu Financiële instrumenten")
        self.len.clickMenuFinanInstrumenten()
        time.sleep(3)
        self.logger.info("Choice Leningen item")
        self.len.clickMenuitemLeningen()
        time.sleep(2)
        self.logger.info("click Nieuws button to add a new leningen")
        self.len.clickNieuws()
        time.sleep(2)
        self.logger.info("Go to popup screen to choice a soort from leningen")
        self.logger.info("Click item leningen")
        self.len.clickItemDrop("leningen")
        time.sleep(2)
        self.logger.info("Click Ok button")
        self.len.clickOk()
        # Fulling
        self.logger.info("Fulling lening screen")
        self.logger.info("Choice Leningen item")
        time.sleep(5)
        self.len.clickLeningItem("Leningen")
        self.logger.info("Generate number from lening")
        self.len.click_Geneer()
        self.logger.info("Enter amount")
        self.len.set_NominaleWaarde(10000)
        self.logger.info("Click dropdown list Relaties ")
        self.len.click_RealtieExpand()
        time.sleep(3)
        self.logger.info("Search relatie 2")
        number = self.len.set_RealatieNumber('2')
        time.sleep(4)
        self.logger.info("The number exists en click on 1st row")
        self.len.click_1stCel()
        self.logger.info("Enter start date")
        self.len.setStartDate('25-8-2020')
        self.len.clickSluiten()
        self.logger.info("Enter the Looptijd")
        self.len.set_Looptijd(10)
        self.len.click_Opslaan()
        time.sleep(20)
        self.logger.info(
            "Validate Eén of meerdere waarden zijn automatisch ingevuld. Controleer a.u.b. "
        )
        self.logger.info(
            "deze waarden en indien deze waarden correct zijn klik nogmaals op opslaan."
        )
        bol = self.len.get_WarningAutoIngevuld()
        if bol:
            self.logger.info("Good message is available")
            assert bol, 'Click Opslaan'
            self.driver.quit()
        # assert bolean,"Goed test"
        # if str=="Eén of meerdere waarden zijn automatisch ingevuld. Controleer a.u.b. deze waarden en indien deze waarden correct zijn klik nogmaals op opslaan.":
        #    self.len.click_Opslaan()

    @pytest.mark.regression
    def test_WrongDateFormat(self, setup):
        self.driver = setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp = Login(self.driver)
        self.lp.setCompany(self.company)
        # time.sleep(2)
        self.lp.setUsername(self.username)
        # time.sleep(1)
        self.lp.clickLogin()
        time.sleep(3)
        self.len = Leningen(self.driver)
        # self.len = Leningen(self.driver)
        self.len.clickMenuFinanInstrumenten()
        # time.sleep(3)
        self.len.clickMenuitemLeningen()
        # time.sleep(2)
        self.logger.info("click Nieuws button to add a new leningen")
        self.len.clickNieuws()
        self.logger.info("Go to popup screen to choice a soort from leningen")
        self.logger.info("Click item leningen")
        self.len.clickItemDrop("leningen")
        self.logger.info("Click Ok button")
        time.sleep(2)
        self.len.clickOk()
        path = "D:\Python Projects\TreasuryProject\TestData\LenWrongDateFormat.xlsx"
        workbook = openpyxl.load_workbook(path)
        sheet1 = workbook.get_sheet_by_name("Blad1")
        self.logger.info("Fulling lening screen")
        self.logger.info("Choice Leningen item")
        self.len.clickLeningItem(sheet1.cell(2, 1).value)
        self.logger.info("Generate number from lening")
        if sheet1.cell(2, 2).value == None:
            self.len.click_Geneer()
        self.logger.info("Enter amount")
        self.len.set_NominaleWaarde(sheet1.cell(2, 3).value)
        self.logger.info("Click dropdown list Relaties ")
        self.len.click_RealtieExpand()
        time.sleep(3)
        self.logger.info("Search relatie")
        number = self.len.set_RealatieNumber(sheet1.cell(2, 3).value)
        time.sleep(3)
        self.logger.info("The number exists en click on 1st row")
        self.len.click_1stCel()
        self.logger.info("Enter start date")
        self.len.setStartDate(sheet1.cell(2, 4).value)
        self.len.clickSluiten()
        self.logger.info("Enter the Looptijd")
        self.len.set_Looptijd(10)
        self.len.click_Opslaan()
        time.sleep(20)
        self.logger.info("Bevestig message")
        bol = self.len.get_WarningDateForm()
        if bol:
            assert bol, 'Niet goed ingangsdatum'
            self.driver.quit()
Esempio n. 3
0
class Test_002_Leningen:
    baseUrl = configure.getUrl()
    company = configure.getCompany()
    username = configure.getUsername()

    def test_NoRealtie(self, setup):
        self.driver = setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp = Login(self.driver)
        self.lp.setCompany(self.company)
        # time.sleep(2)
        self.lp.setUsername(self.username)
        # time.sleep(1)
        self.lp.clickLogin()
        time.sleep(1)
        self.len = Leningen(self.driver)
        self.len.clickMenuFinanInstrumenten()
        time.sleep(3)
        self.len.clickMenuitemLeningen()
        time.sleep(2)
        self.len.clickNieuws()
        time.sleep(2)
        self.len.clickItemDrop("leningen")
        time.sleep(2)
        self.len.clickOk()
        time.sleep(5)
        self.len.clickLeningItem("Leningen")
        self.len.click_Geneer()
        self.len.set_NominaleWaarde(10000)
        self.len.click_RealtieExpand()
        time.sleep(3)
        number = self.len.set_RealatieNumber('10')
        # time.sleep(4)
        val = self.len.get_NoRelatie()
        if val == "Er zijn geen resultaten gevonden.":
            # self.len.click_1stCel()
            assert True
            self.driver.quit()
        else:
            self.driver.quit()
            assert False

    def test_CheckRelatie(self, setup):
        self.driver = setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp = Login(self.driver)
        self.lp.setCompany(self.company)
        # time.sleep(2)
        self.lp.setUsername(self.username)
        # time.sleep(1)
        self.lp.clickLogin()
        time.sleep(1)
        self.len = Leningen(self.driver)
        self.len.clickMenuFinanInstrumenten()
        time.sleep(3)
        self.len.clickMenuitemLeningen()
        time.sleep(2)
        self.len.clickNieuws()
        time.sleep(2)
        self.len.clickItemDrop("leningen")
        time.sleep(2)
        self.len.clickOk()
        time.sleep(5)
        self.len.clickLeningItem("Leningen")
        self.len.click_Geneer()
        self.len.set_NominaleWaarde(10000)
        self.len.click_RealtieExpand()
        time.sleep(3)
        number = self.len.set_RealatieNumber('2')
        time.sleep(4)
        val = self.len.get_1stCel()
        if number == val:
            self.len.click_1stCel()
            assert True
            self.driver.quit()
        else:
            # print(mes)
            self.driver.quit()
            assert False

    def test_AllGoodFulling(self, setup):
        self.driver = setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp = Login(self.driver)
        self.lp.setCompany(self.company)
        # time.sleep(2)
        self.lp.setUsername(self.username)
        # time.sleep(1)
        self.lp.clickLogin()
        time.sleep(1)
        self.len = Leningen(self.driver)
        self.len.clickMenuFinanInstrumenten()
        time.sleep(3)
        self.len.clickMenuitemLeningen()
        time.sleep(2)
        self.len.clickNieuws()
        time.sleep(2)
        self.len.clickItemDrop("leningen")
        time.sleep(2)
        self.len.clickOk()
        # Fulling
        time.sleep(5)
        self.len.clickLeningItem("Leningen")
        self.len.click_Geneer()
        self.len.set_NominaleWaarde(10000)
        self.len.click_RealtieExpand()
        time.sleep(3)
        number = self.len.set_RealatieNumber('2')
        time.sleep(4)
        self.len.click_1stCel()
        self.len.setStartDate('25-8-2020')
        self.len.clickSluiten()
        self.len.set_Looptijd(10)
        self.len.click_Opslaan()
        time.sleep(20)
        bol = self.len.get_WarningAutoIngevuld()
        if bol:
            assert bol, 'Click Opslaan'
            self.driver.quit()
        # assert bolean,"Goed test"
        # if str=="Eén of meerdere waarden zijn automatisch ingevuld. Controleer a.u.b. deze waarden en indien deze waarden correct zijn klik nogmaals op opslaan.":
        #    self.len.click_Opslaan()

    def test_WrongDateFormat(self, setup):
        self.driver = setup
        self.driver.get(self.baseUrl)
        self.driver.maximize_window()
        self.lp = Login(self.driver)
        self.lp.setCompany(self.company)
        # time.sleep(2)
        self.lp.setUsername(self.username)
        # time.sleep(1)
        self.lp.clickLogin()
        time.sleep(3)
        self.len = Leningen(self.driver)
        # self.len = Leningen(self.driver)
        self.len.clickMenuFinanInstrumenten()
        # time.sleep(3)
        self.len.clickMenuitemLeningen()
        # time.sleep(2)
        self.len.clickNieuws()
        self.len.clickItemDrop("leningen")

        time.sleep(2)
        self.len.clickOk()
        path = "D:\Python Projects\TreasuryProject\TestData\LenWrongDateFormat.xlsx"
        workbook = openpyxl.load_workbook(path)
        sheet1 = workbook.get_sheet_by_name("Blad1")
        self.len.clickLeningItem(sheet1.cell(2, 1).value)
        if sheet1.cell(2, 2).value == None:
            self.len.click_Geneer()
        self.len.set_NominaleWaarde(sheet1.cell(2, 3).value)
        self.len.click_RealtieExpand()
        time.sleep(3)
        number = self.len.set_RealatieNumber(sheet1.cell(2, 3).value)
        time.sleep(3)
        self.len.click_1stCel()
        self.len.setStartDate(sheet1.cell(2, 4).value)
        self.len.clickSluiten()
        self.len.set_Looptijd(10)
        self.len.click_Opslaan()
        time.sleep(20)
        bol = self.len.get_WarningDateForm()
        if bol:
            assert bol, 'Niet goed ingangsdatum'
            self.driver.quit()