예제 #1
0
    def test_editProduct(self):
        # Test scope - Edit the product> click Save button => the changes are saved:

        url = self.base_url + '/shopping-list'
        text1 = 'The item has been successfully updated.'
        text = 'Success:'
        text3 = 'New Sveta'
        text4 = 'Test New Item Test'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        time.sleep(5)
        self.assertEqual(url, HelperTestBase.getURL(self))
        ProductEditorPage.editProduct(self, 'New Sveta')
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        self.assertIn(text3, self.driver.page_source)

        ##Test scope - user can re-change after the changes have been saved

        ProductEditorPage.editProduct(self, 'Test New Item Test')
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        self.assertIn(text4, self.driver.page_source)
예제 #2
0
    def test_deleteAdd_Item_InventoryList(self):
        url = self.base_url + '/shopping-list'
        url1 = self.base_url + '/inventory-list'
        text = 'Success:'
        text1 = 'A new item has been successfully created.'
        text2 = 'Remove item?'
        text3 = 'Are you sure you want to remove this item?'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')

        NavigationMenuPage.clickSellerButton(self)
        self.assertEqual(url1, HelperTestBase.getURL(self))
        ## Click on 'delete' button
        InventoryListPage.deleteItem(self)
        self.assertEqual(text2, HelperTestBase.getModalHeader(self))
        self.assertEqual(text3, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickCancelButton(self)
        # click on No button  = > Inventory list is displayed
        InventoryListPage.deleteItem(self)
        self.assertEqual(text2, HelperTestBase.getModalHeader(self))
        self.assertEqual(text3, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        ########## Test scope Seller create item => the item added to Inventory List:
        ProductEditorPage.returtTestData(self, title='Test Apple', price='2',
                                         description='test', sortUnits='Each',
                                         currentQuantityInp='100', sortQTY='Each',
                                         country='Canada', productCodeInp='test product')

        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
예제 #3
0
    def test_checkMapsOnEvent(self):
        url = self.base_url + '/shopping-list'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'SellerTesthtd', 'Ss123456')
        time.sleep(3)

        NavigationMenuPage.clickSellerButton(self)
        HelperTestBase.clickAndWait(self, "[data-test-id='inventoryItem-0']")

        ProductEditorPage.clickEventTitle(self)
        time.sleep(6)
        self.assertIs(ProductEditorPage.checkMapPresent(self), True)
예제 #4
0
    def test_clickCancelButton(self):
        url = self.base_url + '/shopping-list'
        url2 = self.base_url + '/product-editor'
        url1 = self.base_url + '/inventory-list'
        text = 'Cancel editing?'
        text1 = 'All your changes will be lost!'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        NavigationMenuPage.clickSellerButton(self)
        time.sleep(3)
        ProductEditorPage.goProductEditor(self)
        ProductEditorPage.clickCancel(self)

        # HelperTestBase.clickAndWait(self, "[data-test-id='inventoryItem-0']")
        # self.assertEqual(url2, HelperTestBase.getURL(self))
        # self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='cancelLink']"), True)
        # HelperTestBase.clickAndWait(self, "[data-test-id='cancelLink']")
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        time.sleep(3)
        self.assertEqual(url1, HelperTestBase.getURL(self))
        # Test scope - check available item after editing:
        ProductEditorPage.goProductEditor(self)
        ProductEditorPage.clickSaveButton(self)
        HelperTestBase.clickYesButton(self)
예제 #5
0
 def test_Add_Remove_EventAction(self):
     url2 = self.base_url + '/event'
     url = self.base_url + '/shopping-list'
     url1 = self.base_url + '/product-editor'
     text1 = 'Success:'
     text2 = 'The item has been successfully updated.'
     text7 = 'The event has been successfully processed!'
     text3 = 'Remove event?'
     text4 = 'Are you sure you want to remove this event?'
     text5 = 'Warning:'
     text6 = 'This item has already been presented on this market!'
     driver = self.driver
     driver.get(self.base_url)
     LoginPage.loginAction(self, 'Bob', 'Ss123456')
     ### add new Event :
     ProductEditorPage.goProductEditor(self)
     ProductEditorPage.addEventAction(self)
     SearchScreenPage.submitSearchMarketEvent(self, 'mars')
     time.sleep(3)
     #### Test scope - Search the Mars market => the elements are present in the list:
     self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='abstractListProduct_0']"), True)
     self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='abstractListProduct_1']"), True)
     AddEventPage.selectMarket(self)
     # Click on Save button => the appropriate message is displayed:
     ProductEditorPage.clickSaveButton(self)
     self.assertEqual(text1, HelperTestBase.getModalHeader(self))
     self.assertEqual(text7, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
     # Click on delete button on Event => the appropriate message is displayed:
     HelperTestBase.clickAndWait(self, "[data-test-id='removeEvent']")
     self.assertEqual(text3, HelperTestBase.getModalHeader(self))
     self.assertEqual(text4, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
     time.sleep(2)
     ProductEditorPage.clickSaveButton(self)
예제 #6
0
 def test_clickSaveButton(self):
     url = self.base_url + '/shopping-list'
     url2 = self.base_url + '/product-editor'
     url1 = self.base_url + '/inventory-list'
     text = 'Success:'
     text1 = 'The item has been successfully updated.'
     driver = self.driver
     driver.get(self.base_url)
     LoginPage.loginAction(self, 'Bob', 'Ss123456')
     ###### Test scope - check available item after editing:    ###########
     ProductEditorPage.goProductEditor(self)
     ProductEditorPage.clickSaveButton(self)
     self.assertEqual(text, HelperTestBase.getModalHeader(self))
     self.assertEqual(text1, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
예제 #7
0
 def test_addProductEmptyFields(self):
     url = self.base_url + '/shopping-list'
     text1 = 'The field TITLE is required. Please, fill it in.'
     text11 = 'Cancel editing?'
     text12 = 'All your changes will be lost!'
     text = 'Error:'
     driver = self.driver
     driver.get(self.base_url)
     LoginPage.loginAction(self, 'Bob', 'Ss123456')
     time.sleep(3)
     ProductEditorPage.setTitleOnly(self, '')
     self.assertEqual(text, HelperTestBase.getModalHeader(self))
     self.assertEqual(text1, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
     ProductEditorPage.clickCancel(self)
     self.assertEqual(text11, HelperTestBase.getModalHeader(self))
     self.assertEqual(text12, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
예제 #8
0
    def test_setInvalidSalePrice(self):
        url = self.base_url + '/shopping-list'
        text = 'Error:'
        text1 = 'Unacceptable price value!'
        text4 = 'The field AVAILABLE QUANTITY is required. Please, fill it in.'
        text11 = 'Cancel editing?'
        text12 = 'All your changes will be lost!'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        time.sleep(5)

        ProductEditorPage.setInvalidSalePrice(self,
                                              title='Test Kolobok',
                                              price="3",
                                              salePrice='@#$%^&asdfg',
                                              avaiableQuantityInp='1',
                                              country='Canada')
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
예제 #9
0
    def test_setDeliveryMethodWitoutCountry(self):
        url = self.base_url + '/shopping-list'
        text = 'Success:'
        text1 = 'The field COUNTRY OF ORIGIN is required. Please, fill it in.'
        text2 = 'A new item has been successfully created.'
        text11 = 'Cancel editing?'
        text12 = 'All your changes will be lost!'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        time.sleep(5)

        ProductEditorPage.setDeliveryMethodWitoutCountry(
            self, title='Test Item Apple', price='2', avaiableQuantityInp='3')
        time.sleep(3)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text2, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        InventoryListPage.deleteItem(self)
        HelperTestBase.clickYesButton(self)
예제 #10
0
 def test_checkWitoutSortQTY(self):
     url = self.base_url + '/shopping-list'
     text = 'Error:'
     text1 = 'The field UNITS (after Available quantity field) is required. Please, fill it in.'
     text11 = 'Cancel editing?'
     text12 = 'All your changes will be lost!'
     driver = self.driver
     driver.get(self.base_url)
     LoginPage.loginAction(self, 'Bob', 'Ss123456')
     time.sleep(5)
     self.assertEqual(url, HelperTestBase.getURL(self))
     ProductEditorPage.setQTY(self, 'Test Apple', '2', '3')
     time.sleep(3)
     self.assertEqual(text, HelperTestBase.getModalHeader(self))
     self.assertEqual(text1, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
     ProductEditorPage.clickCancel(self)
     self.assertEqual(text11, HelperTestBase.getModalHeader(self))
     self.assertEqual(text12, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
예제 #11
0
    def test_checkWitoutUnits(self):
        url = self.base_url + '/shopping-list'
        text = 'Error:'
        text1 = 'The field UNITS (after Selling price field) is required. Please, fill it in.'
        text11 = 'Cancel editing?'
        text12 = 'All your changes will be lost!'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        HelperTestBase.waitSettingsButton(self)

        ProductEditorPage.setPrice(self, 'Test Item', '2')
        time.sleep(3)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        ProductEditorPage.clickCancel(self)
        self.assertEqual(text11, HelperTestBase.getModalHeader(self))
        self.assertEqual(text12, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
예제 #12
0
 def test_setInvalidPrice(self):
     url = self.base_url + '/shopping-list'
     text = 'Error:'
     text1 = 'Unacceptable PRICE value!'
     text11 = 'Cancel editing?'
     text12 = 'All your changes will be lost!'
     driver = self.driver
     driver.get(self.base_url)
     LoginPage.loginAction(self, 'Bob', 'Ss123456')
     time.sleep(5)
     ProductEditorPage.setInvPrice(self,
                                   title='Test Item',
                                   price='Asdf!@#$%')
     self.assertEqual(text, HelperTestBase.getModalHeader(self))
     # self.assertEqual(text1, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
     ProductEditorPage.clickCancel(self)
     self.assertEqual(text11, HelperTestBase.getModalHeader(self))
     self.assertEqual(text12, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
예제 #13
0
    def test_clickAddEventButton(self):
        url2 = self.base_url + '/event'
        url = self.base_url + '/shopping-list'
        url1 = self.base_url + '/product-editor'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')

        ProductEditorPage.goProductEditor(self)
        ProductEditorPage.addEventAction(self)
        #### Test scope - the elements are present:

        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='shoppingLink']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='searchInp']"), True)

        ### Test scope - Click on < button  => 'ProductEditor page' page is opened:

        HelperTestBase.reliableClick(self, "[data-test-id='shoppingLink']")
        time.sleep(2)
        self.assertEqual(url1, HelperTestBase.getURL(self))
예제 #14
0
    def test_addProductSuccess(self):
        url = self.base_url + '/shopping-list'
        url2 = self.base_url + '/product-editor'
        url1 = self.base_url + '/inventory-list'
        text = 'Success:'
        text1 = 'A new item has been successfully created.'
        text3 = 'Remove item?'
        text4 = 'Are you sure you want to remove this item?'

        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        # LoginPage.loginAction(self, 'SellerTesttze', 'Ss123456')
        time.sleep(5)

        x = StringGenerator('[\c]{5}').render()

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

        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        self.driver.refresh()
        time.sleep(5)
        ##### RETURT to start-
        NavigationMenuPage.clickSellerButton(self)
        InventoryListPage.deleteItem(self)
        self.assertEqual(text3, HelperTestBase.getModalHeader(self))
        self.assertEqual(text4, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
예제 #15
0
 def test_checkWithoutQTY(self):
     url = self.base_url + '/shopping-list'
     text = 'Error:'
     text1 = 'The field AVAILABLE QUANTITY is required. Please, fill it in.'
     text11 = 'Cancel editing?'
     text12 = 'All your changes will be lost!'
     driver = self.driver
     driver.get(self.base_url)
     LoginPage.loginAction(self, 'Bob', 'Ss123456')
     time.sleep(2)
     ProductEditorPage.setQTY(self,
                              title='Test Apple',
                              price='2',
                              avaiableQuantityInp='')
     self.assertEqual(text, HelperTestBase.getModalHeader(self))
     self.assertEqual(text1, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
     ProductEditorPage.clickCancel(self)
     self.assertEqual(text11, HelperTestBase.getModalHeader(self))
     self.assertEqual(text12, HelperTestBase.getModalMessage(self))
     HelperTestBase.clickYesButton(self)
예제 #16
0
    def test_checkWithCountryWithoutDeliveryMethod(self):
        url = self.base_url + '/shopping-list'
        text = 'Error:'
        text1 = 'You should choose DELIVERY method.'
        text11 = 'Cancel editing?'
        text12 = 'All your changes will be lost!'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        time.sleep(5)

        ProductEditorPage.setCountryWithoutDeliveryMethod(
            self, 'Test Apple', '2', '3', 'Afghanistan')
        time.sleep(3)
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text1, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        ProductEditorPage.clickCancel(self)
        self.assertEqual(text11, HelperTestBase.getModalHeader(self))
        self.assertEqual(text12, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
예제 #17
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))
예제 #18
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)
예제 #19
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)
예제 #20
0
    def test_checkEventRedirectToMarketPage(self):
        url2 = 'http://www.moontwp.com/'
        url = self.base_url + '/shopping-list'
        url1 = self.base_url + '/product-editor'
        urlMarket = 'http://www.lemarsiowa.com/'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')

        ProductEditorPage.goProductEditor(self)
        ProductEditorPage.addEventAction(self)
        SearchScreenPage.submitSearchMarketEvent(self, 'mars')
        time.sleep(3)
        #### Test scope - Search the Mars market => the elements are present in the list:
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='abstractListProduct_0']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='abstractListProduct_1']"), True)
        AddEventPage.selectMarket(self)
        ProductEditorPage.clickSaveButton(self)
        HelperTestBase.clickYesButton(self)
        time.sleep(3)

        # Test scope - click on event title => the market title is present, Cancel button is present:

        ProductEditorPage.clickEventTitle(self)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='marketTitle']"), True)
        self.assertIs(HelperTestBase.checkElementPresent(self, "[data-test-id='cancelLink']"), True)
        # Test scope - click on Cancel icon => Product editor is opened:
        HelperTestBase.clickAndWait(self, "[data-test-id='cancelLink']")
        self.assertEqual(url1, HelperTestBase.getURL(self))

        ProductEditorPage.clickEventTitle(self)
        # Test scope - click on market title => market page is opened:
        HelperTestBase.reliableClick(self, "[data-test-id='marketWebPage']")
        time.sleep(5)
        driver.switch_to_window(driver.window_handles[1])
        HelperTestBase.waitURL(self, urlMarket)
        self.assertEqual(urlMarket, HelperTestBase.getURL(self))

        driver.switch_to_window(driver.window_handles[0])
        HelperTestBase.clickAndWait(self, "[data-test-id='cancelLink']")
        time.sleep(4)

        # Click on delete button on Event => the appropriate message is displayed:
        HelperTestBase.clickAndWait(self, "[data-test-id='removeEvent']")
        HelperTestBase.clickYesButton(self)
        time.sleep(3)
        ProductEditorPage.clickSaveButton(self)
예제 #21
0
    def test_setInvalidQTY(self):
        url = self.base_url + '/shopping-list'
        text = 'Error:'
        text1 = 'Unacceptable QUANTITY value!'
        text5 = 'The field AVAILABLE QUANTITY is required. Please, fill it in.'
        text11 = 'Cancel editing?'
        text12 = 'All your changes will be lost!'
        driver = self.driver
        driver.get(self.base_url)
        LoginPage.loginAction(self, 'Bob', 'Ss123456')
        time.sleep(5)

        # ProductEditorPage.addProductWithoutYear(self, title='Test Product', price='2',
        #                       description='test', sortUnits='Each',
        #                       currentQuantityInp='asdf', sortQTY='Each',
        #                       country='Canada', productCodeInp='#test',
        #                       salePrice='1', sortSalePrice='Each')
        ProductEditorPage.openProductEditor(self)
        ProductEditorPage.setTitle(self, 'Test Apple')
        ProductEditorPage.setPrice1(self, '2')
        ProductEditorPage.sortUnits(self, 'Each')
        ProductEditorPage.clickSaveButton(self)

        # ProductEditorPage.setQTY(self, title='Test Product', price='2', currentQuantityInp='Asdf')
        self.assertEqual(text, HelperTestBase.getModalHeader(self))
        self.assertEqual(text5, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)
        ProductEditorPage.clickCancel(self)
        self.assertEqual(text11, HelperTestBase.getModalHeader(self))
        self.assertEqual(text12, HelperTestBase.getModalMessage(self))
        HelperTestBase.clickYesButton(self)

        ##### delete the new item from Inventory List:
        InventoryListPage.deleteItem(self)