def test_checkElements(self):
        # Test scope - Buyer clicks on Categories Menu  => the 'categories menu' ( Fruits, Vegetables, Meat, Other, Bakery) is displayed:
        url = self.base_url + '/shopping-list'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'asdfgh', 'Ss123456')
        CategoriesMenuPage.clickCategoriesMenuButton(self)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Fruits']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Vegetables']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Bakery']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Other']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Meat']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='SeaFood']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Dairy']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Poultry']"), True)

        # Click on the 'footer category' button => The 'categories menu' is closed:
        CategoriesMenuPage.clickCategoriesMenuButton(self)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Fruits']"), False)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Vegetables']"), False)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Bakery']"), False)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Other']"), False)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Meat']"), False)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='SeaFood']"), False)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Dairy']"), False)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='Poultry']"), False)
    def test_clickOtherIcon(self):
            # Test scope - Buyer clicks on the image of the 'Other' category => The appropriate subcategories are displayed. :
            url = self.base_url + '/shopping-list'
            driver = self.driver
            driver.get(self.base_url)
            LoginPage.loginAction(self, 'asdfgh', 'Ss123456')

            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickOtherButton(self)
            self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='subcategory_0']"), True)
            self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='subcategory_1']"), True)
    def test_clickDairy(self):
            # Test scope -  Buyer clicks on the image of the 'Dairy' category => The appropriate subcategories are displayed:
            url = self.base_url + '/shopping-list'
            url1 = self.base_url + '/inventory-list'
            driver = self.driver
            driver.get(self.base_url)
            # LoginPage.loginAction(self, '', 'Ss1234567')
            LoginPage.loginAction(self, 'Bob', 'Ss123456')

            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickDairyButton(self)
            self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='subcategory_0']"), True)
 def test_clickSeaFood(self):
     # Test scope -  Seller clicks on the image of the 'SeaFood' category => The appropriate subcategories are displayed. :
     url = self.base_url + '/shopping-list'
     url1 = self.base_url + '/inventory-list'
     driver = self.driver
     driver.get(self.base_url)
     LoginPage.loginAction(self, 'Bob', 'Ss123456')
     NavigationMenuPage.clickSellerButton(self)
     NavigationMenuPage.clickNewItem(self)
     CategoriesMenuPage.clickSeaFoodButton(self)
     self.assertIs(
         HelperTestBase.checkElementPresent(
             self, "[data-test-id='subcategory_0']"), True)
     self.assertIs(
         HelperTestBase.checkElementPresent(
             self, "[data-test-id='subcategory_1']"), True)
    def returtTestData(self,
                       title=None,
                       price=None,
                       description=None,
                       sortUnits=None,
                       currentQuantityInp=None,
                       sortQTY=None,
                       country=None,
                       productCodeInp=None):

        NavigationMenuPage.clickNewItem(self)
        CategoriesMenuPage.clickFruitsButton(self)
        self.selectCategory()
        self.setTitle(title)
        self.setDescription(description)
        self.setPrice1(price)
        self.sortUnits(sortUnits)
        self.setQTY1(currentQuantityInp)
        self.sortQuantity(sortQTY)
        self.setProductCode(productCodeInp)
        self.sortCountry(country)
        self.clickSwitch()
        self.clickSaveButton()
