'Scenario: Ensure that adding several XBlocks to a library results in pagination.
Given that I have a library in Studio with 40 XBlocks
Then 10 are displayed
And the first XBlock will be the 1st one
And I\'m on the 1st page
When I add 1 Multiple Choice XBlock
Then 1 XBlock will be displayed
And I\'m on the 5th page
The first XBlock will be the newest one
When I delete that XBlock
Then 10 are displayed
And I\'m on the 4th page
And the first XBlock is the 31st one
And the last XBlock is the 40th one.'

def test_library_pagination(self):

    self.assertEqual(len(self.lib_page.xblocks), 10)
    self.assertEqual(self.lib_page.get_page_number(), '1')
    self.assertEqual(self.lib_page.xblocks[0].name, '1')
    add_component(self.lib_page, 'problem', 'Multiple    Choice')
    self.assertEqual(len(self.lib_page.xblocks), 1)
    self.assertEqual(self.lib_page.get_page_number(), '5')
    self.assertEqual(self.lib_page.xblocks[0].name, 'Multiple    Choice')
    self.lib_page.click_delete_button(self.lib_page.xblocks[0].locator)
    self.assertEqual(len(self.lib_page.xblocks), 10)
    self.assertEqual(self.lib_page.get_page_number(), '4')
    self.assertEqual(self.lib_page.xblocks[0].name, '31')
    self.assertEqual(self.lib_page.xblocks[(-1)].name, '40')
