Ejemplo n.º 1
0
    def test_e2e(self):
        homepage = HomePage(self.driver)
        checkoutPage = homepage.shop()

        products = checkoutPage.products()

        for product in products:
            productName = product.find_element_by_xpath("div/h4").text
            if productName == "iphone X":
                product.find_element_by_xpath("div[2]/button").click()

        checkoutPage.getCheckout().click()

        actualName = checkoutPage.getName().text

        assert "iphone X" == actualName

        confirmPage = checkoutPage.getFinalButton()

        confirmPage.getEditBox().send_keys("ind")

        self.verifyLink("India")

        confirmPage.getCountry().click()

        confirmPage.getCheckBox().click()

        confirmPage.getFinalConfirm().click()

        finalText = confirmPage.getFinalText().text

        assert "Success! Thank you!" in finalText

        self.driver.get_screenshot_as_file("finalShot.png")
    def test_CreateAccount_Successfull(self):
        homePage = HomePage(self.driver)
        loginPage = LoginPage(self.driver)
        createAccount = CreateAccountPage(self.driver)
        # Click Sign In Button
        homePage.clickSignIn()
        # Typing email
        loginPage.setEmail_Create(self.emailCreate_successfull)
        # Click button submit
        loginPage.clickSubmit_Create()

        # Typing personal information
        createAccount.setFirstName(self.firstName)
        createAccount.setLastName(self.lastName)
        createAccount.setPassword(self.password)
        createAccount.setAddress(self.address)
        createAccount.setCity(self.city)
        createAccount.selectState(self.state)
        createAccount.setPostalCode(self.postalCode)
        createAccount.setPhone(self.phone)
        createAccount.setAliasAdress(self.aliasAddress)
        createAccount.clickRegister()
        # Check status of creating account
        time.sleep(5)
        self.assertEqual(self.myAccountPage_title, self.driver.title,
                         "Create Account Uncessfully")
Ejemplo n.º 3
0
    def selectRandomSubCategory(self):
        log = self.getLogger()
        home_page = HomePage(self.driver)
        action = ActionChains(self.driver)
        category_links = home_page.getMainCategory()

        category_links_len = len(category_links)
        random_category_index = random.randint(0, (category_links_len - 2))

        if random_category_index == (category_links_len - 2):
            first_category = category_links[random_category_index - 1]
            second_category = category_links[random_category_index]
        else:
            first_category = category_links[random_category_index]
            second_category = category_links[random_category_index + 1]

        TestHomePage.main_category = first_category.text

        action.move_to_element(first_category).perform()

        self.verifyLinkPresenceByCss(home_page.getSubCategory().text)

        sub_category_links = home_page.getSubCategoryLinks(first_category.text)
        sub_category_links_len = len(sub_category_links)
        random_sub_category_index = random.randint(0, (sub_category_links_len - 1))

        ran_sub_category = sub_category_links[random_sub_category_index]
        TestHomePage.sub_category = ran_sub_category.text

        ActionChains(self.driver).click(ran_sub_category).perform()

        log.info(TestHomePage.main_category)
        log.info(TestHomePage.sub_category)
 def test_selenium(self):
     log = self.getLogger()
     homePage = HomePage(self.driver)
     checkout = homePage.homepageitems()
     items = checkout.getitems()
     for item in items:
         if item.find_element_by_xpath("div/h4").text == "Nokia Edge":
             item.find_element_by_css_selector(".btn.btn-info").click()
             break
     log.info("Item Selected")
     checkout.cartCheck().click()
     confirm_page = checkout.finalCheck()
     confirm_page.get_country().send_keys("ind")
     self.wait_utility("India")
     countries = confirm_page.send_country()
     for country in countries:
         if country.text == 'India':
             country.click()
             break
     log.info(" Country entered")
     confirm_page.check_terms().click()
     confirm_page.click_purchase().click()
     result = confirm_page.confirm_message().text
     log.info(result)
     assert 'SuccT' in result
     self.driver.get_screenshot_as_file("result.png")
