From 486a5fa67638d46e98064dc0b2de388e303fb79b Mon Sep 17 00:00:00 2001 From: PJ Richardson Date: Wed, 10 Jun 2020 16:03:11 -0400 Subject: [PATCH 1/4] Add test_snapshot_link_after_delete --- cfme/tests/infrastructure/test_snapshot.py | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/cfme/tests/infrastructure/test_snapshot.py b/cfme/tests/infrastructure/test_snapshot.py index 86eac85589..0bac18ac2b 100644 --- a/cfme/tests/infrastructure/test_snapshot.py +++ b/cfme/tests/infrastructure/test_snapshot.py @@ -463,6 +463,39 @@ def test_snapshot_history_btn(create_vm, provider): assert snapshot_view.is_displayed +def test_snapshot_link_after_delete(create_vm, provider): + """Tests snapshot link and history button after delete + Metadata: + test_flag: snapshot + + Polarion: + assignee: prichard + casecomponent: Infra + caseimportance: medium + initialEstimate: 1/6h + """ + has_name = not provider.one_of(RHEVMProvider) + snapshot1 = new_snapshot(create_vm, has_name=has_name) + snapshot1.create() + snapshot2 = new_snapshot(create_vm, has_name=has_name) + snapshot2.create() + snapshot1.delete() + # snap 1 will be the active so we'd be testing a negative case for rhv(rhv should not allow + # deletion of active snap). + snapshot_view = navigate_to(create_vm, 'SnapshotsAll') + back_to_vm_item = f'VM and Instance "{create_vm.name}"' + snapshot_view.toolbar.history.item_select(back_to_vm_item) + vm_details_view = navigate_to(create_vm, 'Details') # no nav should be needed. + snapshot_item = f'"Snapshots" for Virtual Machine "{create_vm.name}"' + vm_details_view.toolbar.history.item_select(snapshot_item) + snapshot_view = create_vm.create_view(InfraVmSnapshotView) + assert snapshot_view.is_displayed + # Now go back to Datails and click on the snapshots link ?Do I want to use history button here? + vm_details_view = navigate_to(create_vm, 'Details') + vm_details_view.entities.summary('Properties').click_at("Snapshots") + assert snapshot_view.is_displayed + + @pytest.mark.provider([VMwareProvider]) def test_create_snapshot_via_ae(appliance, request, domain, create_vm): """This test checks whether the vm.create_snapshot works in AE. From 37216d97287493aa33e6c4186d6b25a7578fa394 Mon Sep 17 00:00:00 2001 From: PJ Richardson Date: Mon, 15 Jun 2020 10:22:44 -0400 Subject: [PATCH 2/4] Remove manual test and add markets to automated version --- cfme/tests/infrastructure/test_snapshot.py | 45 +++------------------- 1 file changed, 5 insertions(+), 40 deletions(-) diff --git a/cfme/tests/infrastructure/test_snapshot.py b/cfme/tests/infrastructure/test_snapshot.py index 0bac18ac2b..15fb000101 100644 --- a/cfme/tests/infrastructure/test_snapshot.py +++ b/cfme/tests/infrastructure/test_snapshot.py @@ -463,16 +463,19 @@ def test_snapshot_history_btn(create_vm, provider): assert snapshot_view.is_displayed +@pytest.mark.tier(1) +@pytest.mark.meta(automates=[1395116]) def test_snapshot_link_after_delete(create_vm, provider): """Tests snapshot link and history button after delete Metadata: test_flag: snapshot - Polarion: assignee: prichard casecomponent: Infra caseimportance: medium initialEstimate: 1/6h + Bugzilla: + 1395116 """ has_name = not provider.one_of(RHEVMProvider) snapshot1 = new_snapshot(create_vm, has_name=has_name) @@ -480,7 +483,7 @@ def test_snapshot_link_after_delete(create_vm, provider): snapshot2 = new_snapshot(create_vm, has_name=has_name) snapshot2.create() snapshot1.delete() - # snap 1 will be the active so we'd be testing a negative case for rhv(rhv should not allow + # snap 2 will be the active so we'd be testing a negative case for rhv(rhv should not allow # deletion of active snap). snapshot_view = navigate_to(create_vm, 'SnapshotsAll') back_to_vm_item = f'VM and Instance "{create_vm.name}"' @@ -719,44 +722,6 @@ def test_snapshot_tree_view_functionality(): pass -@pytest.mark.manual -@pytest.mark.provider([VMwareProvider]) -@pytest.mark.tier(1) -@pytest.mark.meta(coverage=[1395116]) -def test_snapshot_link_after_deleting_snapshot(): - """ - test snapshot link in vm summary page after deleting snapshot - Have a vm, create couple of snapshots. Delete one snapshot. From the - vm summary page use the history button and try to go back to - snapshots. Go to the vm summary page again and try to click snapshots - link, it should work. - - Polarion: - assignee: prichard - casecomponent: Infra - caseimportance: medium - initialEstimate: 1/6h - setup: - 1. Add vmware provider - 2. Create testing VM - testSteps: - 1. Create two snapshots - 2. Delete one snapshot - 3. Use history button to navigate back to VM summary page - 4. From the vm summary page use the history button and try to go back to snapshots. - 5. From vm summary page click the snapshot link - expectedResults: - 1. Snapshots successfully created - 2. Snapshot successfully deleted - 3. VM summary page displayed - 4. Snapshots page displayed - 5. Snapshots page displayed - Bugzilla: - 1395116 - """ - pass - - @pytest.mark.manual @pytest.mark.provider([VMwareProvider]) @test_requirements.ssui From 0b6eaac1184ef50c496262399215be2ebea6a1ad Mon Sep 17 00:00:00 2001 From: PJ Richardson Date: Tue, 16 Jun 2020 22:32:39 -0400 Subject: [PATCH 3/4] Put snapshot creation and deletion into a fixture --- cfme/tests/infrastructure/test_snapshot.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cfme/tests/infrastructure/test_snapshot.py b/cfme/tests/infrastructure/test_snapshot.py index 15fb000101..7278c667a1 100644 --- a/cfme/tests/infrastructure/test_snapshot.py +++ b/cfme/tests/infrastructure/test_snapshot.py @@ -463,9 +463,19 @@ def test_snapshot_history_btn(create_vm, provider): assert snapshot_view.is_displayed +@pytest.fixture +def add2snaps_del1(provider, create_vm): + has_name = not provider.one_of(RHEVMProvider) + snapshot1 = new_snapshot(create_vm, has_name=has_name) + snapshot1.create() + snapshot2 = new_snapshot(create_vm, has_name=has_name) + snapshot2.create() + snapshot1.delete() + + @pytest.mark.tier(1) @pytest.mark.meta(automates=[1395116]) -def test_snapshot_link_after_delete(create_vm, provider): +def test_snapshot_link_after_delete(create_vm, add2snaps_del1): """Tests snapshot link and history button after delete Metadata: test_flag: snapshot @@ -477,14 +487,6 @@ def test_snapshot_link_after_delete(create_vm, provider): Bugzilla: 1395116 """ - has_name = not provider.one_of(RHEVMProvider) - snapshot1 = new_snapshot(create_vm, has_name=has_name) - snapshot1.create() - snapshot2 = new_snapshot(create_vm, has_name=has_name) - snapshot2.create() - snapshot1.delete() - # snap 2 will be the active so we'd be testing a negative case for rhv(rhv should not allow - # deletion of active snap). snapshot_view = navigate_to(create_vm, 'SnapshotsAll') back_to_vm_item = f'VM and Instance "{create_vm.name}"' snapshot_view.toolbar.history.item_select(back_to_vm_item) @@ -493,7 +495,7 @@ def test_snapshot_link_after_delete(create_vm, provider): vm_details_view.toolbar.history.item_select(snapshot_item) snapshot_view = create_vm.create_view(InfraVmSnapshotView) assert snapshot_view.is_displayed - # Now go back to Datails and click on the snapshots link ?Do I want to use history button here? + # Now go back to Details and click on the snapshots link ?Do I want to use history button here? vm_details_view = navigate_to(create_vm, 'Details') vm_details_view.entities.summary('Properties').click_at("Snapshots") assert snapshot_view.is_displayed From f2b6b9691ed9c10a72a493a1692202f2684ba7d6 Mon Sep 17 00:00:00 2001 From: PJ Richardson Date: Thu, 18 Jun 2020 08:59:23 -0400 Subject: [PATCH 4/4] Add test steps --- cfme/tests/infrastructure/test_snapshot.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cfme/tests/infrastructure/test_snapshot.py b/cfme/tests/infrastructure/test_snapshot.py index 7278c667a1..37ce37f275 100644 --- a/cfme/tests/infrastructure/test_snapshot.py +++ b/cfme/tests/infrastructure/test_snapshot.py @@ -484,6 +484,21 @@ def test_snapshot_link_after_delete(create_vm, add2snaps_del1): casecomponent: Infra caseimportance: medium initialEstimate: 1/6h + setup: + 1. Add vmware provider + 2. Create testing VM + testSteps: + 1. Create two snapshots + 2. Delete one snapshot + 3. Use history button to navigate back to VM summary page + 4. From the vm summary page use the history button and try to go back to snapshots. + 5. From vm summary page click the snapshot link + expectedResults: + 1. Snapshots successfully created + 2. Snapshot successfully deleted + 3. VM summary page displayed + 4. Snapshots page displayed + 5. Snapshots page displayed Bugzilla: 1395116 """ @@ -495,7 +510,7 @@ def test_snapshot_link_after_delete(create_vm, add2snaps_del1): vm_details_view.toolbar.history.item_select(snapshot_item) snapshot_view = create_vm.create_view(InfraVmSnapshotView) assert snapshot_view.is_displayed - # Now go back to Details and click on the snapshots link ?Do I want to use history button here? + # Now go back to Details and click on the snapshots link vm_details_view = navigate_to(create_vm, 'Details') vm_details_view.entities.summary('Properties').click_at("Snapshots") assert snapshot_view.is_displayed