Пример #1
0
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        #self.driver.find_element_by_link_text("All Courses").click()
        self.nav.navigateToAllCourses()

    @pytest.mark.run(order=1)
    @data(*getCSVData(
        "/Users/atomar/Documents/workspace_python/letskodeit/testdata.csv"))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV):
        self.courses.enterCourseName(courseName)
        time.sleep(1)
        self.courses.selectCourseToEnroll(courseName)
        time.sleep(1)
        self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV)
        time.sleep(1)
        result = self.courses.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
Пример #2
0
class TestLogin(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetUp(self, oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.cs = CheckStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    # @pytest.fixture()
    # def methSetUp(self, setUp):

    @pytest.mark.run(order=2)
    def test_ValidLogin(self):
        self.nav.navigateToHomePage()
        self.lp.login('*****@*****.**', 'abcabc')
        result1 = self.lp.verifyLoginPageTitle()
        self.cs.mark(result1, 'We verify title... ###')
        result2 = self.lp.verifySuccessLogin()
        self.cs.markFinal('test_ValidLogin', result2,
                          'We test correct login/password ###')

    @pytest.mark.run(order=1)
    def test_InvalidLogin(self):
        self.lp.logout()
        self.lp.login('*****@*****.**', 'gunwo')
        result0 = self.lp.verifyFailLogin()
        self.cs.markFinal('test_InvalidLogin', result0,
                          'We test wrong login/password ###')
Пример #3
0
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        time.sleep(3)
        self.nav.navigateToAllCourses()

    @pytest.mark.run(order=1)
    @data(*getCSVData("D:\\workspace\\AutomationFramework\\testdata.csv"))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV):
        self.courses.enterCourseName(courseName)
        self.courses.clickOnSearchButton()
        res = self.courses.selectCourseToEnroll(courseName)
        self.ts.mark(res, "Search Course Verification")
        self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV)
        # result = self.courses.verifyEnrollFailed()
        time.sleep(3)
        self.courses.clickOnIcon()
        self.ts.markFinal("test_invalidEnrollment", res,
                          "Enrollment Failed Verification")
class RegisterCoursesCSVDataTests(unittest.TestCase):
    """
    

    To run html reports verify pytest-html is installed. If is not installed, from the terminal type : pip3 install pytest-html

    """
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver, self.cfg)
        self.ts = TstStatus(self.driver)
        self.nav = NavigationPage(self.driver, self.cfg)

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

    @pytest.mark.run(order=1)
    @data(*getCSVData("testdata.csv"))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV, ccZip):
        self.courses.enterCourseName(courseName)
        time.sleep(1)
        self.courses.selectCourseToEnroll(courseName)
        time.sleep(1)
        self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV, zip=ccZip)
        time.sleep(1)
        result = self.courses.verifyEnrollFailed()
        self.driver.back()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