Ejemplo n.º 5
0
    def test_e2e(self):
        homepage = HomePage(self.driver)
        checkoutobj = homepage.clickShop()
        products = checkoutobj.getProducts()
        i = -1
        for product in products:
            i += 1
            if product.text == "Samsung Note 8":
                checkoutobj.getFooter()[i].click()
                break

        checkoutobj.checkMeOut().click()

        confirmPageObj = checkoutobj.checkMeAgain()
        # self.driver.find_element_by_css_selector('button.btn.btn-success').click()

        confirmPageObj.addCountry()
        # self.driver.find_element_by_css_selector('input[id="country"]').send_keys("ind")

        # wait = WebDriverWait(self.driver,8)
        #
        # wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT,"India")))
        #
        # self.driver.find_element_by_link_text("India").click()
        #
        # self.driver.find_element_by_css_selector("div.checkbox.checkbox-primary").click()
        #
        # self.driver.find_element_by_css_selector('input[type="submit"]').click()
        #
        # print(self.driver.find_element_by_css_selector('div.alert-success').text)

        confirmPageObj.placeOrder()
Ejemplo n.º 6
0
 def test_SuitableProductDetail(self):
     homePage = HomePage(self.driver)
     productDetail = ProductDetailPage(self.driver)
     # Type keywords
     homePage.setSearchKeyword(self.keyword)
     # Get all suggest keywords
     suggestKeyWords_list = homePage.getAllSuggestKeyWords()
     suggestKeyword_index = 0
     for suggestKeyword in suggestKeyWords_list:
         suggestKeyword_index += 1
         # Get single suggest keyword
         suggestKeyword_text = homePage.getSuggestKeyWord(
             suggestKeyword_index)
         # Click single suggest keyword
         homePage.clickSuggestKeyWord(suggestKeyword_index)
         # Get the title of product in product detail page
         productTitle = productDetail.getProductTitle()
         # Compare the title of product to the suggest keyword clicked
         self.assertIn(productTitle, suggestKeyword_text,
                       'Product tille is not match!')
         # Typing keyword again after compare the previous result
         if suggestKeyword_index < len(suggestKeyWords_list):
             homePage.setSearchKeyword(self.keyword)
         else:
             break
Ejemplo n.º 7
0
    def test_share_to_twitter(self, browser):
        # Thiết lập trình duyệt Chrome, Firefox
        if browser == 'chrome':
            self.driver = webdriver.Chrome(
                executable_path=
                r'C:\Drivers\chromedriver_win32\chromedriver.exe')
            self.driver.maximize_window()
            self.driver.get(self.baseURL)
            self.driver.implicitly_wait(5)

        else:
            self.driver = webdriver.Firefox(
                executable_path=
                r'C:\Drivers\geckodriver-v0.29.0-win64\geckodriver.exe')
            self.driver.maximize_window()
            self.driver.get(self.baseURL)
            self.driver.implicitly_wait(5)

            # Feature: Chi tiết sản phẩm; Title: Share to TWitter
        homePage = HomePage(self.driver)
        homePage.click_product_image(1)
        productDetailPage = ProductDetailPage(self.driver)
        productDetailPage.click_tweet()
        time.sleep(5)
        window_after = self.driver.window_handles[1]
        self.driver.switch_to.window(window_after)
        self.assertTrue(productDetailPage.login_twitter('vicvu8', '123456aA@'))

        time.sleep(5)
        self.driver.quit()
    def test_studioSelectionOperations(self, getInputData):     # Test method to verify various operations on studio page
        log = self.getLogger()
        log.info("Verifying the Workshop page link")
        homePage = HomePage(self.driver)
        workshopPage = homePage.selectWorkshop()
        workshopPageTitle = workshopPage.getWorkshopPageTitle()     # Checking title of studio search page
        if workshopPageTitle != getInputData["workshopPage_title"]:
            log.debug("Verification Failed: Search Studio Page title is not %r" % getInputData["workshopPage_title"])
        else:
            log.info("Verification Passed: Search Studio Page title is %r" % getInputData["workshopPage_title"])

        workshopPage.searchStudio(getInputData["area_code"])        # Searching list of studios in a given area
        details = workshopPage.getStudioDetails()
        name, distance, address, city = details.split("\n")
        log.info("Title of first studio searched is %r" % name)     # Getting details of first studio searched
        log.info("Distance of first studio searched is %r" % distance)

        studioDetailsPage = workshopPage.selectStudio()             # Verifying displayed location name and searched location name is same
        studioName = studioDetailsPage.getStudioName()
        if name == studioName:
            log.info("Displayed location name %r" % studioName + "is same as first searched name %r" % name)
        else:
            log.info("Displayed location name %r" % studioName + "is different from first searched name %r" % name)

        day = getInputData["weekDay"]                               # Getting appointment details on a specific week day
        log.info("Getting details for appointments on %r " % day)
        studioDetailsPage.printMeetings(day)
