コード例 #1
0
class RegisterCoursesTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = Status(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        self.nav.navigateHome()

    @pytest.mark.run(order=1)
    #@data(("JavaScript for beginners","4143202652384595","1220","101"),("Learn Python 3 from scratch","41426543764387900","1221","303"))
    #you can provide with only with the file name without the path since it is saved under the project
    @data(
        *getCSVData("/Users/nhussein/PycharmProjects/Letskodeit/testdata.csv"))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCvv):
        self.courses.enterCourseName(courseName)
        self.courses.selectCourseToEnroll(courseName)
        self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCvv)
        time.sleep(5)
        #result = self.courses.verifyCardDecline()
        result = self.courses.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
コード例 #2
0
class CheckboxTest(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.check = CheckboxPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=1)
    # running tests for checkbox page and single checkbox feature
    def test_singleCheckbox(self):
        title = self.check.verifyTitle()
        self.ts.mark(title, "Verify page Title")
        message = self.check.verifySingleCheck()
        self.ts.mark(message, "Verify single check box is checked")
        message_removed = self.check.verfiySingleUncheck()
        self.ts.mark(message_removed, "Verify message removed on uncheck")

    @pytest.mark.run(order=2)
    #running test for uncheck of checkbox feature
    def test_uncheck(self):
        uncheck = self.check.verifyUncheckButton()
        self.ts.mark( uncheck, "Verify uncheck")

    @pytest.mark.run(order=3)
    #running test for check of checkbox feature
    def test_check(self):
        check = self.check.verifyCheckButton()
        self.ts.markFinal("test_check", check, "Verify check")
コード例 #3
0
class DatePickerTest(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.date = DatePickerPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=1)
    # running test for "Today's Date" feature in calendar picker
    def test_TodaysDate(self):
        title = self.date.verifyTitle()
        self.ts.mark(title, "Verify page Title")
        today = self.date.verifyTodaysDate()
        self.ts.mark(today, "Verify today's date button")

    @pytest.mark.run(order=2)
    # running test for "Clear" feature in calendar picker
    def test_ClearDate(self):
        clear = self.date.verfiyClearDate()
        self.ts.mark(clear, "Verify clear date")

    @pytest.mark.run(order=3)
    # running test for enter date feature in calendar picker
    def test_EnterDate(self):
        enter_date = self.date.verifyEnterDate()
        self.ts.mark(enter_date, "Verify manual enter")

    @pytest.mark.run(order=4)
    # running test for select date feature in calendar picker
    def test_SelectDate(self):
        date_select = self.date.verifySelectDate()
        self.ts.markFinal("testSelectDate", date_select, "Verify select date")
