Example #1
0
    def test_inline_holiday_delete(self):
        """ Tests deleting holiday from a listing using inline edit
        """

        self.custom_setup('listings_delete_holiday_inline')

        expected_listings = [
            'Four\nThe category of this listing does not support holiday',
            'One\nChoose Holiday', 'Three\nChinese New Year',
            'Two\nChoose Holiday'
        ]

        expected_holiday_db = [['3', '{34}', 'f', 'f']]

        expected_api_calls = [{
            'DELETE': '/v2/listings/100002/attributes/46803063659',
            'body': {}
        }]

        select_listings_to_edit(self.driver)
        bp = BulkPage(self.driver)

        # Delete holiday
        bp.select_single_holiday('Two', '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(
            'Holiday') 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(
            'Holiday') is False, 'Blue dot is still shown'

        # Check Etsy requests and holiday data in DB after resync
        check_etsy_emulator_requests(expected_api_calls)
        check_db_state(expected_holiday_db)
Example #2
0
    def test_inline_holiday_change(self):
        """ Tests setting/changing holiday on a listing using inline edit
        """

        self.custom_setup('listings_push_attributes')

        expected_listings = [
            'Four\nThe category of this listing does not support holiday',
            'One\nEaster', 'Three\nVeterans\' Day', 'Two\nFather\'s Day'
        ]

        expected_api_calls = [{
            'PUT': '/v2/listings/100001/attributes/46803063659?value_ids=37',
            'body': {}
        }, {
            'PUT': '/v2/listings/100002/attributes/46803063659?value_ids=38',
            'body': {}
        }, {
            'PUT': '/v2/listings/100003/attributes/46803063659?value_ids=49',
            'body': {}
        }]

        select_listings_to_edit(self.driver)
        bp = BulkPage(self.driver)

        # set holiday
        bp.select_single_holiday('One', 'Easter')
        # change holiday
        bp.select_single_holiday('Two', 'Father\'s Day')
        bp.select_single_holiday('Three', 'Veterans\' Day')

        # 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(
            'Holiday') 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(
            'Holiday') is False, 'Blue dot is still shown'

        # Check holiday data in DB and Etsy requests
        check_etsy_emulator_requests(expected_api_calls)