Ejemplo n.º 9
0
 def test_logoutSubmission(self):
     log = self.getLogger()
     home = HomePage(self.driver)
     home.getLogoutText().click()
     self.verifyLinkPresence("Login | Signup")
     loginText = home.getLoginText().text
     log.info("text received from Login button is" + loginText)
     assert ("Login | Signup" in loginText)
 def test_verifyHomePageTitle(self, getInputData):       # Test method to verify the home page link
     log = self.getLogger()
     log.info("Verifying the Home page link")
     homePage = HomePage(self.driver)
     homePageTitle = homePage.getTitle()
     if homePageTitle != getInputData["homePage_title"]:
         log.debug("Verification Failed: Home Page title is not %r" % getInputData["homePage_title"])
     else:
         log.info("Verification Passed: Home Page title is %r" % getInputData["homePage_title"])
Ejemplo n.º 11
0
    def test_e2e(self):
        log = self.getLogger()
        nameList = ['Blackberry']
        cartList = []
        homePage = HomePage(self.driver)
        # homePage.shopItems().click()
        Checkoutpage = homePage.shopItems()
        # here we can use driver in two ways one is passing the setup fixture into test case and also by defining request.cls.driver = driver then to self.driver
        # you can only access the class driver is with the self
        # carts = self.driver.find_element_by_css_selector(".card-title a")
        # Checkoutpage = checkOutPage(self.driver)
        carts = Checkoutpage.getCarts()
        i = -1
        for cart in carts:
            i = i + 1
            # name = cart.find_element_by_xpath("//div//h4//a")[i].text
            name = cart.text
            log.info(name)
            print(name)
            if name == "Blackberry":
                # cart.find_elements_by_xpath("div//button").click()
                Checkoutpage.getCardFooter()[i].click()
        # self.driver.find_element_by_css_selector(".btn-primary").click()
        Checkoutpage.goToCheckOutButton().click()
        # items = self.driver.find_elements_by_xpath("//div[@class='media']//div//h4//a")
        items = Checkoutpage.getItems()
        for item in items:
            cartList.append(item.text)
        print(cartList)
        log.info(cartList)

        assert nameList == cartList

        # self.driver.find_element_by_css_selector(".btn-success").click()
        # Checkoutpage.clickOnCheckOut().click()
        Confirmpage = Checkoutpage.clickOnCheckOut()
        # self.driver.find_element_by_id("country").send_keys("Ind")
        # Confirmpage = confirmPage(self.driver)
        log.info("Passing the keyword as Ind ")
        Confirmpage.getCountry().send_keys("Ind")
        # wait = WebDriverWait(self.driver, 7)
        # wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, "India")))
        self.verifyLinkPresence("India")
        # self.driver.find_element_by_link_text("India").click()
        Confirmpage.getSelectCountry().click()
        # self.driver.find_element_by_css_selector("[for=checkbox2]").click()
        Confirmpage.checkBox().click()
        # self.driver.find_element_by_css_selector("[type='submit']").click()
        Confirmpage.purchaseClick().click()
        # successMessage = self.driver.find_element_by_class_name("alert-success").text
        successMessage = Confirmpage.successMessage().text
        print(successMessage)
        log.info("Success message will be " + successMessage)
        assert "Success!" in successMessage

        self.driver.get_screenshot_as_file("photo.png")
