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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-08-26 13:22:09 -07:00 committed by James Valleroy
parent f447264547
commit e0b0b0f532
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -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):