Пример #1
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!')
Пример #2
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!")
Пример #3
0
 def test_ProductQuantity(self):
     homePage = HomePage(self.driver)
     # Typing keyword
     homePage.setSearchKeyword(self.keyword)
     # Click search button
     homePage.clickSearchButton()
     searchPage = SearchPage(self.driver)
     # Get result message after searching
     searchResultMessage = searchPage.getSearchResultMessage().split()
     # Get product quantity in result message
     productQuantityMessage = int(searchResultMessage[0])
     # Get quantity of products
     productsResultQuantity = searchPage.getProductsResultQuantity()
     # Compare quantity of products to product quantity in result message
     self.assertEqual(
         productQuantityMessage, productsResultQuantity,
         'The reality quantity of products result is not match with message!'
     )