예제 #1
0
class Test_002_Home:
    baseURL = ReadConfig.getURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getPassword()
    logger = LogGenenration.loggen()

    @pytest.mark.sanity
    def test_leave(self, setup):
        self.logger.info("************* Test_002_Home ******************")
        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.submit()
        self.logger.info("*********Login successfull *********")

        homePage = HomePage(self.driver)
        homePage.selectLeave()

        homePage.setFromDate()
        homePage.selectFromMonth(ReadConfig.getFromMonth())
        homePage.selectFromYear(ReadConfig.getFromYear())
        homePage.selectFromDate(ReadConfig.getFromDate())

        homePage.setToDate()
        homePage.selectToMonth(ReadConfig.getToMonth())
        homePage.selectToYear(ReadConfig.getToYear())
        homePage.selectToDate(ReadConfig.getToDate())
        homePage.selectRejectedLeaves()
        homePage.selectUnit(ReadConfig.getUnit())
        homePage.search()

        self.driver.quit()
예제 #2
0
class Test_001_login:
    baseURL = ReadConfig.getURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getPassword()
    logger = LogGenenration.loggen()

    @pytest.mark.regression
    def test_login(self, setup):
        self.logger.info(".................Test_001_home...........")
        self.logger.info("..........Verifying login............")
        self.driver = setup
        self.driver.get(self.baseURL)
        loginPage = LoginPage(self.driver)

        loginPage.setUsername(self.username)
        loginPage.setPassword(self.password)
        loginPage.submit()
        user = loginPage.getUser()
        print("user is.........." + user)
        if user == "Welcome haresh":
            self.logger.info("........Successfully logged in..............")
            assert True
            self.driver.close()
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_login.png")
            self.logger.error("............login failed..............")
            self.driver.close()
            assert False