Пример #5
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")
Пример #6
0
class RegisterCoursesCSVDataTests(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = TStatus(self.driver)
        self.d = SeleniumDriver(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        self.nav.navigateToMainPage()
        self.nav.navigateToAllCourses()

    @pytest.mark.run(order=1)
    @data(*getCSVdata("/Users/pavelpapazov/PycharmProjects/LetsKodeit/test_data.csv"))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccDate, ccCvv, postal):
            # self.courses.openCousesPage()
            self.courses.enterCourseName(courseName)
            self.courses.selectCoureToEnroll(courseName)
            self.courses.startEnroll()
            #self.courses.enterEmail("*****@*****.**")
            time.sleep(1)
            self.courses.scrollPage(direction="down")
            time.sleep(1)
            self.courses.useAnotherCard()
            time.sleep(1)
            self.courses.enrollCource(num=ccNum, exp=ccDate, cvv=ccCvv, postal=postal)
            result = self.courses.verifyEnrollFailed()
            self.ts.markFinal("test_invalidEnrollment", result, "Enrollment Failed verification")
Пример #7
0
class LoginPage(BasePage):

    log = cl.customLogger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(self.driver)
        util = Util()

    #locators

    _login_link = "Login"
    _email_field = "user_email"
    _password_field = "user_password"
    _login_button = "commit"

    def clickLoginLink(self):
        login_link = self.waitForElement(locator=self._login_link,
                                         locatorType="link")
        self.elementClick(element=login_link)

    def enterEmail(self, email):
        self.sendKeys(email, self._email_field, "id")

    def enterPassword(self, password):
        self.sendKeys(password, self._password_field, "id")

    def clickLoginButton(self):
        self.elementClick(self._login_button, "name")

    def login(self, email=None, password=None):

        self.clickLoginLink()
        if email is not None:
            self.enterEmail(email)
        if password is not None:
            self.enterPassword(password)
        self.clickLoginButton()

    def logout(self):

        self.nav.navigateToUserSettings()
        logout_link = self.waitForElement(
            locator=".//div[@id='navbar']//a[@href='/sign_out']",
            locatorType="xpath")
        self.elementClick(element=logout_link)

    def verifyLoginSuccessful(self):
        result = self.isElementPresent(
            ".//div[@id='navbar']//li[@class='dropdown']", "xpath")
        return result

    def verifyLoginFailed(self):
        result = self.isElementPresent(
            ".//div[contains(text(),'Invalid email or password')]", "xpath")
        return result

    def verifyLoginTitle(self):
        return self.verifyPageTitle("Let's Kode")
Пример #8
0
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.nav = NavigationPage(self.driver)

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

    @pytest.mark.run(order=1)
    @data(*getCSVData(
        "C:\\Users\\navs0817\\PycharmProjects\\test_py\\tests\\courses\\data.csv"
    ))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV):
        self.courses.enterCourseName(courseName)
        time.sleep(1)
        self.courses.selectCourseToEnroll(courseName)
        time.sleep(1)
        self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV)
        time.sleep(1)
        result = self.courses.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
Пример #9
0
class RegisterCoursesCSVDataTests(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def objectSetUp(self):
        self.course = RegisterCoursePage(self.driver)
        self.ts = TestStatus(self.driver)
        self.np = NavigationPage(self.driver)

    def setUp(self):
        self.np.navigateToAllCourses()
        # self.driver.find_element_by_link_text("All Courses").click()

    pytest.mark.run(order=1)
    # @data(("JavaScript for Beginners", "10", "1220", "10"), ("Selenium WebDriver with Java ", "12", "0923", "16"))
    @data(*getCSVData("testdata.csv"))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV):
        self.course.enterCourseName(courseName)
        time.sleep(1)
        self.course.selectCourseToEnroll(courseName)
        time.sleep(2)
        self.course.enrollCourse(num="ccNum", exp="ccExp", cvv="ccCVV")
        time.sleep(1)
        result = self.course.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result, "Test Enrollment Failed")
Пример #10
0
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.nav = NavigationPage(self.driver)

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

    @pytest.mark.run(order=1)
    @data(*getCSVData("testdata.csv"))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV, country):
        self.courses.login()
        self.courses.enterCourseName(courseName)
        self.courses.selectCourseToEnroll(courseName)
        self.courses.enrollCourse(num=ccNum,
                                  exp=ccExp,
                                  cvv=ccCVV,
                                  country=country)
        result = self.courses.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
        self.courses.logout()
Пример #11
0
class RegisterCourseTests(unittest.TestCase):


    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursePage(self.driver)
        self.ts = TestStatus(self.driver)
        self.lp = LoginPage(self.driver)
        self.nav = NavigationPage(self.driver)

    def set_up(self):
        self.nav.navigate_to_all_courses()



    @pytest.mark.run(order = 1)
    @data (("JavaScript for beginners", "10", "1220", "10"), ("Learn Python 3 from scratch", "20", "1220", "20"))
    @unpack
    def test_invalid_enrollment(self, courseName, ccNum, ccExp, ccCVV):
        self.lp.login("*****@*****.**", "abcabc")
        self.courses.enter_search_field(courseName)
        self.courses.click_search_button()
        self.courses.select_course()
        time.sleep(4)
        self.courses.enroll_course(num=ccNum, exp=ccExp, cvv=ccCVV)
        result = self.courses.verify_enroll_failed()
        self.ts.mark_final("test_invalid_enrollment", result,
                           "Enrollment Verification")
        self.courses.click_all_courses_link()
