def test_bulk_edit_view_listings_checked(self): """ Tests that the bulk edit view shows the listings checked on all pages """ d = self.driver pg = MainPage(d) bp = BulkPage(d) pg.select_filter_tab('Active') sleep(1) # check all click(pg.listing_select_all_checkbox()) assert pg.edit_listings_button().text == 'Edit 102 Listings' # clck the Edit Listings click(pg.edit_listings_button()) sleep(1) # check the listings 1st page listing_rows = bp.listing_rows() assert len(listing_rows) == 25 for listing_row in listing_rows: row_class = listing_row.get_attribute('class') assert 'selected' in row_class.split(' ') click(bp.next_page_button()) sleep(2) # check the listings 2nd page listing_rows = bp.listing_rows() assert len(listing_rows) == 50 for listing_row in listing_rows: row_class = listing_row.get_attribute('class') assert 'selected' in row_class.split(' ')
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]