'This test checks volumes snapshots pagination
Steps:
1) Login to Horizon Dashboard
2) Go to Project -> Compute -> Volumes -> Volumes tab, create
volumes and 3 snapshots
3) Navigate to user settings page
4) Change \'Items Per Page\' value to 1
5) Go to Project -> Compute -> Volumes -> Volumes Snapshot tab
or Admin -> System -> Volumes -> Volumes Snapshot tab
(depends on user)
6) Check that only \'Next\' link is available, only one snapshot is
available (and it has correct name)
7) Click \'Next\' and check that both \'Prev\' and \'Next\' links are
available, only one snapshot is available (and it has correct name)
8) Click \'Next\' and check that only \'Prev\' link is available,
only one snapshot is visible (and it has correct name)
9) Click \'Prev\' and check result (should be the same as for step7)
10) Click \'Prev\' and check result (should be the same as for step6)
11) Go to user settings page and restore \'Items Per Page\'
12) Delete created snapshots and volumes'

def test_volume_snapshots_pagination(self):

    volumes_page = self.home_pg.go_to_compute_volumes_volumespage()
    count = 3
    items_per_page = 1
    snapshot_names = ['{0}_{1}'.format(self.VOLUME_SNAPSHOT_NAME, i) for i in range(count)]
    for (i, name) in enumerate(snapshot_names):
        volumes_snapshot_page = volumes_page.create_volume_snapshot(self.VOLUME_NAME, name)
        volumes_page.find_message_and_dismiss(messages.INFO)
        self.assertTrue(volumes_snapshot_page.is_volume_snapshot_available(name))
        if (i < (count - 1)):
            volumes_snapshot_page.switch_to_volumes_tab()
    first_page_definition = {'Next': True, 'Prev': False, 'Count': items_per_page, 'Names': [snapshot_names[2]]}
    second_page_definition = {'Next': True, 'Prev': True, 'Count': items_per_page, 'Names': [snapshot_names[1]]}
    third_page_definition = {'Next': False, 'Prev': True, 'Count': items_per_page, 'Names': [snapshot_names[0]]}
    settings_page = self.home_pg.go_to_settings_usersettingspage()
    settings_page.change_pagesize(items_per_page)
    settings_page.find_message_and_dismiss(messages.SUCCESS)
    volumes_snapshot_page = self.volumes_snapshot_page
    volumes_snapshot_page.volumesnapshots_table.assert_definition(first_page_definition)
    volumes_snapshot_page.volumesnapshots_table.turn_next_page()
    volumes_snapshot_page.volumesnapshots_table.assert_definition(second_page_definition)
    volumes_snapshot_page.volumesnapshots_table.turn_next_page()
    volumes_snapshot_page.volumesnapshots_table.assert_definition(third_page_definition)
    volumes_snapshot_page.volumesnapshots_table.turn_prev_page()
    volumes_snapshot_page.volumesnapshots_table.assert_definition(second_page_definition)
    volumes_snapshot_page.volumesnapshots_table.turn_prev_page()
    volumes_snapshot_page.volumesnapshots_table.assert_definition(first_page_definition)
    settings_page = self.home_pg.go_to_settings_usersettingspage()
    settings_page.change_pagesize()
    settings_page.find_message_and_dismiss(messages.SUCCESS)
    volumes_snapshot_page = self.volumes_snapshot_page
    volumes_snapshot_page.delete_volume_snapshots(snapshot_names)
    volumes_snapshot_page.find_message_and_dismiss(messages.SUCCESS)
    for name in snapshot_names:
        volumes_snapshot_page.is_volume_snapshot_deleted(name)