Ejemplo n.º 12
0
 def test_SuggestKeyWord(self):
     homePage = HomePage(self.driver)
     # Type keyword
     homePage.setSearchKeyword(self.keyword)
     # Get all suggest keywords
     suggestKeyWords_list = homePage.getAllSuggestKeyWords()
     # Check all suggest keywords
     for suggestKeyword in suggestKeyWords_list:
         self.assertIn(self.keyword, suggestKeyword.lower(),
                       'Suggest keyword is not suitable!')
 def test_share_to_twitter(self):
     # Feature: Chi tiết sản phẩm; Title: Share to TWitter
     homePage = HomePage(self.driver)
     homePage.click_product_image(1)
     productDetailPage = ProductDetailPage(self.driver)
     productDetailPage.click_tweet()
     time.sleep(5)
     window_after = self.driver.window_handles[1]
     self.driver.switch_to.window(window_after)
     self.assertTrue(productDetailPage.login_twitter('vicvu8', '123456aA@'))
Ejemplo n.º 14
0
    def test_validLogin(self):
        homePage = HomePage(self.driver)
        loginPage = LoginPage(self.driver)
        uploadPage = UploadPage(self.driver)

        homePage.homeUsersLinkAccess()

        loginPage.homeUserLogin()

        uploadPage.validateUploadSection()
Ejemplo n.º 15
0
    def test_e2e(self):
        log = self.getLogger()
        homepage = HomePage(self.driver)
        objects = homepage.shopItems()
        cards = objects.getCardTitles()
        log.info("Getting all card titles.")
        i = -1
        for card in cards:
            i = i + 1
            cardText = card.text
            log.info(cardText)
            if cardText == "Blackberry":
                objects.getCardFooter()[i].click()

        time.sleep(2)

        checkout_items = objects.gotoCheckout(
        )  # confirm items and transit checkout page

        phones = checkout_items.Items()

        for phone in phones:
            if phone.text == "Blackberry":
                print("Asserted")
                break

        price_info = checkout_items.getPrices()
        for element in price_info:
            log.info(element.text[3:])

        confirm = checkout_items.confirmCheckout(
        )  # confirm checkout and transit to next page

        assert "location" in confirm.getLabels().text
        log.info("Entering country name as 'In' for searching India")
        confirm.getDropdown().send_keys("In")
        self.verifyLinkPresence("India")
        log.info("Selecting country as India")

        # confirm.waitCountry().click()
        self.driver.find_element_by_link_text("India").click()
        time.sleep(2)
        self.driver.execute_script("arguments[0].click();",
                                   confirm.getCheckbox())
        time.sleep(2)
        assert confirm.getCheckbox().is_enabled()

        self.driver.execute_script("arguments[0].click();",
                                   confirm.getSubmitButton())
        time.sleep(1)
        log.info("Text received is: " + confirm.getSuccessMessage().text)

        assert "Success! Thank you" in confirm.getSuccessMessage().text
 def test_send_to_a_friend(self):
     # Feature: Chi tiết sản phẩm; Title:Send to friend
     homePage = HomePage(self.driver)
     homePage.click_product_image(1)
     productDetailPage = ProductDetailPage(self.driver)
     productDetailPage.click_send_to_a_friend()
     productDetailPage.set_friend_name('Alexander')
     productDetailPage.set_friend_email('*****@*****.**')
     productDetailPage.send_to_a_friend()
     send_to_a_friend_message = productDetailPage.get_send_to_a_friend_message(
     )
     self.assertEqual('Your e-mail has been sent successfully',
                      send_to_a_friend_message,
                      "Send to a friend unsuccessfully!")
 def test_CreateAccount_Error(self):
     loginPage = LoginPage(self.driver)
     homePage = HomePage(self.driver)
     # Click Sign In button
     homePage.clickSignIn()
     # Typing email
     loginPage.setEmail_Create(self.emailCreate_fail)
     # Click Submit button
     loginPage.clickSubmit_Create()
     # Check the Invalid Email Message (Create Account)
     create_account_error_message = loginPage.getCreateAccountError_messages(
     )
     self.assertEqual(self.invalidEmailCreate_message,
                      create_account_error_message,
                      "Error Message is not match!")
