'This test checks instance pagination
Steps:
1) Login to Horizon Dashboard as regular user
2) Navigate to user settings page
3) Change \'Items Per Page\' value to 1
4) Go to Project > Compute > Instances page
5) Create 2 instances
6) Go to appropriate page (depends on user)
7) Check that only \'Next\' link is available, only one instance is
available (and it has correct name) on the first page
8) Click \'Next\' and check that on the second page only one instance is
available (and it has correct name), there is no \'Next\' link on page
9) Go to user settings page and restore \'Items Per Page\'
10) Delete created instances via proper page (depends on user)'

@decorators.skip_because(bugs=['1584057'])
def test_instances_pagination(self):

    items_per_page = 1
    instance_count = 2
    instance_list = ['{0}-{1}'.format(self.INSTANCE_NAME, item) for item in range(1, (instance_count + 1))]
    first_page_definition = {'Next': True, 'Prev': False, 'Count': items_per_page, 'Names': [instance_list[1]]}
    second_page_definition = {'Next': False, 'Prev': False, 'Count': items_per_page, 'Names': [instance_list[0]]}
    settings_page = self.home_pg.go_to_settings_usersettingspage()
    settings_page.change_pagesize(items_per_page)
    self.assertTrue(settings_page.find_message_and_dismiss(messages.SUCCESS))
    instances_page = self.home_pg.go_to_compute_instancespage()
    instances_page.create_instance(self.INSTANCE_NAME, instance_count=instance_count)
    self.assertTrue(instances_page.find_message_and_dismiss(messages.SUCCESS))
    self.assertTrue(instances_page.is_instance_active(instance_list[1]))
    instances_page = self.instances_page
    instances_page.instances_table.assert_definition(first_page_definition, sorting=True)
    instances_page.instances_table.turn_next_page()
    instances_page.instances_table.assert_definition(second_page_definition, sorting=True)
    instances_page = self.instances_page
    instances_page.instances_table.assert_definition(first_page_definition, sorting=True)
    settings_page = self.home_pg.go_to_settings_usersettingspage()
    settings_page.change_pagesize()
    self.assertTrue(settings_page.find_message_and_dismiss(messages.SUCCESS))
    instances_page = self.instances_page
    instances_page.delete_instances(instance_list)
    self.assertTrue(instances_page.find_message_and_dismiss(messages.SUCCESS))
    self.assertTrue(instances_page.are_instances_deleted(instance_list))
