def test_single_description_required(self): """ Tests that single description cannot be changed to empty """ select_listings_to_edit(self.driver) d = self.driver bp = BulkPage(d) row = bp.listing_row('First something 1234 (1)') description = row.find_element_by_css_selector( 'div.body span.description') click(description) sleep(1) # delete description and check error message form = row.find_element_by_css_selector('div.body form > textarea') click(form) send_keys(form, BACKSPACE_KEYS * 4) sleep(1) error_text = bp.error_baloon_texts(row) assert error_text == ['Description is required'] # click away and check that description was not changed click( d.find_element_by_css_selector('bulk-edit-dashboard-op-container')) description_text = row.find_element_by_css_selector( 'div.body span.description').text assert description_text == 'invisible gloves'
def test_bulk_category_variations_validation(self): """ Test verifies that error message is shown when attempting to change Category to incompatible with existing Variation property / scale on the listing, and that Category is not changed for such listing """ expected_categories = [ ['Jewelry', 'Brooches'], ['Jewelry', 'Brooches'], ['Clothing', 'Women\'s Clothing', 'Dresses'] ] category = ['Jewelry', 'Brooches'] bp = BulkPage(self.driver) # change to incompatible category (3rd listing) bp.select_category(category) row = bp.listing_row('Product #3 with two variations with quantity on both and pricing on both') # check that error is shown assert bp.error_baloon_texts(row) ==\ ['The selected category is not compatible with the variations of this listing'],\ 'Incorrect validation error message for listing #3' # Apply and check that category was set for 1st and 2nd listings, for 3rd it hasn't changed click(bp.operation_apply()) for i, row in enumerate(bp.listing_rows()): category_names = bp.category_names(row) assert category_names == expected_categories[i]