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
 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!')