mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
tests: Improve waiting for installation and configuration
- Use Selenium's built-in waiting constructs to wait for page loads to complete - Make tests independent of language (tested in Chinese) Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
b2fea1b0de
commit
e99b7c942b
7 files changed
+94
-75
No files matched your search
@@ -14,8 +14,11 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from support import config
|
||||
|
||||
from .service import wait_for_page_update
|
||||
|
||||
sys_modules = [
|
||||
'avahi', 'cockpit', 'config', 'datetime', 'diagnostics', 'firewall',
|
||||
'letsencrypt', 'monkeysphere', 'names', 'networks', 'power', 'snapshot',
|
||||
@@ -61,8 +64,13 @@ def nav_to_module(browser, module):
|
||||
browser.find_link_by_href('/plinth/apps/' + module + '/').first.click()
|
||||
|
||||
|
||||
def submit(browser):
|
||||
browser.find_by_value('Submit').click()
|
||||
def submit(browser, form_class=None):
|
||||
with wait_for_page_update(browser):
|
||||
if form_class:
|
||||
browser.find_by_css(
|
||||
'.{} input[type=submit]'.format(form_class)).click()
|
||||
else:
|
||||
browser.find_by_css('input[type=submit]').click()
|
||||
|
||||
|
||||
def create_user(browser, name, password):
|
||||
@@ -76,16 +84,16 @@ def create_user(browser, name, password):
|
||||
|
||||
def rename_user(browser, old_name, new_name):
|
||||
nav_to_module(browser, 'users')
|
||||
browser.find_link_by_href('/plinth/sys/users/' + old_name +
|
||||
'/edit/').first.click()
|
||||
browser.find_link_by_href(
|
||||
'/plinth/sys/users/' + old_name + '/edit/').first.click()
|
||||
browser.find_by_id('id_username').fill(new_name)
|
||||
browser.find_by_value('Save Changes').click()
|
||||
|
||||
|
||||
def delete_user(browser, name):
|
||||
nav_to_module(browser, 'users')
|
||||
browser.find_link_by_href('/plinth/sys/users/' + name +
|
||||
'/delete/').first.click()
|
||||
browser.find_link_by_href(
|
||||
'/plinth/sys/users/' + name + '/delete/').first.click()
|
||||
browser.find_by_value('Delete ' + name).click()
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user