def test_inline_occasion_change(self): """ Tests setting/changing of occasion on listings using inline edit """ self.custom_setup('listings_push_attributes') expected_listings = [ 'Four\nThe category of this listing does not support occasion', 'One\nEngagement', 'Three\nChoose Occasion', 'Two\nWedding' ] expected_api_calls = [{ 'PUT': '/v2/listings/100001/attributes/46803063641?value_ids=22', 'body': {} }, { 'PUT': '/v2/listings/100002/attributes/46803063641?value_ids=32', 'body': {} }] select_listings_to_edit(self.driver) bp = BulkPage(self.driver) # Change occasion bp.select_single_occasion('One', 'Engagement') # Set occasion bp.select_single_occasion('Two', 'Wedding') # Check listings actual_listings = bp.listing_rows_texts_sorted() assert actual_listings == expected_listings # Check that sync button is enabled and blue dot is displayed after clicking on Apply wait_for_web_assert(True, bp.sync_updates_button().is_enabled, 'Sync button is not enabled') assert bp.is_part_modified( 'Occasion') is True, 'Blue dot didn\'t show up' # Sync changes click(bp.sync_updates_button()) # Check that sync button is disabled and blue dot is not displayed after clicking on Sync wait_for_web_assert(False, bp.sync_updates_button().is_enabled, 'Sync button is not disabled') assert bp.is_part_modified( 'Occasion') is False, 'Blue dot is still shown' # Check occasion data in Etsy requests check_etsy_emulator_requests(expected_api_calls)
def test_inline_occasion_delete(self): """ Tests deleting occasion from a listing using inline edit """ self.custom_setup('listings_delete_occasion') expected_listings = [ 'Four\nThe category of this listing does not support occasion', 'One\nChoose Occasion', 'Three\nChoose Occasion', 'Two\nChoose Occasion' ] expected_occasion_db = [] expected_api_calls = [{ 'DELETE': '/v2/listings/100001/attributes/46803063641', 'body': {} }] select_listings_to_edit(self.driver) bp = BulkPage(self.driver) # Delete occasion from listing bp.select_single_occasion('One', 'None') # Check listings actual_listings = bp.listing_rows_texts_sorted() assert actual_listings == expected_listings # Check that sync button is enabled and blue dot is displayed after clicking on Apply wait_for_web_assert(True, bp.sync_updates_button().is_enabled, 'Sync button is not enabled') assert bp.is_part_modified( 'Occasion') is True, 'Blue dot didn\'t show up' # Sync changes click(bp.sync_updates_button()) # Check that sync button is disabled and blue dot is not displayed after clicking on Sync wait_for_web_assert(False, bp.sync_updates_button().is_enabled, 'Sync button is not disabled') assert bp.is_part_modified( 'Occasion') is False, 'Blue dot is still shown' # Check Etsy requests and occasion data in DB after resync check_etsy_emulator_requests(expected_api_calls) check_db_state(expected_occasion_db)