예제 #1
0
class Application:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.main_page = MainPage(self.driver)
        self.cart_page = CartPage(self.driver)
        self.product_page = ProductPage(self.driver)

    def quit(self):
        self.driver.quit()

    def add_products_to_cart(self, number: int):
        for i in range(number):
            self.add_product_to_cart()

    def add_product_to_cart(self):
        self.main_page.open()
        self.product_page.open(self.main_page.get_first_product_link())
        self.product_page.product_to_cart()

    def delete_all_products_from_cart(self):
        self.cart_page.open()
        self.cart_page.delete_all_products()

    def is_any_product_in_cart(self):
        assert not self.cart_page.is_any_product_in_cart()
    def test_click_signin(self):
        driver = self.driver
        driver.get("http://demo.automationtesting.in")

        signinpage = SigninPage(driver)
        signinpage.click_signin()

        registration = RegistrationPage(driver)
        registration.first_name("May")
        registration.last_name("Nineth")
        registration.address("Middle of Nowhere")
        registration.email("*****@*****.**")
        registration.gender()
        registration.hobbies()
        registration.language()
        registration.skills()
        registration.countries()
        registration.DOB()
        registration.phone("5034568963")
        registration.password("Maya123456!")
        registration.second_password("Maya123456!")


        homepage = HomePage(driver)
        homepage.practice_site()

        practicepage = PracticePage(driver)
        practicepage.select_product()

        productpage = ProductPage(driver)
        productpage.add_to_cart()

        cartpage = CartPage(driver)
        cartpage.procede_to_checkout()
 def test_03Cart_validations(self):
     driver = self.driver
     cartObj = CartPage(driver)
     cartObj.cart_validation()
     ss = SeleniumDriver(self.driver)
     ss.screenShot(Utils.whoami(), time, ss_path)
     title_PhonePage = driver.title
     assert title_PhonePage == 'nopCommerce demo store. Login', 'Page not loaded'
 def test_03Cart_validations(self):
     driver = self.driver
     cartObj = CartPage(driver)
     cartObj.cart_validation()
     ss = SS(driver)
     time = moment.now().strftime("%H-%M-%S_%d-%m-%Y")
     testName = Utils.whoami()
     ScreenShotName = testName + time
     ss.screenshot(ss_path + ScreenShotName + ".png")
     allure.attach(self.driver.get_screenshot_as_png(), name=ScreenShotName,
                   attachment_type=allure.attachment_type.PNG)
예제 #5
0
    def test_add_product_to_to_cart_with_extended_warranty(self):
        searchPage = SearchPage(self.driver)
        searchPage.set_search_text(Product.search_product_warranty)
        searchPage.press_enter()
        assert Product.title_product_warranty, searchPage.check_product_search(Product.title_product_warranty)
        searchPage.click_product_search(Product.title_product_warranty)

        cartPage = CartPage(self.driver)
        assert Product.title_product_warranty, cartPage.check_product_title()
        cartPage.click_buy()
        cartPage.click_radio_warranty()
        cartPage.click_continue()
        assert Product.title_product_warranty, cartPage.check_product_cart()
 def test_03Cart_validations(self):
     driver = self.driver
     cartObj = CartPage(driver)
     cartObj.cart_validation()
     ss = SS(driver)
     time = moment.now().strftime("%H-%M-%S_%d-%m-%Y")
     testName = Utils.whoami()
     ScreenShotName = testName + time
     ss.screenshot(ss_path + ScreenShotName + ".png")
     allure.attach(self.driver.get_screenshot_as_png(),
                   name=ScreenShotName,
                   attachment_type=allure.attachment_type.PNG)
     title_PhonePage = driver.title
     assert title_PhonePage == 'nopCommerce demo store. Checkout', 'Page not loaded'
예제 #7
0
    def test_add_product_with_details_to_cart(self):
        searchPage = SearchPage(self.driver)
        searchPage.set_search_text(Product.search_product_with_details)
        searchPage.press_enter()
        assert Product.title_product_with_details, searchPage.check_product_search(Product.title_product_with_details)
        searchPage.click_product_search(Product.title_product_with_details)

        cartPage = CartPage(self.driver)
        assert Product.title_product_with_details, cartPage.check_product_title()
        cartPage.click_buy()
        assert Product.title_product_features, cartPage.check_confirm_product()
        cartPage.click_confirm_product()

        assert Product.title_valid_product, cartPage.check_product_cart()
        assert Product.features_product, cartPage.check_product_features()
예제 #8
0
    def test_add_multiple_product_to_basket(self, *procuct_list):
        print(procuct_list)
        mp = MainPage(self.driver)
        pp = ProductPage(self.driver)
        product_added_to_basket = []
        for product in procuct_list:
            mp.searchbox_input_fill(product, False)
            sleep(2)
            list = mp.get_quick_procucts_list()
            mp.quick_search_list_select_index(0, list)
            if pp.get_availability():
                if pp.if_size_selector_is_presence():
                    pp.get_sizes()
                pp.add_to_basket()
                selected_product = pp.product_information_get('Model:')
                pp.close_basket_popup_window()
                pp.get_back_to_main_page()
                product_added_to_basket.append(selected_product)
            else:
                print(f"Product {product} is not available. Skipping!")
        mp.button_cart_click()
        cp = CartPage(self.driver)
        product_in_cart = cp.get_products_in_cart()
        check = True
        for product in product_added_to_basket:
            partial_check = False
            for prduct_cart in product_in_cart:
                if product in prduct_cart:
                    partial_check = True
            if not partial_check:
                print(
                    f"Product {product} should be in cart, but it is not! Cart contains: {product_in_cart}"
                )
                check = False

        self.assertEqual(check, True)
예제 #9
0
    def test_add_product_to_cart_successfully(self):
        searchPage = SearchPage(self.driver)
        searchPage.set_search_text(Product.search_valid_product)
        searchPage.press_enter()
        assert Product.title_valid_product, searchPage.check_product_search(Product.title_valid_product)
        searchPage.click_product_search(Product.title_valid_product)

        cartPage = CartPage(self.driver)
        assert Product.title_valid_product, cartPage.check_product_title()

        cartPage.click_buy()
        assert Product.title_valid_product, cartPage.check_product_cart()
 def test_03Cart_validations(self):
     driver = self.driver
     cartObj = CartPage(driver)
     cartObj.cart_validation()
     ss = SeleniumDriver(self.driver)
     ss.screenShot(Utils.whoami(), time, ss_path)
 def test_Cart_validations(self):
     driver = self.driver
     cartObj = CartPage(driver)
     cartObj.cart_validation()
     snapObj = snapshot(driver)
     snapObj.screenshot()
예제 #12
0
 def __init__(self):
     self.driver = webdriver.Chrome()
     self.main_page = MainPage(self.driver)
     self.cart_page = CartPage(self.driver)
     self.product_page = ProductPage(self.driver)