Esempio n. 6
0
    def test_checkOpenSheetsAndClose(self):
        url1 = self.base_url + '/inventory-list'
        driver = self.driver
        driver.maximize_window()
        driver.get(self.base_url)
        text = 'Warning:'
        text1 = 'You have unsaved changes. Discard them?'
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        NavigationMenuPage.clickSellerButton(self)
        SheetsPage.openSheets(self)
        SheetsPage.clickCreateButton(self)
        CategoriesMenuPage.clickVegetablesButton(self)
        ProductEditorPage.selectCategory(self)
        SheetsPage.closeSheets(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickCancelButton(self)

        SheetsPage.closeSheets(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        time.sleep(3)
        self.assertEqual(url1, HelperTestBase.getURL(self))
    def test_checkCategotyVisible(self):
            # Test scope -  Buyer clicks on the image of the some category => The appropriate subcategories are displayed:
            url = self.base_url + '/shopping-list'
            url1 = self.base_url + '/inventory-list'
            text0 = 'Carrot'
            text1 = 'Cucumber'
            text2 = 'Bread'
            text3 = 'Brownies'
            text4 = "Chocolate"
            text5 = 'Flowers'
            text6 = 'Bacon'
            text7 = 'Crab'
            text8 = 'Apple'
            text9 = 'Chicken'
            text11 = 'Ice Cream'

            driver = self.driver
            driver.get(self.base_url)
            # LoginPage.loginAction(self, 'Ss', 'Ss1234567')
            LoginPage.loginAction(self, 'svetast', 'Ss1234567')
            time.sleep(4)

            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickVegetablesButton(self)
            self.assertIn(text0, self.driver.page_source)
            self.assertIn(text1, self.driver.page_source)
            HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")

            ##
            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickBakeryButton(self)
            self.assertIn(text2, self.driver.page_source)
            self.assertIn(text3, self.driver.page_source)
            HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")

            ##
            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickOtherButton(self)
            self.assertIn(text4, self.driver.page_source)
            self.assertIn(text5, self.driver.page_source)
            HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")

            ##
            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickMeatButton(self)
            self.assertIn(text6, self.driver.page_source)
            HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")

            ##
            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickSeaFoodButton(self)
            self.assertIn(text7, self.driver.page_source)
            HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")

            ##
            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickFruitsButton(self)
            self.assertIn(text8, self.driver.page_source)
            HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")

            ##
            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickPoultryButton(self)
            self.assertIn(text9, self.driver.page_source)
            HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")

            ##
            CategoriesMenuPage.clickCategoriesMenuButton(self)
            CategoriesMenuPage.clickDairyButton(self)
            self.assertIn(text11, self.driver.page_source)
            HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")
Esempio n. 8
0
    def test_checkCreateItemSuccessAndRemove(self):

        driver = self.driver
        driver.maximize_window()
        driver.get(self.base_url)

        text = 'Error:'
        text1 = 'Item#1 - You should choose DELIVERY method.'
        text2 = 'Item#1 - Field TITLE is required. Please, fill it in.'
        text3 = 'Item#1 - Field SELLING PRICE is required. Please, fill it in.'
        text4 = 'Item#1 - Field UNITS is required. Please, fill it in.'
        text5 = 'Item#1 - Field AVAILABLE QUANTITY is required. Please, fill it in.'
        text6 = 'Item#1 - Field QUANTITY UNITS is required. Please, fill it in.'

        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        NavigationMenuPage.clickSellerButton(self)
        SheetsPage.openSheets(self)
        SheetsPage.clickCreateButton(self)
        CategoriesMenuPage.clickVegetablesButton(self)
        ProductEditorPage.selectCategory(self)
        ##Don't fill out of requarement field, click on Save button=> Error is displayed:
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text2, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        ##Fill out only 'Product Item' field, click on Save button=> Error is displayed:
        SheetsPage.editProductItemField(self, 'Test Item Test')
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text3, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        ### Fill out not requarement fields Seller Name and Description:
        SheetsPage.editSellerNameField(self, 'Aist')
        SheetsPage.editDescription(self, '123 see')
        ##Don't fill out other requarement fields, click on Save button => Error is displayed:

        SheetsPage.editPrice(self, '10')
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text4, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        ##Don't fill out other requarement fields, click on Save button => Error is displayed:

        SheetsPage.selectUnits(self, 'Carton')
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text5, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        ##Don't fill out other requarement fields, click on Save button => Error is displayed:

        SheetsPage.editAvailableQuantity(self, '65')
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text6, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        SheetsPage.selectQuantityUnits(self, 'Each')
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        ### Select the not requarement fields Product Code, Sale is Active, Organic, Non GMO :
        SheetsPage.editProductCode(self, 'New Test String')
        SheetsPage.selectSaleIsActive(self)
        SheetsPage.selectOrganic(self)
        SheetsPage.selectNonGMO(self)
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        SheetsPage.selectDeliveryMethod(self)
        SheetsPage.selectMarketPickUp(self)
        SheetsPage.clickSaveButton(self)
        HelperTestBase.clickYesButton(self)
        SheetsPage.closeSheets(self)

        ######Return test data:
        SheetsPage.openSheets(self)
        SheetsPage.deleteItem(self)
        HelperTestBase.clickYesButton(self)
    def test_checkCategoriesPresent(self):

        url = self.base_url + '/shopping-list'
        url1 = self.base_url + '/inventory-list'

        driver = self.driver
        driver.get(self.base_url)
        # LoginPage.loginAction(self, 'Ss', 'Ss1234567')
        LoginPage.loginAction(self, 'Bob', 'Ss123456')

        NavigationMenuPage.clickSellerButton(self)
        HelperTestBase.wait(self, "[data-test-id='new-item']")
        NavigationMenuPage.clickNewItem(self)
        # Test scope -  Seller clicks on the image of the 'Fruits' category => The appropriate subcategories are displayed. :
        CategoriesMenuPage.clickFruitsButton(self)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_0']"), True)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_1']"), True)
        HelperTestBase.reliableClick(self, "[data-test-id='inventoryLink']")
        # Test scope -  Seller clicks on the image of the 'Vegetables' category => The appropriate subcategories are displayed. :
        NavigationMenuPage.clickNewItem(self)
        CategoriesMenuPage.clickVegetablesButton(self)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_0']"), True)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_1']"), True)
        HelperTestBase.reliableClick(self, "[data-test-id='inventoryLink']")
        # Test scope -  Seller clicks on the image of the 'Bakery' category => The appropriate subcategories are displayed:
        NavigationMenuPage.clickNewItem(self)
        CategoriesMenuPage.clickBakeryButton(self)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_0']"), True)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_1']"), True)
        HelperTestBase.reliableClick(self, "[data-test-id='inventoryLink']")

        # Test scope -  Seller clicks on the image of the 'Other' category => The appropriate subcategories are displayed. :
        NavigationMenuPage.clickNewItem(self)
        CategoriesMenuPage.clickOtherButton(self)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_0']"), True)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_1']"), True)
        HelperTestBase.reliableClick(self, "[data-test-id='inventoryLink']")

        # Test scope -  Seller clicks on the image of the 'Meat' category => The appropriate subcategories are displayed. :
        NavigationMenuPage.clickNewItem(self)
        CategoriesMenuPage.clickMeatButton(self)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_0']"), True)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_1']"), True)
        HelperTestBase.reliableClick(self, "[data-test-id='inventoryLink']")

        # Test scope -  Seller clicks on the image of the 'SeaFood' category => The appropriate subcategories are displayed. :
        NavigationMenuPage.clickNewItem(self)
        CategoriesMenuPage.clickSeaFoodButton(self)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_0']"), True)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_1']"), True)
        HelperTestBase.reliableClick(self, "[data-test-id='inventoryLink']")

        # Test scope -  Seller clicks on the image of the 'Dairy' category => The appropriate subcategories are displayed. :
        NavigationMenuPage.clickNewItem(self)
        CategoriesMenuPage.clickDairyButton(self)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_0']"), True)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_1']"), True)
        HelperTestBase.reliableClick(self, "[data-test-id='inventoryLink']")

        # Test scope -  Seller clicks on the image of the 'Poultry' category => The appropriate subcategories are displayed. :

        NavigationMenuPage.clickNewItem(self)
        CategoriesMenuPage.clickPoultryButton(self)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_0']"), True)
        self.assertIs(
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='subcategory_1']"), True)
        HelperTestBase.reliableClick(self, "[data-test-id='inventoryLink']")