Ejemplo n.º 18
0
 def __init__(self, context):
     self.base_page = BasePage(context)
     self.cart_page = CartPage(context)
     self.catalog_page = CatalogPage(context)
     self.home_page = HomePage(context)
     self.login_page = LoginPage(context)
     self.product_page = ProductPage(context)
    def test_e2e(self):

        log = self.get_logger()
        home_page = HomePage(self.driver)
        self.driver.maximize_window()
        # self.driver.find_element_by_css_selector("a[href*='shop']").click()
        checkout_page = home_page.shop_items()
        # products = self.driver.find_elements_by_xpath("//div[@class='card h-100']")
        log.info("Getting all products")
        products = checkout_page.get_products()

        i = 0
        for product in products:
            # productName = product.find_element_by_xpath("div/h4/a").text
            product_name = re.search('^\D+[^\d]', product.text)[0] # TODO: odladit regex a odfiltrovat linebreaky nebo vhodněji definovat selector
            log.info(product_name)
            if "Blackberry" in product_name:
                # Add item into cart
                # product.find_elements_by_css_selector(".card-footer button")[i].click()
                checkout_page.get_add_buttons()[i].click()
            i += 1

        # self.driver.find_element_by_css_selector("a[class*='btn-primary']").click()
        checkout_page.get_checkout().click()
        # self.driver.find_element_by_xpath("//button[@class='btn btn-success']").click()
        confirm_page = checkout_page.get_final_checkout()
        # self.driver.find_element_by_id("country").send_keys("ind")
        log.info("Entering country name.")
        confirm_page.get_delivery_location().send_keys("ind")
        # wait = WebDriverWait(self.driver, 10)
        # wait.until(ec.presence_of_element_located((By.LINK_TEXT, "India")))
        self.verify_link_presence(By.LINK_TEXT, "India")
        # self.driver.find_element_by_link_text("India").click()
        confirm_page.get_country().click()
        # self.driver.find_element_by_xpath("//div[@class='checkbox checkbox-primary']").click()
        confirm_page.get_terms_and_conditions().click()
        # self.driver.find_element_by_css_selector("[type='submit']").click()
        confirm_page.get_purchase_button().click()
        # successText = self.driver.find_element_by_class_name("alert-success").text
        success_text = confirm_page.get_success_paragraph().text
        log.info(f"Text received from app is: {success_text}")

        assert "Success! Thank you!" in success_text

        self.driver.get_screenshot_as_file("screen.png")