Пример #12
0
class LoginPage(BasePage):

    log = cl.customLogger(logging.DEBUG)

    # Call super constructor and pass driver.  Need driver for LoginPage too.
    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)

    # Locators
    _login_link = "Login"
    _email_field = "user_email"
    _password_field = "user_password"
    _login_button = "commit"


    # The custom elementClick and sendKeys methods locate the element then perform the action on the element
    # sendKeys is the custom method, not send_keys
    def clickLoginLink(self):
        self.elementClick(self._login_link, locatorType="link")

    def enterEmail(self, email):
        self.sendKeys(email, self._email_field)

    def enterPassword(self, password):
        self.sendKeys(password, self._password_field)

    def clickLoginButton(self):
        self.elementClick(self._login_button, locatorType="name")

    def login(self, email="", password=""):
        self.clickLoginLink()
        self.enterEmail(email)
        self.enterPassword(password)
        self.clickLoginButton()

    def verifyLoginSuccessful(self):
        result = self.isElementPresent("//*[@class='gravatar']",
                                       locatorType="xpath")
        return result

    def verifyLoginFailed(self):
        result = self.isElementPresent("//div[contains(text(),'Invalid email or password')]",
                                       locatorType="xpath")
        return result

    def clearLoginFields(self):
        emailField = self.getElement(locator=self._email_field)
        emailField.clear()
        passwordField = self.getElement(locator=self._password_field)
        passwordField.clear()

    def verifyLoginTitle(self):
        return self.verifyPageTitle("Kode")

    def logout(self):
        self.nav.navigateToUserSettings()
        self.elementClick(locator="//div[@id='navbar']//a[@href='/sign_out']",
                          locatorType="xpath")
Пример #13
0
class CourseTest(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def objectSetUp(self, oneTimeSetUp):
        self.cp = RegisterCoursePage(self.driver)
        self.ts = TestStatus(self.driver)
        self.np = NavigationPage(self.driver)


    def setUp(self):
        self.np.navigateToAllCourses()


    @data(("JavaScript for beginners","41111111","01/2020","222"),("Learn Python 3 from scratch","323232","01/2021","111"))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCvv):
        self.cp.searchCourse(courseName)

        result1 = self.cp.verifyCoursePageTitle(courseName)
        self.ts.mark('invalidCourseEnrollment',result1,"Title incorrect")

        self.cp.enrollCourse(ccNum,ccExp,ccCvv)

        result2 = self.cp.verifyPaymentFailed()
        self.ts.markFinal('invalidCourseEnrollment',result2,"Payment failed because of invalid CC number")
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.course = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        # self.driver.find_element_by_link_text("All Courses").click()
        # self.driver.find_element_by_xpath("//a[@class='navbar-brand header-logo']").click()
        # self.driver.get("https://learn.letskodeit.com/courses")
        self.nav.navigateToAllCourses()

    @pytest.mark.run(order=1)
    @data(
        *getCSVData("C:\Users\Durga\workspace_python\myframework\testdata.csv")
    )
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV):
        self.courses.enterCourseName(courseName)
        time.sleep(2)
        self.courses.selectCourseToEnroll(courseName)
        time.sleep(2)
        self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV)
        time.sleep(2)
        result = self.courses.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
Пример #15
0
class RegisterCoursesTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def class_set_up(self, one_time_set_up):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = CheckStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def set_up(self):
        self.nav.navigate_to_all_courses()

    @pytest.mark.run(order=1)
    @data(*get_csv_data(
        r"C:\Users\blabl\PycharmProjects\FrameworkPractice\testdata.csv"))
    @unpack
    def test_invalid_enrollment(self, course_name, cc_num, cc_exp, cc_cvv):
        self.courses.enter_course_name(course_name)
        time.sleep(3)
        self.courses.select_course_to_enroll(course_name)
        time.sleep(3)
        self.courses.enroll_course(num=cc_num, exp=cc_exp, cvv=cc_cvv)
        result = self.courses.verify_enroll_failed()
        self.ts.mark_final("test_invalid_enrollment", result,
                           "Enrollment verification FAILED")
        self.courses.web_scroll()
        self.driver.find_element_by_link_text("ALL COURSES").click()
        time.sleep(5)
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.nav = NavigationPage(self.driver)

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

    @pytest.mark.run(order=1)
    @data(*getCSVData(
        "/Users/marten.westman/PycharmProjects/webdriver_framework/testdata.csv"
    ))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV,
                               ccPostal):
        self.courses.enterCourseName(courseName)
        self.courses.selectCourseToEnroll(courseName)
        self.courses.enrollCourse(num=ccNum,
                                  exp=ccExp,
                                  cvv=ccCVV,
                                  zip=ccPostal)
        result = self.courses.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
