diff --git a/functional_tests/features/sharing.feature b/functional_tests/features/sharing.feature index 44c93006f..a24a81ae9 100644 --- a/functional_tests/features/sharing.feature +++ b/functional_tests/features/sharing.feature @@ -26,27 +26,27 @@ Scenario: Add new share Given share tmp is not available When I add a share tmp from path /tmp for admin Then the share tmp should be listed from path /tmp for admin - Then the share tmp should be accessible + And the share tmp should be accessible Scenario: Edit a share Given share tmp is not available When I remove share boot - When I add a share tmp from path /tmp for admin - When I edit share tmp to boot from path /boot for admin + And I add a share tmp from path /tmp for admin + And I edit share tmp to boot from path /boot for admin Then the share tmp should not be listed - Then the share tmp should not exist - Then the share boot should be listed from path /boot for admin - Then the share boot should be accessible + And the share tmp should not exist + And the share boot should be listed from path /boot for admin + And the share boot should be accessible Scenario: Remove a share When I remove share tmp - When I add a share tmp from path /tmp for admin - When I remove share tmp + And I add a share tmp from path /tmp for admin + And I remove share tmp Then the share tmp should not be listed - Then the share tmp should not exist + And the share tmp should not exist Scenario: Share permissions When I remove share tmp - When I add a share tmp from path /tmp for syncthing + And I add a share tmp from path /tmp for syncthing Then the share tmp should be listed from path /tmp for syncthing - Then the share tmp should not be accessible + And the share tmp should not be accessible diff --git a/functional_tests/support/application.py b/functional_tests/support/application.py index cf1d7bd6a..e3efce619 100644 --- a/functional_tests/support/application.py +++ b/functional_tests/support/application.py @@ -20,7 +20,8 @@ from time import sleep import splinter from support import config, interface -from support.service import eventually +from support.interface import submit +from support.service import eventually, wait_for_page_update # unlisted apps just use the app_name as module name app_module = { @@ -131,6 +132,9 @@ def modify_upload_password(browser, password): interface.submit(browser, 'form-configuration') +# Sharing app helper functions + + def remove_share(browser, name): """Remove a share in sharing app.""" try: @@ -148,22 +152,20 @@ def add_share(browser, name, path, group): browser.fill('sharing-path', path) browser.find_by_css( '#id_sharing-groups input[value="{}"]'.format(group)).check() - browser.find_by_css('input[type="submit"]').click() - eventually(browser.is_text_present, args=['Share added.']) + submit(browser) def edit_share(browser, old_name, new_name, path, group): """Edit a share in sharing app.""" row = get_share(browser, old_name) - row.find_by_css('.share-edit')[0].click() - eventually(browser.is_text_present, args=['Edit Share']) + with wait_for_page_update(browser): + row.find_by_css('.share-edit')[0].click() browser.fill('sharing-name', new_name) browser.fill('sharing-path', path) browser.find_by_css('#id_sharing-groups input').uncheck() browser.find_by_css( '#id_sharing-groups input[value="{}"]'.format(group)).check() - browser.find_by_css('input[type="submit"]').click() - eventually(browser.is_text_present, args=['Share edited.']) + submit(browser) def get_share(browser, name): @@ -189,14 +191,14 @@ def access_share(browser, name): row = get_share(browser, name) url = row.find_by_css('.share-url a')[0]['href'] browser.visit(url) - browser.is_text_present('Index of /share/{}'.format(name)) + assert '/share/{}'.format(name) in browser.title def verify_nonexistant_share(browser, name): """Verify that given URL for a given share name is a 404.""" url = '{}/share/{}'.format(default_url, name) browser.visit(url) - browser.is_text_present('Not Found') + assert '404' in browser.title def verify_inaccessible_share(browser, name): diff --git a/functional_tests/support/service.py b/functional_tests/support/service.py index 13396711b..533a9c8c7 100644 --- a/functional_tests/support/service.py +++ b/functional_tests/support/service.py @@ -38,12 +38,12 @@ def get_service_module(service_name): def is_running(browser, service_name): interface.nav_to_module(browser, get_service_module(service_name)) - return browser.is_text_present('is running') + return len(browser.find_by_css('.running-status.active')) != 0 def is_not_running(browser, service_name): interface.nav_to_module(browser, get_service_module(service_name)) - return browser.is_text_present('is not running') + return len(browser.find_by_css('.running-status.inactive')) != 0 def eventually(function, args=[], timeout=30):