def test_checkDuplicate21Item(self):
     driver = self.driver
     driver.maximize_window()
     driver.get(self.base_url)
     text = 'Remove item?'
     text1 = 'Are you sure you want to remove this item?'
     LoginPage.loginAction(self, 'SellerTestpsq', 'Ss123456')
     NavigationMenuPage.clickSellerButton(self)
     SheetsPage.openSheets(self)
     SheetsPage.clickDuplicate(self)
     time.sleep(3)
     self.assertEqual(
         len(
             self.driver.find_elements_by_css_selector(
                 "[data-test-id='remove']")), 42)
     SheetsPage.closeSheets(self)
     SheetsPage.openSheets(self)
     self.assertEqual(
         len(
             self.driver.find_elements_by_css_selector(
                 "[data-test-id='remove']")), 40)
     SheetsPage.deleteItem(self)
     self.assertEqual(text, HelperTestBase.getModalHeader(self))
     self.assertEqual(text1, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
     HelperTestBase.clickYesButton(self)
Ejemplo n.º 2
0
    def test_checkXSSValidation(self):
        driver = self.driver
        driver.maximize_window()
        driver.get(self.base_url)
        text = 'alert("xss-injection!")'
        text2 = '<script>'
        text1 = '<script>alert("xss-injection!")</script>'
        LoginPage.loginAction(self, 'SellerTestege', 'Ss123456')
        NavigationMenuPage.clickSellerButton(self)
        SheetsPage.openSheets(self)
        time.sleep(2)
        # Checking on XSS injections :
        SheetsPage.editProductItemField(
            self, '<script>alert("xss-injection!")</script>')
        SheetsPage.editSellerNameField(
            self, '<script>alert("xss-injection!")</script>')
        SheetsPage.editDescription(self,
                                   '<script>alert("xss-injection!")</script>')
        SheetsPage.editProductCode(self,
                                   '<script>alert("xss-injection!")</script>')
        SheetsPage.clickSaveButton(self)
        HelperTestBase.clickYesButton(self)
        SheetsPage.closeSheets(self)
        SheetsPage.openSheets(self)
        time.sleep(5)
        self.assertNotIn(text1, self.driver.page_source)
        self.assertIsNot(True, self.driver.switch_to_active_element)

        # return test data:
        SheetsPage.editProductItemField(self, 'Test Item')
        SheetsPage.editSellerNameField(self, 'Test Description')
        SheetsPage.editDescription(self, 'Test Description')
        SheetsPage.editProductCode(self, 'Test Product Code')
        SheetsPage.clickSaveButton(self)
        HelperTestBase.clickYesButton(self)
 def test_checkDuplicateItemSuccessAndRemove(self):
     driver = self.driver
     driver.maximize_window()
     driver.get(self.base_url)
     text = 'Remove item?'
     text1 = 'Are you sure you want to remove this item?'
     LoginPage.loginAction(self, 'Bob', 'Ss123456')
     NavigationMenuPage.clickSellerButton(self)
     SheetsPage.openSheets(self)
     SheetsPage.clickDuplicate(self)
     SheetsPage.closeSheets(self)
     SheetsPage.openSheets(self)
     SheetsPage.deleteItem(self)
     self.assertEqual(text, HelperTestBase.getModalHeader(self))
     self.assertEqual(text1, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
     HelperTestBase.clickYesButton(self)
Ejemplo n.º 4
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))
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
    def test_checkRemoveItemCheck20Items(self):
        url1 = self.base_url + '/inventory-list'
        url2 = self.base_url + '/shopping-list'
        url4 = self.base_url + '/inventory-sheet'
        text = 'Remove item?'
        text1 = 'Are you sure you want to remove this item?'
        x = StringGenerator('[\c]{5}').render()

        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'SellerTestcjd', 'Ss123456')

        time.sleep(3)
        self.assertEqual(url2, HelperTestBase.getURL(self))
        NavigationMenuPage.clickSellerButton(self)
        self.assertEqual(url1, HelperTestBase.getURL(self))
        self.assertEqual(
            True,
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='inventoryItem-0"))
        self.assertEqual(
            True,
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='inventoryItem-1"))
        self.assertEqual(
            True,
            HelperTestBase.checkElementPresent(
                self, "[data-test-id='inventoryItem-30"))

        SheetsPage.openSheets(self)

        elements = self.driver.find_elements_by_css_selector(
            "[data-test-id='remove']")
        self.assertIs(True, elements[0].is_displayed())
        self.assertIs(True, elements[19].is_displayed())

        SheetsPage.deleteItem(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        HelperTestBase.clickYesButton(self)
        time.sleep(3)
        self.assertEqual(
            len(
                self.driver.find_elements_by_css_selector(
                    "[data-test-id='remove']")), 38)
        SheetsPage.closeSheets(self)
        SheetsPage.openSheets(self)
        self.assertEqual(
            len(
                self.driver.find_elements_by_css_selector(
                    "[data-test-id='remove']")), 40)
        SheetsPage.closeSheets(self)

        ProductEditorPage.addProductWithoutYear(self,
                                                title='Test Item' + x,
                                                description='test' + x,
                                                price='1',
                                                sortUnits='Each',
                                                currentQuantityInp='10',
                                                sortQTY='Each',
                                                country='Canada',
                                                productCodeInp='test',
                                                salePrice='1',
                                                sortSalePrice='Each')
        time.sleep(1)
        HelperTestBase.clickYesButton(self)