class SearchTest(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def object_setup(self):
        self.front_page = FrontPage(self.driver)
        self.results_page = ResultsPage(self.driver)
        self.status = Status(self.driver)

    @pytest.mark.run(order=7)
    def test_no_results(self):
        self.front_page.navigate_to_front_page()
        self.front_page.search_items('askldfjaslkdfjklsaf')
        result = self.results_page.verify_search_no_results()
        self.status.mark(result, 'Search items with no results test')

    @pytest.mark.run(order=8)
    def test_search_item_dropdown(self):
        self.front_page.navigate_to_front_page()
        self.front_page.search_item_dropdown('Printed Summer Dress')
        result = self.results_page.verify_search_item_dropdown(
            'Printed Summer Dress')
        self.status.mark(result, 'Search an item via dropdown test')

    @pytest.mark.run(order=9)
    def test_search_results(self):
        self.front_page.navigate_to_front_page()
        self.front_page.search_items('printed')
        result = self.results_page.verify_search_results('printed')
        self.status.mark(result, 'Search results test')
class LoginTest(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def object_setup(self):
        self.login_page = LoginPage(self.driver)
        self.status = Status(self.driver)

    @pytest.mark.run(order=1)
    def test_invalid_login(self):
        invalid_username = get_invalid_username()
        invalid_password = get_invalid_password()

        if self.login_page.verify_login_successful():
            self.login_page.logout()
            self.login_page.navigate_to_login_page()
            self.login_page.login(invalid_username, invalid_password)
            self.status.mark(self.login_page.verify_login_failed(),
                             'Invalid login test')
        else:
            self.login_page.navigate_to_login_page()
            self.login_page.login(invalid_username, invalid_password)
            self.status.mark(self.login_page.verify_login_failed(),
                             'Invalid login test')

    @pytest.mark.run(order=2)
    def test_valid_login(self):
        username = get_username()
        password = get_password()

        self.login_page.navigate_to_login_page()
        self.login_page.login(username, password)
        self.status.mark(self.login_page.verify_login_successful(),
                         'Valid login test')
class MultipleDataTests(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 for beginners", "4280323963876221", "0521", "192",
           "00-001"), ("Complete Test Automation Bundle", "4280323963876221",
                       "0622", "111", "00-002"))
    @unpack
    def testInvalidEnrollment(self, courseName, num, exp, cvv, post):
        self.courses.enterCourseName(courseName)
        self.courses.clickEnrollButton()
        self.courses.enterCreditCardInfo(num, exp, cvv, post)
        self.courses.clickTermsCheckbox()
        self.courses.clickEnrollSubmitButton()
        result1 = self.courses.verifyEnrollFailed()
        self.ts.markFinal("testInvalidEnrollment", result1,
                          "Verify if fake card makes button enabled.")
        self.driver.find_element_by_xpath(
            "//a[@class='navbar-brand header-logo']").click()
Beispiel #4
0
class CoursesTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSet(self, oneTimeSetUp):
        self.cp = RegisterCoursesPage(self.driver)
        self.ts = Status(self.driver)
        self.np = NavigationPage(self.driver)

    # @pytest.mark.run(order=1)
    # def test_invalidEnrollment(self):
    #     self.cp.enrollToCourse()
    #     result = self.cp.verifyEnrollFailed()
    #     self.ts.markFinal("Verification of Invalid Enrollment", result, "Negative Test Case")

    @pytest.mark.run(order=1)
    @data(*getCSVData(
        '/Users/Dule-PC/workspace_python/PageObjectModel_framework/testdata.csv'
    ))
    @unpack
    def test_invalidEnrollment(self, course, courseFullName):
        self.cp.enrollToCourse(course, courseFullName)
        result = self.cp.verifyIfEnrollBtnIsDisable()
        self.ts.markFinal("test_invalidEnrollment", result,
                          "Negative Test Case")
        self.np.navigateToAllCourses()
Beispiel #5
0
class LoginTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.lg = LoginPage(self.driver)
        self.ts = Status(self.driver)

    @pytest.mark.run(order=1)
    def tests_invalidLogin(self):
        self.lg.login()
        result = self.lg.verifyFailedLogin()
        self.ts.markFinal("tests_invalidLogin", result,
                          "Invalid Login Verification")

    @pytest.mark.run(order=2)
    def tests_validLogin(self):
        self.lg.login('*****@*****.**', 'test1234')
        result1 = self.lg.verifyTitle()
        self.ts.mark(result1, "Title Verification")
        result2 = self.lg.verifySuccessfulLogin()
        self.ts.markFinal("tests_validLogin", result2, "Login Verification")
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.clearing()
        self.lp.logging("*****@*****.**", "abcabc")
        result2 = self.lp.verifyLoginTitle()
        self.ts.mark(result2, "Title verification.")
        result3 = self.lp.verifyLogin()
        self.ts.markFinal("test_validLogin", result3, "Login verification.")

    @pytest.mark.run(order=1)
    def test_failedLogin(self):
        self.lp.logout()
        self.lp.logging("*****@*****.**", "abcaaabc")
        result1 = self.lp.verifyLoginFailed()
        self.ts.mark(result1, "Testing login to fail.")
Beispiel #7
0
class LoginTests(unittest.TestCase):

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

    @pytest.mark.run(order=1)
    def test_invalid_login(self):
        self.lp.logout()
        self.lp.login("*****@*****.**", "badPassword")
        result = self.lp.verify_login_failure()
        self.ts.mark_final("test_invalid_login", result, "Invalid Login passed")

    @pytest.mark.run(order=2)
    def test_valid_login(self):
        self.lp.login("*****@*****.**", "abcabc")
        result = self.lp.verify_title()
        self.ts.mark(result, "Verify Title passed")
        result2 = self.lp.verify_login_success()
        self.ts.mark_final("test_valid_login", result2, "Valid login passed")
 def object_setup(self):
     self.front_page = FrontPage(self.driver)
     self.login_page = LoginPage(self.driver)
     self.status = Status(self.driver)
Beispiel #9
0
 def classSet(self, oneTimeSetUp):
     self.cp = RegisterCoursesPage(self.driver)
     self.ts = Status(self.driver)
     self.np = NavigationPage(self.driver)
Beispiel #10
0
 def classSetup(self, oneTimeSetUp):
     self.lg = LoginPage(self.driver)
     self.ts = Status(self.driver)
Beispiel #11
0
 def class_setup(self):
     self.courses = RegisterCoursesPage(self.driver)
     self.ts = Status(self.driver)
Beispiel #12
0
 def class_setup(self, one_time_setup):
     self.nav = NavigationPage(self.driver)
     self.ts = Status(self.driver)
class FrontPageTest(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def object_setup(self):
        self.front_page = FrontPage(self.driver)
        self.login_page = LoginPage(self.driver)
        self.status = Status(self.driver)

    @pytest.mark.run(order=3)
    def test_number_of_items(self):
        self.login_page.navigate_to_front_page()

        result1 = self.front_page.verify_number_of_items(7, 'popular')
        self.status.mark(result1, 'Number of popular items on front page test')

        self.front_page.select_category('best')
        result2 = self.front_page.verify_number_of_items(7, 'best')
        self.status.mark(result2, 'Number of best seller items on front page test')

    @pytest.mark.run(order=4)
    def test_popular_items(self):
        self.front_page.select_category('popular')
        self.status.mark(self.front_page.verify_popular_items('Faded Short Sleeve T-shirts',
                                                              'Printed Chiffon Dress'),
                         'Popular items test')

    @pytest.mark.run(order=5)
    def test_best_sellers_items(self):
        self.front_page.select_category('best')
        self.status.mark(self.front_page.verify_best_sellers_items('Printed Chiffon Dress',
                                                                   'Printed Dress'),
                         'Best sellers items test')

    @pytest.mark.run(order=6)
    def test_add_to_cart_no_session(self):
        if self.login_page.verify_login_successful():
            self.login_page.logout()

        self.login_page.navigate_to_front_page()
        self.driver.implicitly_wait(5)
        self.front_page.move_to_faded_short_sleeve()
        self.front_page.add_faded_short_sleeve_to_cart()
        self.front_page.click_proceed_to_checkout_btn()
        result1 = self.front_page.verity_cart_page()
        self.status.mark(result1, 'Add to cart w/o session test')

        self.front_page.navigate_to_login_page()
        self.login_page.login('*****@*****.**', 'RA^@*95QaOav')
        result2 = self.login_page.verify_number_of_items_in_cart()
        self.status.mark(result2, 'Add to cart w/o session preserves items in cart after login process test')
 def classSetup(self, oneTimeSetUp):
     self.courses = RegisterCoursesPage(self.driver)
     self.ts = Status(self.driver)
Beispiel #15
0
 def object_setup(self):
     self.front_page = FrontPage(self.driver)
     self.results_page = ResultsPage(self.driver)
     self.cart_page = CartPage(self.driver)
     self.status = Status(self.driver)
Beispiel #16
0
 def classSetup(self, oneTimeSetUp):
     self.lp = LoginPage(self.driver)
     self.cp = CoursesPage(self.driver)
     self.ts = Status(self.driver)
Beispiel #17
0
 def class_setup(self, one_time_setup):
     self.lp = LoginPage(self.driver)
     self.ts = Status(self.driver)
Beispiel #18
0
 def objectSetup(self, oneTimeSetUp):
     self.lp = LoginPage(self.driver)
     self.ts = Status(self.driver)