From e0b0b0f532ef746bb64cd82f17324e3239727463 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 26 Aug 2019 13:22:09 -0700 Subject: [PATCH] functional_tests: Fix create snapshot test failure When there are no snapshots present in the list of snapshots, operation to delete all snapshots first checks that select all button and then submits the delete snapshots button. After that it looks for delete confirmation and then submits again. When the confirmation page is not shown, as is the case when there are no snapshots, the button being submitted happens to be 'Create Snapshot' button. This creates a new snapshot and the total number of snapshots at the end of create snapshot test is 2 instead of 1. Tests: - Run `py.test-3 --include-functional -k snapshot`. Closes: #1630. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- functional_tests/support/system.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functional_tests/support/system.py b/functional_tests/support/system.py index fb0f7612d..6d3033366 100644 --- a/functional_tests/support/system.py +++ b/functional_tests/support/system.py @@ -103,7 +103,9 @@ def delete_all_snapshots(browser): browser.find_by_id('select-all').check() submit(browser, browser.find_by_name('delete_selected')) - submit(browser, browser.find_by_name('delete_confirm')) + confirm_button = browser.find_by_name('delete_confirm') + if confirm_button: # Only if redirected to confirm page + submit(browser, confirm_button) def create_snapshot(browser):