コード例 #4
0
class NavSmokeTests(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.tn = TopNav(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=1)
    def test_nav(self):
        self.tn.navigateAboutUs()
        result1 = self.tn.verifyAboutUs()
        self.ts.mark(result1, 'Verify Title for About Us Page')

        self.tn.navigateDirectSales()
        result2 = self.tn.verifyDirectSales()
        self.ts.mark(result2, 'Verify Title for Direct Sales page')

        self.tn.navigateProducts()
        result3 = self.tn.verifyProducts()
        self.ts.mark(result3, 'Verify Title for Products page')

        self.tn.navigateContactUs()
        result4 = self.tn.verifyContactUs()
        self.ts.mark(result4, 'Verify Title Contact Us page')

        self.tn.navigateRentalServices()
        result5 = self.tn.verifyRentalServices()
        self.ts.markFinal('test_nav', result5, 'Verify Title Rental Services')
コード例 #5
0
class LoginTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.ts = Status(self.driver)
        """
        Need to verify two verification points
        1 fails, code will not go to the next verification point
        If assert fails, it stops current test execution and moves to the next test method.
        """

    @pytest.mark.run(order=2)
    def test_validLogin(self):
        self.lp.login("*****@*****.**", "abcabc")
        result1 = self.lp.verifyTitle()
        self.ts.mark(result1, "Title Verified")
        result2 = self.lp.verifyLoginSuccessful()
        self.ts.markFinal("test_validLogin", result2, "Login was successful")

    @pytest.mark.run(order=1)
    def test_invalidLogin(self):
        time.sleep(3)
        self.lp.login("*****@*****.**", "abcabcabc")
        result = self.lp.verifyLoginFailed()
        self.ts.markFinal("test_invalidLogin", result,
                          "Login wasn't successful")

    @pytest.mark.run(order=3)
    def test_validlogout(self):
        self.lp.Logout()
        result = self.lp.verifySuccessfulLogout()
        self.ts.markFinal("test_validLogout", result, "Logout successful")
コード例 #6
0
ファイル: login_tests.py プロジェクト: nadim1975/Gportal
class LoginTests(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def classSetup(self,oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.ts = Status(self.driver)


    @pytest.mark.run(order=2)
    def test_validlogin(self):
        #print("######## execution of correct login")
        self.lp.login('portalaviation1', 'Welcome01')
        result1 = self.lp.verifyPageTitle("Global Portal")
        self.ts.mark(result1,'Title is correct')
        #self.lp.login('*****@*****.**','abcabc')
        result2 = self.lp.verifyLoginSuccessful()
        self.ts.mark(result2,"Login was successful")
        self.ts.markFinal("Validating Login",result2,"Login was successful")


    @pytest.mark.run(order = 1)
    def test_invalidlogin(self):
         # The class Setup fixture will open the URL the first time
        #print("**********   Execution of wrong login")
        self.lp.logout()
        self.lp.login('portalaviation1','wrong')
        #result1 = self.lp.checkLoginError("Sorry, we were not able to identify your information in our system. Please try again, or if you recently changed your username or email address, please call 1 888 939 4852 for assistance.")
        result = self.lp.verifyLoginFailure()
        self.ts.mark(result,"Checking Error Msg")
コード例 #7
0
ファイル: login_tests.py プロジェクト: nadim1975/Letskodeit
class LoginTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=2)
    def test_validlogin(self):
        #print("######## execution of correct login")
        self.lp.login('*****@*****.**', 'abcabc')
        result1 = self.lp.verifyLoginPageTitle("Let's Kode It")
        self.ts.mark(result1, 'Title is correct')
        #self.lp.login('*****@*****.**','abcabc')
        result2 = self.lp.verifyLoginSuccessful()
        self.ts.mark(result2, "Login was successful")
        self.ts.markFinal("Validating Login", result2, "Login was successful")

    @pytest.mark.run(order=1)
    def test_invalidlogin(self):
        # The class Setup fixture will open the URL the first time
        #print("**********   Execution of wrong login")
        self.lp.logout()
        self.lp.login('*****@*****.**', 'abc')
        result = self.lp.verifyLoginFailure()
        self.ts.mark(result, "Couldn't login with wrong userid/password")
コード例 #8
0
class RegisterCoursesTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=1)
    @data(("JavaScript"), ("Python 3"))
    #@unpack only needed for tupels in @data
    def test_invalidEnrollment(self, courseName):

        self.courses.enterCourse(courseName)
        result = self.courses.verifyUseAnotherShown()
        self.ts.markFinal("test_CreditCardOptionShown", result,
                          "Credit Card Window verification")
        self.courses.allCourses()
コード例 #9
0
class DropdownTest(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.drop = DropdownPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=1)
    # running test for dropdown feature, using a single select dropdown
    def test_SingleDrop(self):
        title = self.drop.verifyTitle()
        self.ts.mark(title, "Verify page Title")
        single_message = self.drop.verifySingleDrop()
        self.ts.markFinal("Dropdown Test", single_message, "Verify single select dropdown")

    """
コード例 #10
0
class LoginTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=2)
    def test_validLogin(self):
        self.lp.login("*****@*****.**", "abcabc")
        result1 = self.lp.verifyLoginTitle()
        self.ts.mark(result1, "Title Verification")
        result2 = self.lp.verifyLoginSuccessful()
        self.ts.markFinal("test_validLogin", result2, "Login Verification")

    @pytest.mark.run(order=1)
    def test_invalidLogin(self):
        self.lp.login("*****@*****.**", "abcabcabc")
        result = self.lp.verifyLoginFailed()
        assert result == True
コード例 #11
0
 def __init__(self, driver):
     """
     Inits BasePage class
     Returns:
         None
     """
     super(BasePage, self).__init__(driver)
     self.driver = driver
     self.util = Util()
     self.stat = Status(driver)
コード例 #12
0
class RequestFuelTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.so = CreateSalesOrderPage(self.driver)
        self.ts = Status(self.driver)
        self.db = DashboardPage(self.driver)

    def setUp(self):
        #if stuck in the request fuel window then close it
        self.so.clickCloseRequest()
        self.db.navigateHome()

    @pytest.mark.run(order=1)
    #@data(("JavaScript for beginners","4143202652384595","1220","101"),("Learn Python 3 from scratch","41426543764387900","1221","303"))
    #you can provide with only with the file name without the path since it is saved under the project
    #@data(*getCSVData("/Users/nhussein/PycharmProjects/Gportal/createSO_testdata.csv"))
    @data(*getCSVData("createSO_testdata.csv"))
    @unpack
    def test_validateSoCreation(self, icao, airportName, tailNumber,
                                nextDestination, quantity, flightNumber,
                                arrivalDate, arrivalHour, arrivalMin,
                                departureDate, departureHour, departureMin,
                                notes, email, fax, phone):

        self.so.enterICAO(icao, airportName)

        self.so.selectLocation()
        self.so.selectFBOSetup()

        self.so.enterSoInformation(tailNumber, nextDestination, quantity,
                                   flightNumber, arrivalDate, arrivalHour,
                                   arrivalMin, departureDate, departureHour,
                                   departureMin, notes, email, fax, phone)

        self.so.clickRequestFuel()
        # self.so.getQuoteNumber()
        # self.so.getSoNumber()
        result = self.so.verifySOcreated()
        self.ts.markFinal("test_SO_creation", result,
                          "SO Created Successfully")
コード例 #13
0
class LoginTests(unittest.TestCase, LoginPage):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.ts = Status(self.driver)

        """
        Need to verify two verification points
        1 fails, code will not go to the next verification point
        If assert fails, it stops current test execution and moves to the next test method.
        """

    @pytest.mark.run(order=1)
    @data(*getCVSData("/home/bilalikram/PycharmProjects/Automation_Framework/logincredentials.csv"))
    @unpack
    def test_invalidLogin(self, email, password):
        self.lp.logout()
        self.lp.login(email, password)
        result = self.lp.verifyLoginFailed1()
        self.ts.markFinal("test_invalidLogin", result, "Login wasn't successful")

    @pytest.mark.run(order=2)
    @data(*getCVSData("/home/bilalikram/PycharmProjects/Automation_Framework/validlogin.csv"))
    @unpack
    def test_validLogin(self, email, password):
        self.lp.login(email, password)
        result = self.lp.verifyLogin()
        self.ts.markFinal("test_validLogin", result, "Login was Successful")

    @pytest.mark.run(order=3)
    def test_validlogout(self):
        self.lp.logout()
        result = self.lp.verifyLogoutSuccess()
        self.ts.markFinal("test_validLogout", result, "Logout successful")
コード例 #14
0
class LoginTests(unittest.TestCase, LoginPage):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.ts = Status(self.driver)
        """
        Need to verify two verification points
        1 fails, code will not go to the next verification point
        If assert fails, it stops current test execution and moves to the next test method.
        """

    @pytest.mark.second
    @data(*getCVSData(
        "/home/bilalikram/PycharmProjects/Automation_Using_Database/loginPageXpath.csv"
    ))
    @unpack
    def test_second(self, email, login, _email, password, login2, _password,
                    login3, loginBtn, login6, logo):
        self.lp.invalidLogin(email, login, _email, password, login2, _password,
                             login3, loginBtn, login6, logo)

    @pytest.mark.last
    @data(*getCVSData(
        "/home/bilalikram/PycharmProjects/Automation_Using_Database/validlogin.csv"
    ))
    @unpack
    def test_third(self, email, login, _email, password, login2, _password,
                   login3, loginBtn, login4, vlogin):
        self.lp.validLogin(email, login, _email, password, login2, _password,
                           login3, loginBtn, login4, vlogin)

    @pytest.mark.first
    @data(*getCVSData(
        "/home/bilalikram/PycharmProjects/Automation_Using_Database/logout.csv"
    ))
    @unpack
    def test_one(self, login7, image, login8, logout, login9, forgot):
        self.lp.logout(login7, image, login8, logout)
        result = self.lp.verifyLogoutSuccess(login9, forgot)
        self.ts.markFinal("Test Valid Logout", result, "Logout successful")
コード例 #15
0
class FormsTest(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.forms = FormsPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run()
    # running test for navigation to page and inputting text into text box
    def test_message(self):
        self.forms.verifyTitle()
        title = self.forms.verifyTitle()
        self.ts.mark(title, "Verify page Title")
        message = self.forms.verifyMessageText()
        self.ts.mark(message, "Verify message entered in form box 1")

    @pytest.mark.run()
    # running test for sum from entries in a text box
    def test_total(self):
        total = self.forms.verifyTotal()
        self.ts.markFinal("test_total", total,
                          "Verify total entered in form box 2")
コード例 #16
0
 def classSetup(self, oneTimeSetUp):
     self.date = DatePickerPage(self.driver)
     self.ts = Status(self.driver)
コード例 #17
0
 def classSetup(self, oneTimeSetUp):
     self.drop = DropdownPage(self.driver)
     self.ts = Status(self.driver)
コード例 #18
0
    def run_All_testCase(self, testCaseJson, baseURL):

        wdf = WebDriverFactory(self.driver)
        if baseURL == '':
            self.log.error("Base URL not Inserted")
        self.driver = wdf.getWebDriverInstance(baseURL=baseURL)
        self.stat = Status(self.driver)
        self.util = Util()

        for test in testCaseJson:
            self.element = test['FindElement']
            self.Action = test['ActionCommand']
            self.elementType = test['FindElementType']
            self.Data = test['ActionParameters']
            self.waitAfterCmd = int(float(test['WaitAfterCommand']))
            self.timeOut = int(float(test['Wait-Timeout']))

            if self.Action == "login":
                email = self.Data.strip().split(",")[0]
                password = self.Data.strip().split(",")[1]
                email_locator = self.element.strip().split(",")[0]
                password_locator = self.element.strip().split(",")[1]
                self.sendKeys(email, email_locator, self.elementType)
                time.sleep(self.waitAfterCmd)
                self.sendKeys(password, password_locator, self.elementType)
                self.waitForElement(self.element, self.elementType,
                                    self.timeOut)

            elif self.Action == "isElementPresent":
                result = self.isElementPresent(self.element, self.elementType)
                self.stat.markFinal("Test" + self.element, result, "")
                self.reports.update({test['ActionNo']: result})

            elif self.Action == "elementClick":
                self.elementClick(self.element, self.elementType)
                time.sleep(self.waitAfterCmd)

            elif self.Action == "verifyTextContains":
                exceptedText = self.getText(self.element, self.elementType)
                result = self.util.verifyTextContains(self.Data, exceptedText)
                self.stat.markFinal("Test" + self.element, result,
                                    "Text Contains")
                self.reports.update({test['ActionNo']: result})

            elif self.Action == "sendKeys":
                self.sendKeys(self.Data, self.element, self.elementType)
                time.sleep(self.waitAfterCmd)

            elif self.Action == "waitForElement":
                self.waitForElement(self.element, self.elementType,
                                    self.timeOut)

            elif self.Action == "isElementPresent":
                result = self.isElementPresent(self.element, self.elementType)
                self.stat.markFinal("Test" + self.element, result, "")
                self.reports.update({test['ActionNo']: result})

            elif self.Action == "clearField":
                self.clearField(self.element, self.elementType)
                time.sleep(self.waitAfterCmd)

            elif self.Action == "getTitle":
                result = self.getTitle()
                print(result)

            elif self.Action == "isElementDisplayed":
                self.isElementDisplayed(self.element, self.elementType)
                time.sleep(self.waitAfterCmd)

            elif self.Action == "scrollIntoView":
                self.scrollIntoView(self.element, self.elementType)
                time.sleep(self.waitAfterCmd)

            elif self.Action == "mouseHover":
                self.mouseHover(self.element, self.elementType)
                self.waitForElement(self.element, self.elementType,
                                    self.timeOut)

            elif self.Action == "mouseClick":
                self.mouseClick(self.element, self.elementType)
                time.sleep(self.waitAfterCmd)

            elif self.Action == "webScroll":
                self.webScroll(self.Data)
                time.sleep(self.waitAfterCmd)

        self.driver.quit()
コード例 #19
0
 def objectSetup(self, oneTimeSetUp):
     self.lp = LoginPage(self.driver)
     self.ts = Status(self.driver)
コード例 #20
0
class LoginTests(unittest.TestCase):
    log = cl.customLogger(logging.DEBUG)

    _username = "******"
    _password = "******"

    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=1)
    def test_t1invalidLogin(self):
        self.log.info("*#" * 20)
        self.log.info("test_t1invalidLogin with blank field")
        self.log.info("*#" * 20)
        self.lp.logout()
        time.sleep(3)
        self.lp.clickLoginButton()
        result1 = self.lp.verifyLoginFailed()
        assert result1 == False

    @pytest.mark.run(order=2)
    def test_t2invalidLogin(self):
        self.log.info("*#" * 20)
        self.log.info("test_t2invalidLogin started")
        self.log.info("*#" * 20)
        self.log.info("test with valid username and blank password field")
        self.lp.logout()
        self.lp.login("gaurav", "")
        result2 = self.lp.verifyLoginFailed()
        assert result2 == False

    @pytest.mark.run(order=3)
    def test_t3invalidLogin(self):
        self.log.info("*#" * 20)
        self.log.info("test_t3invalidLogin started")
        self.log.info("*#" * 20)
        self.log.info("test with blank username and valid password field")
        self.lp.logout()
        self.lp.login("", "gaurav@123")
        result3 = self.lp.verifyLoginFailed()
        assert result3 == False

    @pytest.mark.run(order=4)
    def test_t4invalidLogin(self):
        self.log.info("*#" * 20)
        self.log.info("test_t4invalidLogin started")
        self.log.info("*#" * 20)
        self.log.info("test with valid username and blank password field")
        self.lp.logout()
        self.lp.login("*****@*****.**", "Abc@122")
        result4 = self.lp.verifyLoginFailed()
        assert result4 == False

    @pytest.mark.run(order=5)
    def test_t5validLogin(self):
        self.log.info("*#" * 20)
        self.log.info("test_t5invalidLogin started")
        self.log.info("*#" * 20)
        self.lp.logout()
        self.lp.login("gaurav", "gaurav@123")
        time.sleep(3)
        result5 = self.lp.verifyLoginTitle()
        self.ts.mark(result5, "Title Verification")
        result6 = self.lp.verifyLoginSuccessful()
        print("Result5: " + str(result5))
        print("Result6: " + str(result6))
        self.ts.markFinal("test_t5validLogin", result6, "Login Verification")
コード例 #21
0
 def classSetup(self, oneTimeSetUp):
     self.check = CheckboxPage(self.driver)
     self.ts = Status(self.driver)
コード例 #22
0
 def objectSetup(self, oneTimeSetUp):
     self.courses = RegisterCoursesPage(self.driver)
     self.ts = Status(self.driver)
     self.nav = NavigationPage(self.driver)
コード例 #23
0
 def objectSetup(self, oneTimeSetUp):
     self.cp = ControllerPages(self.driver)
     self.ts = Status(self.driver)
コード例 #24
0
 def classSetup(self, oneTimeSetUp):
     self.courses = RegisterCoursesPage(self.driver)
     self.ts = Status(self.driver)
コード例 #25
0
 def classSetup(self, oneTimeSetUp):
     self.lp = LoginPage(self.driver)
     self.ts = Status(self.driver)
     """
コード例 #26
0
 def objectSetup(self, oneTimeSetUp):
     self.so = CreateSalesOrderPage(self.driver)
     self.ts = Status(self.driver)
     self.db = DashboardPage(self.driver)
コード例 #27
0
 def classSetup(self, oneTimeSetUp):
     self.tn = TopNav(self.driver)
     self.ts = Status(self.driver)
コード例 #28
0
 def classSetup(self, oneTimeSetUp):
     self.forms = FormsPage(self.driver)
     self.ts = Status(self.driver)