2018-08-28 21:48:35 +03:00
|
|
|
# FXA username and password for ui-tests
|
|
|
|
export FXA_EMAIL=uitest-$(shell uuid)@restmail.net
|
|
|
|
export FXA_PASSWORD=uitester
|
|
|
|
|
2017-06-15 11:41:40 +03:00
|
|
|
NUM_ADDONS=10
|
|
|
|
NUM_THEMES=$(NUM_ADDONS)
|
|
|
|
|
|
|
|
NPM_ARGS :=
|
|
|
|
|
|
|
|
ifneq ($(NPM_CONFIG_PREFIX),)
|
|
|
|
NPM_ARGS := --prefix $(NPM_CONFIG_PREFIX)
|
|
|
|
endif
|
|
|
|
|
|
|
|
NODE_MODULES := $(NPM_CONFIG_PREFIX)node_modules/
|
2017-06-21 18:06:31 +03:00
|
|
|
STATIC_CSS := static/css/node_lib/
|
2017-06-15 11:41:40 +03:00
|
|
|
STATIC_JS := static/js/node_lib/
|
|
|
|
STATIC_JQUERY_UI := static/js/node_lib/ui/
|
|
|
|
|
2017-06-21 18:06:31 +03:00
|
|
|
NODE_LIBS_CSS := \
|
|
|
|
@claviska/jquery-minicolors/jquery.minicolors.css \
|
|
|
|
@claviska/jquery-minicolors/jquery.minicolors.png \
|
|
|
|
|
2017-06-15 11:41:40 +03:00
|
|
|
NODE_LIBS_JS := \
|
|
|
|
less/dist/less.js \
|
2017-06-21 11:07:44 +03:00
|
|
|
jqmodal/jqModal.js \
|
2017-06-15 14:04:08 +03:00
|
|
|
jquery/dist/jquery.js \
|
|
|
|
jquery.browser/dist/jquery.browser.js \
|
|
|
|
jquery.cookie/jquery.cookie.js \
|
2017-06-21 18:06:31 +03:00
|
|
|
@claviska/jquery-minicolors/jquery.minicolors.js \
|
2017-06-19 11:10:05 +03:00
|
|
|
jquery-pjax/jquery.pjax.js \
|
2017-11-24 17:41:59 +03:00
|
|
|
jszip/dist/jszip.js \
|
2017-06-21 11:55:37 +03:00
|
|
|
raven-js/dist/raven.js \
|
2017-06-15 14:04:08 +03:00
|
|
|
timeago/jquery.timeago.js \
|
2017-06-16 15:27:44 +03:00
|
|
|
underscore/underscore.js \
|
2017-06-15 11:41:40 +03:00
|
|
|
|
|
|
|
NODE_LIBS_JQUERY_UI := \
|
|
|
|
jquery-ui/ui/version.js \
|
|
|
|
jquery-ui/ui/data.js \
|
|
|
|
jquery-ui/ui/disable-selection.js \
|
|
|
|
jquery-ui/ui/ie.js \
|
|
|
|
jquery-ui/ui/keycode.js \
|
|
|
|
jquery-ui/ui/escape-selector.js \
|
|
|
|
jquery-ui/ui/labels.js \
|
|
|
|
jquery-ui/ui/jquery-1-7.js \
|
|
|
|
jquery-ui/ui/plugin.js \
|
|
|
|
jquery-ui/ui/safe-active-element.js \
|
|
|
|
jquery-ui/ui/safe-blur.js \
|
|
|
|
jquery-ui/ui/scroll-parent.js \
|
|
|
|
jquery-ui/ui/focusable.js \
|
|
|
|
jquery-ui/ui/tabbable.js \
|
|
|
|
jquery-ui/ui/unique-id.js \
|
|
|
|
jquery-ui/ui/position.js \
|
|
|
|
jquery-ui/ui/widget.js \
|
|
|
|
jquery-ui/ui/widgets/menu.js \
|
|
|
|
jquery-ui/ui/widgets/mouse.js \
|
|
|
|
jquery-ui/ui/widgets/autocomplete.js \
|
|
|
|
jquery-ui/ui/widgets/datepicker.js \
|
|
|
|
jquery-ui/ui/widgets/sortable.js
|
|
|
|
|
|
|
|
help_redirect:
|
|
|
|
@$(MAKE) help --no-print-directory
|
|
|
|
|
|
|
|
help_submake:
|
|
|
|
@echo "Commands that are designed be run in the container:"
|
|
|
|
@echo " initialize to init the dependencies, the database, and assets"
|
|
|
|
@echo " update to update the dependencies, the database, and assets"
|
|
|
|
@echo " initialize_db to create a new database"
|
|
|
|
@echo " populate_data to populate a new database"
|
|
|
|
@echo " reindex to reindex everything in elasticsearch, for AMO"
|
|
|
|
@echo " update_deps to update the pythondependencies"
|
|
|
|
@echo " update_db to run the database migrations"
|
|
|
|
|
|
|
|
initialize_db:
|
|
|
|
rm -rf ./user-media/* ./tmp/*
|
2018-07-17 10:40:45 +03:00
|
|
|
python manage.py reset_db
|
Update to Django 1.11 (#8738)
Port code and tests to Django 1.11.
* Update requirements to Django 1.11.14, remove session_csrf
* Use --run-syncdb for migration calls
* Remove unused setup-docker script
* Port code and tests to Django 1.11.
* Remove django-session-csrf everywhere, it got replaced by django's own
session csrf protection
* Make sure we are calling `client.get()` with `follow=True` where necessary
* Replace django.core.urlresolvers import with django.urls
* Port custom `IconWidgetRenderer` to Django 1.11 as `IconTypeSelect`
* Properly use `_queryset_class` for custom manager classes
* Make use of `base_manager_name` on our models `Meta` instead of `use_for_related_objects`
on the manager where appropriate. This is required to make translations, soft-delete
and more work. See comment on Addons.Meta for more details.
* Various fixes along the way to make tests work
* Port form errors for locale editing forms to Django 1.11 and make use of
form.add_error instead of our own custom process
* Mark TestDetailPage.test_304 as xfail for now, somehow Etags seem to be broken
for that view during tests but work fine in manual tests
* Fix amo.celery, we cannot have any imports at the module-level that may
import the ORM
* Fix global_settings context processor for 500-server error cases
* Fix `changed_data` handling in `AMOModelForm`
* Remove `queryset_transform` and implement it directly in amo/models
* Fix pagination, Django changed how `num_pages` work and how `count` can be overwritten
* Add a new test that tests database transforms as `BaseQuerysetTestCase`
* Make sure `legacy_redirect` only appends `?` if there are actual GET parameters
* Re-implement `LicenseRadioChoiceInput` as `LicenseRadioSelect` which is now Django 1.11 compatible
* Remove our custom `form_kwargs` uplift from Django 1.9
* Correct how we're using `Category.objects.create` and only pass `db_name` instead of `name`, previously
this didn't error but now it (luckily!) does
* Update `FileSelectWidget` to correctly work with Django 1.11, use custom rendering
* Fix decorator ordering for `files.views:browse`
* Update database settings to correctly use `TEST` object
* Fix `select_related` call in `RatingViewSet`
* Remove custom `DateTimeCast` implementation
* Fix `addon_factory` calls in `reviewers/tests/test_views.py` to correctly set
`is_webextension`
* Port our `TranslationDescriptor` and `TranslatedField` to Django 1.11. Also, make sure form error handling works
* Add a new test that checks that `default=None` is a valid setting for translation fields
* Add a new test that checks that translations from related fields are correctly fetched
* Remove possible ambiguity from translations `TestWidget` tests
* Make sure that the correct `MEDIA_URL` is set in `TestDownloadsUnlistedVersions` to fix
external cdn tests
* Remove custom happyforms code. Django cleans text fields now by default
* Move translations app to the top of INSTALLED_APPS, add a lengthy comment
* Pass additional arguments to contribute_to_class, fix smaller nits
* Set MEDIA_URL and STATIC_URL to an external value by default. That's how they're configured in dev, stage and prod anyway.
Please note that we didn't replace all our custom form rendering with proper templated widgets yet. This will
happening in some follow-up work.
Fixes #5271, Fixes #1569
2018-07-11 07:56:54 +03:00
|
|
|
python manage.py migrate --noinput --run-syncdb
|
2017-06-15 11:41:40 +03:00
|
|
|
python manage.py loaddata initial.json
|
|
|
|
python manage.py import_prod_versions
|
|
|
|
schematic --fake src/olympia/migrations/
|
|
|
|
python manage.py createsuperuser
|
|
|
|
python manage.py loaddata zadmin/users
|
|
|
|
python manage.py update_permissions_from_mc
|
|
|
|
|
|
|
|
populate_data:
|
|
|
|
# reindex --wipe will force the ES mapping to be re-installed. Useful to
|
|
|
|
# make sure the mapping is correct before adding a bunch of add-ons.
|
|
|
|
python manage.py reindex --wipe --force --noinput
|
|
|
|
python manage.py generate_addons --app firefox $(NUM_ADDONS)
|
|
|
|
python manage.py generate_addons --app thunderbird $(NUM_ADDONS)
|
|
|
|
python manage.py generate_addons --app android $(NUM_ADDONS)
|
|
|
|
python manage.py generate_addons --app seamonkey $(NUM_ADDONS)
|
|
|
|
python manage.py generate_themes $(NUM_THEMES)
|
|
|
|
# Now that addons have been generated, reindex.
|
|
|
|
python manage.py reindex --force --noinput
|
|
|
|
# Also update category counts (denormalized field)
|
|
|
|
python manage.py cron category_totals
|
|
|
|
python manage.py update_permissions_from_mc
|
|
|
|
|
2018-07-19 13:13:19 +03:00
|
|
|
cleanup_python_build_dir:
|
|
|
|
# Work arounds "Multiple .dist-info directories" issue.
|
|
|
|
rm -rf /deps/build/*
|
|
|
|
|
2018-06-25 13:53:45 +03:00
|
|
|
install_python_common_dependencies:
|
2018-04-16 12:16:16 +03:00
|
|
|
# Can't use --progress-bar=off for system packages as long as our docker image
|
|
|
|
# doesn't have pip 10 by default.
|
|
|
|
pip install --no-deps --exists-action=w -r requirements/system.txt
|
2018-06-25 13:53:45 +03:00
|
|
|
|
|
|
|
install_python_test_dependencies: install_python_common_dependencies
|
|
|
|
pip install --progress-bar=off --no-deps --exists-action=w -r requirements/tests.txt
|
|
|
|
|
|
|
|
install_python_dev_dependencies: install_python_common_dependencies
|
2018-04-16 07:47:25 +03:00
|
|
|
pip install --progress-bar=off --no-deps --exists-action=w -r requirements/flake8.txt
|
|
|
|
pip install --progress-bar=off --no-deps --exists-action=w -r requirements/dev.txt
|
|
|
|
pip install --progress-bar=off --no-deps --exists-action=w -r requirements/docs.txt
|
2017-10-13 07:29:40 +03:00
|
|
|
pip install -e .
|
2017-06-15 11:41:40 +03:00
|
|
|
|
2017-06-16 18:46:00 +03:00
|
|
|
install_node_dependencies: install_node_js copy_node_js
|
|
|
|
|
|
|
|
install_node_js:
|
2017-06-15 11:41:40 +03:00
|
|
|
npm install $(NPM_ARGS)
|
|
|
|
|
|
|
|
copy_node_js:
|
2017-06-21 18:06:31 +03:00
|
|
|
for dest in $(NODE_LIBS_CSS) ; do cp $(NODE_MODULES)$$dest $(STATIC_CSS) ; done
|
2017-06-15 11:41:40 +03:00
|
|
|
for dest in $(NODE_LIBS_JS) ; do cp $(NODE_MODULES)$$dest $(STATIC_JS) ; done
|
|
|
|
for dest in $(NODE_LIBS_JQUERY_UI) ; do cp $(NODE_MODULES)$$dest $(STATIC_JQUERY_UI) ; done
|
|
|
|
|
2018-07-19 13:13:19 +03:00
|
|
|
update_deps: cleanup_python_build_dir install_python_dev_dependencies install_node_dependencies
|
2018-02-23 15:50:36 +03:00
|
|
|
# Make sure we pull our latest mozilla-product-data.
|
|
|
|
# There were scenarios where this wouldn't happen automatically during our CircleCI ui-tests so we enforce it here as a workaround.
|
2018-02-20 17:03:31 +03:00
|
|
|
python manage.py update_product_details
|
2017-06-15 11:41:40 +03:00
|
|
|
|
|
|
|
update_db:
|
|
|
|
schematic src/olympia/migrations
|
|
|
|
|
|
|
|
update_assets:
|
2018-06-28 16:27:34 +03:00
|
|
|
python manage.py compress_assets
|
2017-06-15 11:41:40 +03:00
|
|
|
python manage.py collectstatic --noinput
|
|
|
|
|
2017-06-16 18:46:00 +03:00
|
|
|
update: update_deps update_db update_assets
|
2017-06-15 11:41:40 +03:00
|
|
|
python manage.py update_permissions_from_mc
|
|
|
|
|
|
|
|
reindex:
|
|
|
|
python manage.py reindex $(ARGS)
|
|
|
|
|
2018-04-25 12:32:40 +03:00
|
|
|
setup-ui-tests:
|
2017-10-05 14:14:08 +03:00
|
|
|
rm -rf ./user-media/* ./tmp/*
|
2018-01-12 08:58:00 +03:00
|
|
|
# Reset the database and fake database migrations
|
2018-07-17 10:40:45 +03:00
|
|
|
python manage.py reset_db --noinput
|
Update to Django 1.11 (#8738)
Port code and tests to Django 1.11.
* Update requirements to Django 1.11.14, remove session_csrf
* Use --run-syncdb for migration calls
* Remove unused setup-docker script
* Port code and tests to Django 1.11.
* Remove django-session-csrf everywhere, it got replaced by django's own
session csrf protection
* Make sure we are calling `client.get()` with `follow=True` where necessary
* Replace django.core.urlresolvers import with django.urls
* Port custom `IconWidgetRenderer` to Django 1.11 as `IconTypeSelect`
* Properly use `_queryset_class` for custom manager classes
* Make use of `base_manager_name` on our models `Meta` instead of `use_for_related_objects`
on the manager where appropriate. This is required to make translations, soft-delete
and more work. See comment on Addons.Meta for more details.
* Various fixes along the way to make tests work
* Port form errors for locale editing forms to Django 1.11 and make use of
form.add_error instead of our own custom process
* Mark TestDetailPage.test_304 as xfail for now, somehow Etags seem to be broken
for that view during tests but work fine in manual tests
* Fix amo.celery, we cannot have any imports at the module-level that may
import the ORM
* Fix global_settings context processor for 500-server error cases
* Fix `changed_data` handling in `AMOModelForm`
* Remove `queryset_transform` and implement it directly in amo/models
* Fix pagination, Django changed how `num_pages` work and how `count` can be overwritten
* Add a new test that tests database transforms as `BaseQuerysetTestCase`
* Make sure `legacy_redirect` only appends `?` if there are actual GET parameters
* Re-implement `LicenseRadioChoiceInput` as `LicenseRadioSelect` which is now Django 1.11 compatible
* Remove our custom `form_kwargs` uplift from Django 1.9
* Correct how we're using `Category.objects.create` and only pass `db_name` instead of `name`, previously
this didn't error but now it (luckily!) does
* Update `FileSelectWidget` to correctly work with Django 1.11, use custom rendering
* Fix decorator ordering for `files.views:browse`
* Update database settings to correctly use `TEST` object
* Fix `select_related` call in `RatingViewSet`
* Remove custom `DateTimeCast` implementation
* Fix `addon_factory` calls in `reviewers/tests/test_views.py` to correctly set
`is_webextension`
* Port our `TranslationDescriptor` and `TranslatedField` to Django 1.11. Also, make sure form error handling works
* Add a new test that checks that `default=None` is a valid setting for translation fields
* Add a new test that checks that translations from related fields are correctly fetched
* Remove possible ambiguity from translations `TestWidget` tests
* Make sure that the correct `MEDIA_URL` is set in `TestDownloadsUnlistedVersions` to fix
external cdn tests
* Remove custom happyforms code. Django cleans text fields now by default
* Move translations app to the top of INSTALLED_APPS, add a lengthy comment
* Pass additional arguments to contribute_to_class, fix smaller nits
* Set MEDIA_URL and STATIC_URL to an external value by default. That's how they're configured in dev, stage and prod anyway.
Please note that we didn't replace all our custom form rendering with proper templated widgets yet. This will
happening in some follow-up work.
Fixes #5271, Fixes #1569
2018-07-11 07:56:54 +03:00
|
|
|
python manage.py migrate --noinput --run-syncdb
|
2017-10-05 14:14:08 +03:00
|
|
|
schematic --fake src/olympia/migrations/
|
2018-01-12 08:58:00 +03:00
|
|
|
|
|
|
|
# Let's load some initial data and import mozilla-product versions
|
|
|
|
python manage.py loaddata initial.json
|
2017-10-05 14:14:08 +03:00
|
|
|
python manage.py loaddata zadmin/users
|
|
|
|
python manage.py loaddata src/olympia/access/fixtures/initial.json
|
2018-01-12 08:58:00 +03:00
|
|
|
|
|
|
|
python manage.py import_prod_versions
|
|
|
|
python manage.py update_permissions_from_mc
|
|
|
|
|
|
|
|
# Create a proper superuser that can be used to access the API
|
2018-01-26 10:19:33 +03:00
|
|
|
python manage.py waffle_switch super-create-accounts on --create
|
|
|
|
python manage.py waffle_switch activate-autograph-signing on --create
|
2018-01-12 08:58:00 +03:00
|
|
|
|
2018-08-28 21:48:35 +03:00
|
|
|
run-ui-tests: setup-ui-tests
|
2018-01-12 08:58:00 +03:00
|
|
|
# Generate test add-ons and force a reindex to make sure things are updated
|
2018-08-28 21:48:35 +03:00
|
|
|
pip install --progress-bar=off --no-deps -r requirements/uitests.txt
|
2017-10-05 14:14:08 +03:00
|
|
|
python manage.py generate_ui_test_addons
|
2018-01-12 08:58:00 +03:00
|
|
|
python manage.py reindex --force --noinput --wipe
|
2018-08-28 21:48:35 +03:00
|
|
|
pytest --driver Firefox tests/ui/
|
2017-10-05 14:14:08 +03:00
|
|
|
|
2018-04-25 12:32:40 +03:00
|
|
|
perf-tests: setup-ui-tests
|
|
|
|
pip install --progress-bar=off --no-deps -r requirements/perftests.txt
|
|
|
|
locust --no-web -c 1 -f tests/performance/locustfile.py --host "http://olympia.test"
|
|
|
|
|
2017-06-16 18:46:00 +03:00
|
|
|
initialize: update_deps initialize_db update_assets populate_data
|