diff --git a/Makefile.local b/Makefile.local
index 6e48acc2d7a79e994eb94260654336cdad61c515..46177f722b7974248fa548d99072e2a2d89121f8 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -32,6 +32,13 @@ run-migrations-prod:
 	django-admin migrate --settings=swh.web.settings.production -v0 2>/dev/null
 	django-admin createcachetable --settings=swh.web.settings.production -v0 2>/dev/null
 
+.PHONY: run-migrations-test
+run-migrations-test:
+	rm -f swh/web/settings/testdb.sqlite3
+	django-admin migrate --settings=swh.web.settings.tests -v0 2>/dev/null
+	django-admin createcachetable --settings=swh.web.settings.tests -v0 2>/dev/null
+	cat swh/web/tests/create_test_admin.py | django-admin shell --settings=swh.web.settings.tests
+
 .PHONY: clear-memcached
 clear-memcached:
 	echo "flush_all" | nc -q 2 localhost 11211 2>/dev/null
@@ -60,9 +67,9 @@ run-django-webpack-memory-storages: build-webpack-dev run-migrations
 test-full:
 	$(TEST) $(TESTFULL_FLAGS) $(TEST_DIRS)
 
-test-frontend: build-webpack-test run-migrations
+test-frontend: build-webpack-test run-migrations-test
 	python3 swh/web/manage.py runserver --nostatic --settings=swh.web.settings.tests & sleep 10 && $(YARN) run cypress run && pkill -P $$! && $(YARN) run mochawesome
 
-test-frontend-ui: build-webpack-test run-migrations
+test-frontend-ui: build-webpack-test run-migrations-test
 	bash -c "trap 'trap - SIGINT SIGTERM ERR EXIT; jobs -p | head -1 | xargs pkill -P' SIGINT SIGTERM ERR EXIT; python3 swh/web/manage.py runserver --nostatic --settings=swh.web.settings.tests & sleep 10 && $(YARN) run cypress open"
 
diff --git a/swh/web/config.py b/swh/web/config.py
index 5cecf2f43b0925886c4b72ad9afab1cefa0e6d2e..635d5f2424b88a14b53a65fd9cd26b4ef98a1d96 100644
--- a/swh/web/config.py
+++ b/swh/web/config.py
@@ -84,6 +84,7 @@ DEFAULT_CONFIG = {
         }
     }),
     'development_db': ('string', os.path.join(SETTINGS_DIR, 'db.sqlite3')),
+    'test_db': ('string', os.path.join(SETTINGS_DIR, 'testdb.sqlite3')),
     'production_db': ('string', '/var/lib/swh/web.sqlite3'),
     'deposit': ('dict', {
         'private_api_url': 'https://deposit.softwareheritage.org/1/private/',
diff --git a/swh/web/settings/tests.py b/swh/web/settings/tests.py
index a3becee420030fc2d20dbc27109095f2d87276b7..ced666b3574e5f2b0d8b76c1a520db3b1b72e6b5 100644
--- a/swh/web/settings/tests.py
+++ b/swh/web/settings/tests.py
@@ -79,6 +79,13 @@ swh_web_config.update({
 from .common import * # noqa
 from .common import ALLOWED_HOSTS, LOGGING # noqa
 
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': swh_web_config['test_db'],
+    }
+}
+
 # when not running unit tests, make the webapp fetch data from memory storages
 if 'pytest' not in sys.argv[0]:
     swh_web_config.update({
diff --git a/swh/web/tests/create_test_admin.py b/swh/web/tests/create_test_admin.py
new file mode 100644
index 0000000000000000000000000000000000000000..1e1274c0c4551b89de436a172879453c84602f4e
--- /dev/null
+++ b/swh/web/tests/create_test_admin.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2019  The Software Heritage developers
+# See the AUTHORS file at the top-level directory of this distribution
+# License: GNU Affero General Public License version 3, or any later version
+# See top-level LICENSE file for more information
+
+
+from django.contrib.auth import get_user_model
+
+username = 'admin'
+password = 'admin'
+email = 'admin@swh-web.org'
+
+User = get_user_model()
+
+if not User.objects.filter(username=username).exists():
+    User.objects.create_superuser(username, email, password)