Ejemplo n.º 20
0
 def test_TypeSearchKeyWord(self):
     homePage = HomePage(self.driver)
     # Send keyword to the input field
     homePage.setSearchKeyword(self.keyword)
     # Check the search Keyword after typing
     self.assertEqual(self.keyword, homePage.getSearchKeyword(),
                      "Do not automatically delete placeholder!")
     homePage.clearSearchKeyWord()
     # Check the placeholder after clearing the search keyword
     self.assertEqual(self.placehoder, homePage.getSearchPlaceHolder(),
                      'Placeholder is not match')
    def test_view_large_product_image(self):
        # Feature: Chi tiết sản phẩm; Title: Kiểm tra chức năng View Large

        homePage = HomePage(self.driver)
        homePage.click_product_image(1)  # Click a image of the first product
        productDetailPage = ProductDetailPage(self.driver)
        productDetailPage.click_big_page()
        self.get_result(productDetailPage)

        # Feature: Chi tiết sản phẩm; Title: Kiểm tra chức năng View Large; Preconditional: Click vào button [Close] trên ảnh

        productDetailPage.click_close_view_larger()
        productDetailPage.click_view_larger_button()
        self.get_result(productDetailPage)

        # Feature: Chi tiết sản phẩm; Title: Add to cart với Quantity =0
        productDetailPage.click_close_view_larger()
        #Set quantity of product
        productDetailPage.set_product_quantity(0)
        productDetailPage.click_add_to_cart()
        null_quantity_message = productDetailPage.get_null_quantity_message()
        self.assertEqual('Null quantity.', null_quantity_message,
                         "Null message is not match")

        # Feature: Chi tiết sản phẩm; Title: Add to cart với Quantity > 0
        productDetailPage.click_close_view_larger()
        productDetailPage.set_product_quantity(1)
        product_title = productDetailPage.getProductTitle(
        )  # Get the title of the product
        productDetailPage.click_add_to_cart()  # Adding product to cart
        add_to_cart_successfully_message = productDetailPage.get_add_to_cart_successfully_message(
        )
        self.assertEqual('Product successfully added to your shopping cart',
                         add_to_cart_successfully_message,
                         'Message is not match!')
        productDetailPage.click_close_add_to_cart_successfully_message()
        productDetailPage.click_cart_button()
        checkOutPage = CheckOutPage(self.driver)
        product_title_cart = checkOutPage.get_product_title(1)
        product_quantity_cart = checkOutPage.get_product_quantity(1)
        self.assertEqual(product_title, product_title_cart,
                         "Product title is not match!")
        self.assertEqual('1', product_quantity_cart,
                         'Product price is not match!')
Ejemplo n.º 22
0
 def test_NewsletterSubmit(self):
     homePage = HomePage(self.driver)
     # Set Newsletter email
     homePage.setNewsletterEmail(self.newsletteremail)
     # Click Submit button
     homePage.clickSubmitNewsletter()
     # Check submit in Newsletter successfully
     self.assertEqual(self.allertSuccess, homePage.getAllertSuccess(),
                      "Submit newsletter emai unsuccesfully!")
Ejemplo n.º 23
0
    def test_addToCart(self):
        log = self.getLogger()
        home = HomePage(self.driver)
        products = ProductDetailsPage(self.driver)
        checkout = CheckOutPagePage(self.driver)
        action = ActionChains(self.driver)
        action.move_to_element(home.getCategory()).perform()
        mainCatList = home.getMainCategory()
        # count = len(cat1List)

        # level1category = 11
        # for cat1 in cat1List:
        #     log.info("Category 1 list Found : " + cat1.text)
        #     assert count == level1category
        log.info("Main Category is : " + mainCatList[0].text)
        action.move_to_element(mainCatList[0]).perform()
        subCatList = home.getSubCategory()
        log.info("Sub Category is : " + subCatList[1].text)
        action.move_to_element(subCatList[1]).click().perform()
        self.verifyAllLinkPresence("//div[9]")
Ejemplo n.º 24
0
    def test_SearchProducts(self):
        log = self.getLogger()
        home = HomePage(self.driver)

        searchText = "milk"
        home.getTopSearch().send_keys(searchText)
        home.getSearchButton().click()
        self.verifyAllLinkPresence("//div[@class='product-item-container product-grid4']")
        productsList = home.getSearchProductTitles()

        for productLink in productsList:
            log.info("Product Link Test Found: " + productLink.text)
            assert (searchText.casefold() in productLink.text.casefold())
Ejemplo n.º 25
0
    def test_loginSubmission(self, getData):
        # Get logger
        log = self.getLogger()
        login = LoginPage(self.driver)
        home = HomePage(self.driver)
        # Click login signup link
        home.getLoginText().click()
        # Wait until login modal appears
        self.verifyLinkPresence("Forgot Password ?")

        # Enter email and password
        log.info("Email or Mobile no is" + getData["email"])
        login.getemail().send_keys(getData["email"])
        log.info("Password is" + getData["password"])
        login.getpassword().send_keys(getData["password"])
        login.getLoginButton().click()
        # Wait until Log Out link appears
        self.verifyLinkClickable("//b[contains(text(),'Log Out')]")
        #self.driver.implicitly_wait(10)
        # Assert Log Out link
        logoutText = home.getLogoutText().text
        log.info("text received from Logout button is" + logoutText)
        assert ("Log Out" in logoutText)
        self.driver.refresh()