Пример #17
0
class RegisterCoursesTests(unittest.TestCase):

    BASEDIR = os.path.dirname(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
    TESTDATA_FILE_PATH = os.path.join(BASEDIR, 'test_data.csv')

    @pytest.fixture(autouse=True)
    def objectSetUp(self, oneTimeSetUp):
        if self.driver is None:
            assert False
        self.rcp = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.np = NavigationPage(self.driver)

    def setUp(self):
        self.rcp.webScroll("up")
        self.np.navigateToHome()

    @pytest.mark.run(order=1)
    @data(*getCSVData(TESTDATA_FILE_PATH))
    @unpack
    def test_enrollForCourse(self, courseName, cc_num, cc_exp, cc_cvv, country,
                             postal_code):
        self.rcp.selectCategoryAndAuthor("All", "All")
        self.rcp.enterCourseName(courseName)
        self.rcp.clickOnCourseName(courseName)
        self.rcp.enrollCourse(cc_num=cc_num,
                              cc_exp=cc_exp,
                              cc_cvv=cc_cvv,
                              country=country,
                              postal=postal_code)
        self.ts.markFinal("enrollForCourse", "Pass",
                          "Successfully enrolled for course")
Пример #18
0
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.rc = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        self.nav.navigateToHome()
        self.nav.navigateToAllCourses()

    @pytest.mark.run(order=1)
    @data(*getCSVData(
        "/Users/K1/Documents/python_workspace/AutomationFramework/testdata.csv"
    ))
    @unpack
    def test_invalidEnrollment(self, courseName, courseCount):
        self.rc.enterCourseName(courseName, courseCount)
        time.sleep(1)
        self.rc.selectCourseToEnroll(courseName)
        time.sleep(1)
        self.rc.clickEnrollButton()
        self.rc.clickBuyNowButton()
        time.sleep(1)
        result = self.rc.verifyEnrollmentFailed()
        self.ts.markFinal(testName="test_invalidEnrollment",
                          result=result,
                          resultMessage="verifyEnrollmentFailed")
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = TrackStatus(self.driver)
        self.nav = NavigationPage(self.driver)

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

    @pytest.mark.run(order=1)
    # * is to unpack if tuples, lists etc are used in data
    # getCSVData was mentioned in import statement above so @data recognizes it
    # Use full path + filename
    @data(*getCSVData(
        "C:\\Users\\Eugene\\PycharmProjects\\AutomationFramework\\testdata.csv"
    ))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV):
        self.courses.enterCourseName(courseName)
        time.sleep(1)
        self.courses.selectCourseToEnroll(courseName)
        time.sleep(1)
        self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV)
        time.sleep(1)
        result = self.courses.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
        # ALTERNATE WAY TO GO BACK USING JS:py.
        # self.driver.execute_script("window.history.go(-1)")
        self.driver.back()
Пример #20
0
class RegisterCourseCSVTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = CheckStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        self.nav.navigateToAllCourse()
        time.sleep(5)

    @pytest.mark.run(order=1)
    @data(*getCSVData(
        "/Users/dattran/Documents/Virtualenv/PyCharm/workspace_python/letskodeit/data.csv"
    ))
    @unpack
    def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV):
        self.courses.enterCourseName(courseName)
        time.sleep(2)
        self.courses.selectCourseToEnroll(courseName)
        time.sleep(2)
        self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV)
        time.sleep(5)
        result = self.courses.verifyEnrollFailed()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Enrollment Failed Verification")
class RegisterCoursesTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def class_setup(self):
        self.courses = RegisterCoursesPage(self.driver)
        self.nav = NavigationPage(self.driver)
        self.ts = Status(self.driver)

    def setUp(self):
        self.nav.click_header_logo()
        self.nav.navigate_to_all_courses()

    @pytest.mark.run(order=1)
    @data(*get_csv_data(
        "C:\\Users\\Ctramm\\PycharmProjects\\ExampleAutomationFramework\\testdata.csv"
    ))
    @unpack
    def test_invalid_enrollment(self, course_name, cc_num, cc_exp, cc_cvv,
                                zip_code):
        self.courses.enter_course_name(course_name)
        self.courses.select_course_to_enroll(course_name)
        self.courses.enroll_course(cc_num, cc_exp, cc_cvv, zip_code)
        result = self.courses.verify_enroll_button_is_disabled()
        self.ts.mark_final("test_invalid_enrollment", result,
                           "Enrollment Failed Verification")
        self.courses.take_screenshot("test_invalid_enrollment")
Пример #22
0
class LoginPage(BasePage):

    log = cl.customLogger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)

    # Locators
    _login_link = "Login"
    _email_field = "user_email"
    _password_field = "user_password"
    _login_button = "commit"

    def clickLoginLink(self):
        self.elementClick(self._login_link, locatorType="link")

    def enterEmail(self, email):
        self.sendKeys(email, self._email_field)

    def enterPassword(self, password):
        self.sendKeys(password, self._password_field)

    def clickLoginButton(self):
        self.elementClick(self._login_button, locatorType="name")

    def login(self, email="", password=""):
        self.clickLoginLink()
        time.sleep(10)
        self.clearFields()
        self.enterEmail(email)
        self.enterPassword(password)
        self.clickLoginButton()

    def verifyLoginSuccessful(self):
        result = self.isElementPresent("//div[@id='navbar']//li[@class='dropdown']",
                                       locatorType="xpath")
        return result

    def verifyLoginFailed(self):
        result = self.isElementPresent("//div[contains(text(),'Invalid email or password')]",
                                       locatorType="xpath")
        return result

    def verifyLoginTitle(self):
        return self.verifyPageTitle("Let's Kode It")

    def logout(self):
        self.nav.navigateToUserSettings()
        logoutLinkElement = self.waitForElement(locator="//div[@id='navbar']//a[@href='/sign_out']",
                          locatorType="xpath", pollFrequency=1)
        self.elementClick(element=logoutLinkElement)

    def clearFields(self):
        emailField = self.getElement(locator=self._email_field)
        emailField.clear()
        passwordField = self.getElement(locator=self._password_field)
        passwordField.clear()
