'Scenario: Duplicating an XBlock if it\'s the last one should bring me to the next page with a preview.
Given that I have a library in Studio with 40 XBlocks
And when I hide previews
And I duplicate the last XBlock
The page should change to page 2
And the duplicate XBlock should be the first XBlock
And it should not be a placeholder'

def test_duplicate_xblock_pagination_end(self):

    self.lib_page.toggle_previews()
    last_block_id = self.lib_page.xblocks[(-1)].locator
    self.lib_page.click_duplicate_button(last_block_id)
    self.lib_page.wait_until_ready()
    self.assertEqual(self.lib_page.get_page_number(), '2')
    target_block = self.lib_page.xblocks[0]
    self.assertIn('Duplicate', target_block.name)
    self.assertFalse(target_block.is_placeholder())