Ejemplo n.º 26
0
    def test_contact_us(self):

        self.driver = webdriver.Chrome(
            executable_path=r'C:\Drivers\chromedriver_win32\chromedriver.exe')
        self.driver.maximize_window()

        # self.driver = self.init_browser(browser)
        self.driver.get(self.baseURL)
        homePage = HomePage(self.driver)
        contactUs = ContactUsPage(self.driver)
        # Click Contact Us button
        homePage.clickContactUs()
        # Select subject heading in Contact Us Page
        contactUs.selectSubjectHeading(self.subjectHeading)
        # Typing email address
        contactUs.setEmailAdress(self.email)
        # Typing Order Reference
        contactUs.setOrderReference(self.orderReference)
        # Typing message
        contactUs.setMessage(self.message)
        # Attach File
        contactUs.attach_file_and_send(self.file)
        self.assertEqual(contactUs.getAllertSucess(), self.allertSucess,
                         "Submit Message in Contact us unsucessfully!")
Ejemplo n.º 27
0
 def test_Search_fail(self):
     homePage = HomePage(self.driver)
     searchPage = SearchPage(self.driver)
     # Typing keyword
     homePage.setSearchKeyword(self.keyword_fail)
     # Click search button
     homePage.clickSearchButton()
     # Get message when there is no result
     searchNoResultMessage = searchPage.getSearchNoResultMessage()
     self.assertIn('No results were found for your search',
                   searchNoResultMessage, 'Something went wrong!')
Ejemplo n.º 28
0
 def test_ProductPrice(self):
     homePage = HomePage(self.driver)
     # Typing keyword
     homePage.setSearchKeyword(self.keyword)
     # Click Search Button
     homePage.clickSearchButton()
     searchPage = SearchPage(self.driver)
     # Get all products result
     allProductResult = searchPage.getAllProductsResult()
     for i in range(1, len(allProductResult) + 1):
         productPrice = searchPage.getProductPrice(i)
         # Check the existence of product price
         self.assertNotEqual('', productPrice, "Product price is empty!")
Ejemplo n.º 29
0
 def test_promotion_product(self):
     # Feature: Mua hàng; Title: Mua đồ khuyến mãi
     # self.driver.get(self.baseURL)
     # time.sleep(3)
     homePage = HomePage(self.driver)
     checkOutPage = CheckOutPage(self.driver)
     totalProducts = homePage.getAllProducts()
     # Click product which has percent reduction is 20
     homePage.click_product_belongs_to_reduction(20)
     # Click add to cart
     product_detail_page = ProductDetailPage(self.driver)
     product_detail_page.click_add_to_cart()
     # Click Proceed to checkout
     homePage.click_proceed_to_checkout()
     checkOutPage.proceed_to_checkout(self.emailSignIn, self.passwordSignIn)
     completeMessage = checkOutPage.get_complete_message()
     self.assertEqual('Your order on My Store is complete.',
                      completeMessage, "Proceed to checkout unsuccesfully")
 def test_write_a_comment(self):
     # Feature: Chi tiết sản phẩm; Title: Write a comment
     emailSignIn = '*****@*****.**'
     passwordSignIn = '123456'
     homePage = HomePage(self.driver)
     homePage.clickSignIn()
     loginPage = LoginPage(self.driver)
     loginPage.sign_in(emailSignIn, passwordSignIn)
     self.driver.implicitly_wait(10)
     self.driver.get(self.baseURL)
     homePage.click_product_image(1)
     productDetailPage = ProductDetailPage(self.driver)
     productDetailPage.leave_review('Comment', 'Good')
     send_review_message = productDetailPage.get_send_review_message()
     self.assertEqual(
         'Your comment has been added and will be available once approved by a moderator',
         send_review_message, "Send review unsuccessfully")