Ejemplo n.º 1
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)
Ejemplo n.º 2
0
    def test_checkAvailableQuantityValidation(self):
        driver = self.driver
        driver.maximize_window()
        driver.get(self.base_url)
        text = 'Error:'
        text6 = 'Item #1 - Unacceptable AVAILABLE QUANTITY value. Must be zero or above.'
        text1 = 'Item#1 - Field AVAILABLE QUANTITY is required. Please, fill it in.'
        text5 = 'Incorrect value type for QTYUNITID field.'
        text7 = 'Item#1 - Field AVAILABLE QUANTITY is required. Please, fill it in.'
        text3 = '$123'
        text4 = '543'
        LoginPage.loginAction(self, 'SellerTestege', 'Ss123456')
        NavigationMenuPage.clickSellerButton(self)
        SheetsPage.openSheets(self)
        time.sleep(2)
        SheetsPage.editAvailableQuantity(self, '-1')
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text6, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        SheetsPage.editAvailableQuantity(self, '0')
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        SheetsPage.editAvailableQuantity(self, '123#456Afghj')
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text7, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        SheetsPage.editAvailableQuantity(self, '054')
        SheetsPage.clickSaveButton(self)
        time.sleep(2)
        self.assertIn(text4, self.driver.page_source)

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

        SheetsPage.editAvailableQuantity(
            self, '<script>alert("xss-injection!")</script>')
        SheetsPage.clickSaveButton(self)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        ##### Returt test data:
        SheetsPage.editAvailableQuantity(self, '543')
        time.sleep(2)
        self.assertIn(text4, self.driver.page_source)
Ejemplo n.º 3
0
    def test_checkCountryValidation(self):
        driver = self.driver
        driver.maximize_window()
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'SellerTestege', 'Ss123456')
        NavigationMenuPage.clickSellerButton(self)
        SheetsPage.openSheets(self)
        time.sleep(2)
        SheetsPage.selectCountry(self, text='Canada')
        SheetsPage.clickSaveButton(self)
        HelperTestBase.clickYesButton(self)

        SheetsPage.selectCountry(self, text='Panama')
        SheetsPage.clickSaveButton(self)
        HelperTestBase.clickYesButton(self)

        SheetsPage.selectCountry(self, text='Country')
        SheetsPage.clickSaveButton(self)
        HelperTestBase.clickYesButton(self)
Ejemplo n.º 4
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)