Пример #23
0
class LoginPage(BasePage):
    log = cl.customLogger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)

    # Locators
    _login_link = "//a[contains(text(),'Sign In')]"
    _email_field = "email"
    _password_field = "password"
    _login_button = "//input[@value='Login']"

    def clickLoginLink(self):
        self.elementClick(self._login_link, locatorType="xpath")

    def EnterEmail(self, email):
        self.sendKeys(email, locator=self._email_field)

    def EnterPassword(self, password):
        self.sendKeys(password, locator=self._password_field)

    def ClickLoginButton(self):
        self.elementClick(self._login_button, locatorType="xpath")

    def Login(self, email="", password=""):
        time.sleep(2)
        self.clickLoginLink()
        time.sleep(2)
        self.EnterEmail(email)
        self.EnterPassword(password)
        time.sleep(2)
        self.ClickLoginButton()

    def verifyLoginSuccessful(self):
        time.sleep(1)
        result = self.isElementPresent("//img[contains(@class, 'zl-navbar')]",
                                       byType="xpath")
        return result

    def verifyLoginFailed(self):
        result = self.isElementPresent(
            "//span[contains(text(),'Your username or password is invalid')]",
            byType="xpath")
        return result

    def verifyTitle(self):
        return self.verifyPageTitle("Google")

    def logout(self):
        self.nav.navigateToUserSettings()
        LogoutElement = self.waitForElement(
            locator="//a[contains(text(),'Logout')]",
            locatorType="xpath",
            pollFrequency=1)
        self.elementClick(element=LogoutElement)

    '''def getLoginLink(self):
Пример #24
0
    def __init__(self, driver, cfg):
        super().__init__(driver)
        self.driver = driver
        self.cfg = cfg
        self.nav = NavigationPage(driver, cfg)

        self.user_id = self.cfg.get("credentials", "user_id")
        self.user_password = self.cfg.get("credentials", "user_password")
class LoginPage(BasePage):
    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)

    #locators - original home page
    # _login_link = "Login"
    # _email = "user_email"
    # _password = "******"
    # _login_button = "commit"

    #locators - courses.letskodeit.com
    _login_link = "SIGN IN"
    _email = "email"
    _password = "******"
    _login_button = "//input[@value='Login']"

    #action functions
    def click_login_link(self):
        self.element_click(self._login_link, locator_type="link")

    def enter_email_field(self, email):
        self.element_send(email, self._email)

    def enter_password_field(self, password):
        self.element_send(password, self._password)

    def click_login_button(self):
        self.element_click(self._login_button, locator_type="xpath")

    #main login page function
    def login(self, email, password):
        self.click_login_link()
        time.sleep(3)
        self.enter_email_field(email)
        time.sleep(1)
        self.enter_password_field(password)
        time.sleep(1)
        self.click_login_button()

    def verify_login_success(self):
        result = self.is_element_present("//div[@id='course-list']/div[1]",
                                         locator_type="xpath")
        return result

    def verify_login_fail(self):
        result = self.is_element_present("//span[contains(text(), 'invalid')]",
                                         locator_type="xpath")
        return result

    def verify_login_title(self):
        return self.verify_page_title("All Courses")

    def log_out(self):
        self.nav.navigate_to_user_settings()
        self.element_click(locator="//a[@href='/logout']",
                           locator_type="xpath")
Пример #26
0
class LoginPage(BasePage):

    log = cl.CustomeLogger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(self.driver)

        #locators

    _login_link = "Login"
    _email_field = "user_email"
    _password_field = "user_password"
    _login_button = "commit"
    _log_out = "//a[contains(text(), 'Log Out')]"

    def clickLoginLink(self):
        self.elementClick(self._login_link, locatorType="link")

    def enterEmail(self, email):
        self.sendKeys(email, self._email_field)

    def enterPassword(self, password):
        self.sendKeys(password, self._password_field)

    def clickLoginButton(self):
        self.elementClick(self._login_button, locatorType="name")

    def login(self, username="", password=""):
        try:
            self.clickLoginLink()
            self.enterEmail(username)
            self.enterPassword(password)
            self.clickLoginButton()
            #error = self.getElementText("div[class$='alert-danger']", locatorType="css")
            #print("Login Failed"+error)
        except Exception:
            traceback.print_exc()

    def verifyLoginSuccessful(self):
        result = self.isElementPresent(
            "//*[@id='navbar']//span[text()='User Settings']",
            locatorType='xpath')
        return result

    def verifyLoginFailed(self):
        result = self.isElementPresent("div[class$='alert-danger']",
                                       locatorType='css')
        return result

    def verifyLoginTitle(self):
        self.verifyPageTitle("Let's Kode It")

    def logOut(self):
        self.nav.navigateToUserSettings()
        self.elementClick(locator=self._log_out, locatorType="xpath")
Пример #27
0
class LoginPage(BasePage):
    log = cl.custom_logger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)

    # Locators
    _login_link = "Login"
    _email_field = "user_email"
    _password_field = "user_password"
    _login_button = "commit"
    _logout_button = "Log Out"

    def click_login_link(self):
        self.click_element(self._login_link, "link")

    def enter_email(self, email):
        self.send_keys(email, self._email_field)

    def enter_password(self, password):
        self.send_keys(password, self._password_field)

    def click_login_button(self):
        self.click_element(self._login_button, "name")

    def login(self, email="", password="", click_login=True):
        if click_login:
            self.click_login_link()
        self.clear_fields()
        self.enter_email(email)
        self.enter_password(password)
        self.click_login_button()

    def verify_login_successful(self):
        result = self.is_element_present(
            "//*[@id='navbar']//img[@class='gravatar']", "xpath")
        return result

    def verify_login_failed(self):
        result = self.is_element_present(
            "//div[contains(text(),'Invalid email or password')]", "xpath")
        return result

    def clear_fields(self):
        self.get_element(self._email_field).clear()
        self.get_element(self._password_field).clear()

    def verify_login_title(self):
        return self.verify_page_title("Let's Kode It")

    def logout(self):
        self.nav.go_to_user_settings()
        self.click_element(self._logout_button, "link")
Пример #28
0
class LoginPage(BasePage):

    log = cl.customlogger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)

    #Locators
    _Login_Link = "Login"
    _email_Field = "user_email"
    _password_Field = "user_password"
    _Login_Button = "commit"

    def clickLoginLink(self):
        self.elementClick(self._Login_Link, locatorType="link")

    def enterEmail(self, email):
        self.sendKeys(email, self._email_Field)

    def enterPassword(self, password):
        self.sendKeys(password, self._password_Field)

    def clickLoginButton(self):
        self.elementClick(self._Login_Button, locatorType="name")

    def Login(self, email="", password=""):
        self.clickLoginLink()
        self.enterEmail(email)
        self.enterPassword(password)
        self.clickLoginButton()

    def verifyLoginSuccessful(self):
        result = self.isElementPresent(
            "//*[@id='navbar']//span[text()='User Settings']",
            locatorType="xpath")
        return result

    def verifyLoginFailed(self):
        result = self.isElementPresent(
            "//div[contains(text(), ' Invalid email or password')]",
            locatorType="xpath")
        return result

    def verifyLoginTitle(self):
        return self.verifyPageTitle("Lts's Kode It")

    def logout(self):
        self.nav.navigationToUserSettings()
        self.elementClick(locator="//div[@id='navbar']//a[@href='/sign_out']",
                          locatorType="xpath")
Пример #29
0
class LoginPage(BasePage):

    log = cl.customLogger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)

    #locators
    _page_title = "Let's Kode It"
    _login_link = "//a[@href='/sign_in']"
    _email_field = "//input[@id='user_email']"
    _password_field = "//input[@id='user_password']"
    _login_btn = "//input[@type='submit']"
    _user_settings = "//a[contains(@class, 'open-my-profile-dropdown')]"
    _invalid_creds_alert = "//div[@class='alert alert-danger']"
    _logout_btn = "//a[@href='/sign_out']"

    def clickLoginLink(self):
        self.elementClick(self._login_link)

    def enterEmail(self, email):
        self.sendKeys(email, self._email_field)

    def enterPassword(self, password):
        self.sendKeys(password, self._password_field)

    def clickLoginBtn(self):
        self.elementClick(self._login_btn)

    def login(self, email="", password=""):
        self.clickLoginLink()
        self.enterEmail(email)
        self.enterPassword(password)
        self.clickLoginBtn()

    def verifySeccessfulLogin(self):
        result = self.isElementPresent(self._user_settings)
        return result

    def verifyFailedLogin(self):
        result = self.isElementPresent(self._invalid_creds_alert)
        return result

    def verifyLoginTitle(self):
        return self.verifyPageTitle(self._page_title)

    def logout(self):
        self.nav.openUserSettings()
        time.sleep(1)
        self.elementClick(self._logout_btn)
Пример #30
0
class LoginPage(BasePage):

    log = cl.customLogger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)

    # Locators
    _login_link = "//a[contains(.,'Sign In')]"
    _email_field = "email"
    _password_field = "password"
    _login_button = "//input[@type='submit']"

    def clickLoginLink(self):
        self.elementClick(self._login_link, locatorType="xpath")

    def enterEmail(self, email):
        self.sendKeys(email, self._email_field)

    def enterPassword(self, password):
        self.sendKeys(password, self._password_field)

    def clickLoginButton(self):
        self.elementClick(self._login_button, locatorType="xpath")

    def login(self, email="", password=""):
        self.clickLoginLink()
        self.enterEmail(email)
        self.enterPassword(password)
        self.clickLoginButton()

    def verifyLoginSuccessful(self):
        result = self.isElementPresent("//img[@class='zl-navbar-rhs-img ']",
                                       locatorType="xpath")
        return result

    def verifyLoginFailed(self):
        result = self.isElementPresent(
            "//span[@class='dynamic-text help-block']", locatorType="xpath")
        return result

    def verifyLoginTitle(self):
        return self.verifyPageTitle("All Courses")

    def logout(self):
        self.nav.navigateToSettings()
        self.elementClick(locator="//a[@href='/logout']", locatorType='xpath')