...
  View open merge request
Commits (1)
......@@ -22,3 +22,10 @@ run_target('autopilot',
run_target('autopilot-system',
command: ['env', 'LANG=C', 'DEJA_DUP_TESTING=1', 'PYTHONDONTWRITEBYTECODE=1', 'PYTHONPATH=' + meson.current_source_dir(), join_paths(meson.source_root(), 'tests', 'shell-system'), 'autopilot-sandbox-run', 'deja_dup_autopilot'])
test('ui-tests',
test_shell,
args: ['./run-ui-tests', meson.current_source_dir()],
timeout: 240,
workdir: meson.current_source_dir(),
)
#!/bin/sh
# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 2 -*-
# Dogtail requires these
gsettings set org.gnome.desktop.interface toolkit-accessibility true
export GTK_MODULES="gail:atk-bridge"
exec pytest $*
\ No newline at end of file
#!/usr/bin/env python
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
import os
import signal
from socket import gethostname
import sys
import time
import unittest
from dogtail.config import config
config.logDebugToFile = False
from dogtail import tree
from dogtail.procedural import focus, run
from dogtail.tc import TCNode, TCBool
tcn = TCNode()
from gi.repository import Gio, GLib
class BaseTest(unittest.TestCase):
def setUp(self):
self.pid = run('deja-dup', appName='org.gnome.DejaDupDevel')
self.addCleanup(os.kill, self.pid, signal.SIGTERM)
self.app = tree.root.application('org.gnome.DejaDupDevel')
self.settings = Gio.Settings.new('org.gnome.DejaDup')
self.reset_gsettings(self.settings)
def reset_gsettings(self, settings):
schema = settings.get_property('settings-schema')
for key in schema.list_keys():
settings.reset(key)
for child in schema.list_children():
self.reset_gsettings(settings.get_child(child))
def child(self, **kwargs):
# If label= is provided, dogtail doesn't check any other traits
maybe = self.app.child(**kwargs)
roleName = kwargs.get('roleName')
if roleName and maybe.role != roleName:
return maybe.role
def refresh(self, obj):
kwargs = {
'roleName': obj.roleName,
'name': obj.name,
}
if obj.labeler:
kwargs['label'] = obj.labeler.name
return obj.parent.child(**kwargs)
def set_strv(self, key, value):
self.settings.set_strv(key, value)
self.settings.sync()
def set_boolean(self, key, value):
self.settings.set_boolean(key, value)
self.settings.sync()
def set_int(self, key, value):
self.settings.set_int(key, value)
self.settings.sync()
class PreferencesTest(BaseTest):
def test_scheduling(self):
self.app.child(name='Scheduling').click()
# Periodic to settings
periodic = self.app.child(label='Automatic backup')
periodic_header = self.app.child(name='Automatic backup')
self.assertFalse(periodic.checked)
self.assertFalse(periodic_header.checked)
periodic.click()
self.assertTrue(self.settings.get_boolean('periodic'))
# Periodic from settings
self.assertTrue(periodic.checked)
self.assertTrue(periodic_header.checked)
self.set_boolean('periodic', False)
self.assertFalse(self.refresh(periodic).checked)
self.assertFalse(self.refresh(periodic_header).checked)
self.set_boolean('periodic', True)
self.assertTrue(self.refresh(periodic).checked)
self.assertTrue(self.refresh(periodic_header).checked)
# Period to settings
period = self.app.child(label='Every').child(roleName='combo box')
period.click()
period.child(roleName='menu item', name='Day').click()
self.assertEqual(self.settings.get_int('periodic-period'), 1)
period.click()
period.child(roleName='menu item', name='Week').click()
self.assertEqual(self.settings.get_int('periodic-period'), 7)
# Period from settings
self.set_int('periodic-period', 10)
self.assertEqual(self.refresh(period).combovalue, '10 days')
# Delete After to settings
delete = self.app.child(label='Keep').child(roleName='combo box')
delete.click()
delete.child(roleName='menu item', name='At least a year').click()
self.assertEqual(self.settings.get_int('delete-after'), 365)
delete.click()
delete.child(roleName='menu item', name='Forever').click()
self.assertEqual(self.settings.get_int('delete-after'), 0)
# Delete After from settings
self.set_int('delete-after', 12)
self.assertEqual(self.refresh(delete).combovalue, 'At least 12 days')
def table_names(self, table):
table = self.refresh(table)
objs = table.findChildren(lambda x: x.roleName == 'table cell')
return [x.name for x in objs]
def assert_inclusion_table(self, category, widget, key):
self.app.child(name=category).click()
table = self.app.child(name=widget)
user = GLib.get_user_name()
home = GLib.get_home_dir()
homename = home.rsplit('/', 1)[-1]
# Test display names
self.set_strv(key, [
'$DESKTOP',
'$DOCUMENTS/path',
'$DOWNLOAD',
'$MUSIC/path',
'$PICTURES',
'$PUBLIC_SHARE',
'$TEMPLATES/path',
'$VIDEOS',
'$HOME',
'$TRASH',
'relative/$USER/path',
'/absolute/$USER/path',
])
self.assertListEqual(self.table_names(table), [
'~/Desktop',
'~/Documents/path',
'~/Downloads',
'~/Music/path',
'~/Pictures',
'Home ({})'.format(homename),
'~/Templates/path',
'~/Videos',
'Home ({})'.format(homename),
'Trash',
'~/relative/{}/path'.format(user),
'/absolute/{}/path'.format(user),
])
# Remove most
rows = table.findChildren(lambda x: x.roleName == 'table cell')[1:]
for row in rows:
row.select()
remove = self.app.child(name='Remove')
remove.click()
self.assertListEqual(self.table_names(table), ['~/Desktop'])
self.assertEqual(self.settings.get_strv(key), [home + '/Desktop'])
# Add one
add = self.app.child(name='Add')
add.click()
dlg = self.app.child(roleName='file chooser')
dlg.child(name='Documents').click()
dlg.child(name='Add').click()
self.assertListEqual(self.table_names(table), ['~/Desktop', '~/Documents'])
self.assertEqual(self.settings.get_strv(key), [home + '/Desktop', home + '/Documents'])
def test_includes(self):
self.assert_inclusion_table('Folders to save', 'IncludeList',
'include-list')
def test_excludes(self):
self.assert_inclusion_table('Folders to ignore', 'ExcludeList',
'exclude-list')
......@@ -52,6 +52,135 @@ modules:
tag: libgpg-error-1.34
- name: setuptools
buildsystem: simple
build-commands:
- python2 bootstrap.py
- python2 setup.py build
- python2 setup.py install --prefix /app
sources:
- type: git
url: https://github.com/pypa/setuptools
tag: v40.6.3
- name: setuptools-scm
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/pypa/setuptools_scm
tag: v3.2.0
- name: scandir
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/benhoyt/scandir
tag: v1.9.0
- name: pathlib2
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/mcmtroffaes/pathlib2
tag: 2.3.3
- name: funcsigs
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/testing-cabal/funcsigs
tag: 1.0.2
- name: pluggy
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/pytest-dev/pluggy
tag: 0.8.1
- name: atomicwrites
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/untitaker/python-atomicwrites
tag: 1.2.1
- name: more-itertools
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/erikrose/more-itertools
tag: 5.0.0
- name: attrs
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/python-attrs/attrs
tag: 18.2.0
- name: py
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/pytest-dev/py
tag: 1.7.0
- name: pytest
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/pytest-dev/pytest
tag: 4.1.1
- name: pyatspi2
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/pyatspi2
tag: PYATSPI_2_30_0
- name: dogtail
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: archive
url: https://gitlab.com/dogtail/dogtail/raw/released/dogtail-0.9.11.tar.gz
sha256: 801a15b183916df5adadd50338e82f76426b5b598477d2dc5e2258b1ce47236b
- name: librsync
buildsystem: cmake
sources:
......@@ -173,16 +302,6 @@ modules:
tag: 3.6.0
- name: setuptools-scm
buildsystem: simple
build-commands:
- python2 setup.py build
- python2 setup.py install --single-version-externally-managed --root=/ --prefix /app
sources:
- type: git
url: https://github.com/pypa/setuptools_scm
tag: v3.2.0
- name: mock
buildsystem: simple
build-commands:
......
......@@ -66,6 +66,7 @@ dbus_run_session = find_program('dbus-run-session')
desktop_file_validate = find_program('desktop-file-validate')
glib_compile_schemas = find_program('glib-compile-schemas')
msgfmt = find_program('msgfmt')
test_shell = find_program('./tests/shell-local')
# Profile support
profile = get_option('profile')
......