diff --git a/README.md b/README.md index 7a9f1243..1ef2ec9d 100644 --- a/README.md +++ b/README.md @@ -73,3 +73,11 @@ From the `server/` directory run the following 3. `python -m http.server 1337` 4. visit `http://localhost:1337/htmlcov/` and dig into modules to see which individual line coverage + +## Selenium tests + +There are a few tests that use a live browser to test interaction. These do not run by default. You'll have to run them via `python manage.py test --selenium tests/selenium/`. + +These tests should work both in postgres and sqlite. But when using postgres, if anything goes wrong, the DB may not reset correctly and you may have to reset it (see dropdb test db command above). + +You can run regular tests or these tests, never both at the same time. Do not attempt to run regular tests with --selenium or selenium tests without it, or else it will error and you will need to reset the test DB. diff --git a/server/cpho/fixtures/dimension_lookups.yaml b/server/cpho/fixtures/dimension_lookups.yaml index 31ee55ad..dcc1ce91 100644 --- a/server/cpho/fixtures/dimension_lookups.yaml +++ b/server/cpho/fixtures/dimension_lookups.yaml @@ -104,7 +104,7 @@ fields: dimension_type: 1 name_en: Male - name_fr: Male + name_fr: Mâle value: m excel_code: "MALES" order: 0.0 @@ -113,7 +113,7 @@ fields: dimension_type: 1 name_en: Female - name_fr: Female + name_fr: Femelle value: f excel_code: "FEMALES" order: 1.0 diff --git a/server/cpho/jinja2/base.jinja2 b/server/cpho/jinja2/base.jinja2 index 32d7fde1..cba1c563 100644 --- a/server/cpho/jinja2/base.jinja2 +++ b/server/cpho/jinja2/base.jinja2 @@ -30,6 +30,7 @@ {% block extra_scripts_css %}{% endblock %}
+ {{ tm("skip_to_main") }} {{ phac_aspc.phac_aspc_wet_session_timeout_dialog(dict(request=request) , 'logout') }} + {% endblock %} diff --git a/server/cpho/jinja2/breadcrumb_macros.jinja2 b/server/cpho/jinja2/breadcrumb_macros.jinja2 index e7fa2285..fbe4664b 100644 --- a/server/cpho/jinja2/breadcrumb_macros.jinja2 +++ b/server/cpho/jinja2/breadcrumb_macros.jinja2 @@ -15,7 +15,7 @@ {% endmacro %} {% macro indicator(indicator, active) %} - {{ item(indicator.name , url('view_indicator', args=[indicator.id]) , active) }} + {{ item(indicator.bilingual_name , url('view_indicator', args=[indicator.id]) , active) }} {% endmacro %} {% macro indicator_period(indicator, period, active) %} diff --git a/server/cpho/jinja2/changelog/changelog_macros.jinja2 b/server/cpho/jinja2/changelog/changelog_macros.jinja2 index 5ff25d4e..c4adfb56 100644 --- a/server/cpho/jinja2/changelog/changelog_macros.jinja2 +++ b/server/cpho/jinja2/changelog/changelog_macros.jinja2 @@ -1,72 +1,75 @@ {% from 'generic_macros.jinja2' import date_display %} {% macro changelog_table(edit_entries, show_model_type=True, show_user=True) %} -| {{ tm("date") }} | - {% if show_user %}{{ tm("author") }} | {% endif %} -{{ tm("action") }} | - {% if show_model_type %}{{ tm("object_type") }} | {% endif %} -{{ tm("name") }} | -{{ tm("field") }} | -{{ tm("previous_change") }} | -{{ tm("this_change") }} | -|||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ date_display(edit_entry.right_version.timestamp) }} | - {% if show_user %} -- {% if edit_entry.author %} - {{ edit_entry.author.pretty_name }} - {% else %} - {{ tm("n/a") }} - {% endif %} - | - {% endif %} -{{ tm("saved") }} | - {% if show_model_type %}{{ edit_entry.eternal._meta.verbose_name }} | {% endif %} -{{ edit_entry.live_name }} | -{{ tm("no_change_detected_compared_to_previous_version") }} | -|||||||||||||||||||||||||
| {{ date_display(edit_entry.right_version.timestamp) }} | - {% if show_user %} +||||||||||||||||||||||||||||||
| {{ tm("date") }} | + {% if show_user %}{{ tm("author") }} | {% endif %} +{{ tm("action") }} | + {% if show_model_type %}{{ tm("object_type") }} | {% endif %} +{{ tm("name") }} | +{{ tm("field") }} | +{{ tm("previous_change") }} | +{{ tm("this_change") }} | +||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ date_display(edit_entry.right_version.timestamp) }} | + {% if show_user %} ++ {% if edit_entry.author %} + {{ edit_entry.author.pretty_name }} + {% else %} + {{ tm("n/a") }} + {% endif %} + | + {% endif %} +{{ tm("saved") }} | + {% if show_model_type %}{{ edit_entry.eternal._meta.verbose_name }} | {% endif %} +{{ edit_entry.live_name }} | +{{ tm("no_change_detected_compared_to_previous_version") }} | +||||||
| {{ date_display(edit_entry.right_version.timestamp) }} | + {% if show_user %} ++ {% if edit_entry.author %} + {{ edit_entry.author.pretty_name }} + {% else %} + {{ tm("n/a") }} + {% endif %} + | + {% endif %} +{{ diff.action }} | + {% if show_model_type %}{{ edit_entry.eternal._meta.verbose_name }} | {% endif %} +{{ edit_entry.live_name }} | - {% if edit_entry.author %} - {{ edit_entry.author.pretty_name }} - {% else %} - {{ tm("n/a") }} - {% endif %} + {% if diff.field %}{{ diff.field.verbose_name }}{% endif %} | - {% endif %} -{{ diff.action }} | - {% if show_model_type %}{{ edit_entry.eternal._meta.verbose_name }} | {% endif %} -{{ edit_entry.live_name }} | -- {% if diff.field %}{{ diff.field.verbose_name }}{% endif %} - | - {###############autoescape content is escaped ######################} - {% autoescape false %} -{{ diff.get_before_diff() }} | - {% endautoescape %} - {% autoescape false %} -{{ diff.get_after_diff() }} | - {% endautoescape %} - {% block extra_columns %}{% endblock %} -{{ diff.get_before_diff() }} | + {% endautoescape %} + {% autoescape false %} +{{ diff.get_after_diff() }} | + {% endautoescape %} + {% block extra_columns %}{% endblock %} + + {% endfor %} {% endfor %} - {% endfor %} - -
| {{ tm("stratifier_value") }} | -{{ tm("indicator_value") }} | -{{ tm("last_modified") }} | -{{ tm("hso_submission") }} | -{{ tm("program_submission") }} | -
|---|
| - {% if datum.dimension_type.is_literal %} - {{ datum.literal_dimension_val }} - {% else %} - {{ datum.dimension_value.name }} - {% endif %} - | -{{ datum.value }} | -{{ date_display(datum.last_version_date) }} | -{{ submission_status_label(datum.submission_status(submission_type="hso") ) }} | -{{ submission_status_label(datum.submission_status(submission_type="program") ) }} | +{{ tm("stratifier_value") }} | +{{ tm("indicator_value") }} | +{{ tm("last_modified") }} | +{{ tm("hso_submission") }} | +{{ tm("program_submission") }} |
|---|
{{ tm("quintile_metadata_description") }}
-| {{ tm("quintile") }} | -{{ vb_name('cpho.Indicator', 'g1') }} | -{{ vb_name('cpho.Indicator', 'g2_lower') }} | -{{ vb_name('cpho.Indicator', 'g2_upper') }} | -{{ vb_name('cpho.Indicator', 'g3_lower') }} | -{{ vb_name('cpho.Indicator', 'g3_upper') }} | -{{ vb_name('cpho.Indicator', 'g4_lower') }} | -{{ vb_name('cpho.Indicator', 'g4_upper') }} | -{{ vb_name('cpho.Indicator', 'g5') }} | -
|---|---|---|---|---|---|---|---|---|
| {{ row_name }} | -
- {{ form.g1 }}
- {{ hidden_a11y_label(form.g1, row_name) }}
- |
-
- {{ form.g2_lower }}
- {{ hidden_a11y_label(form.g2_lower, row_name) }}
- |
-
- {{ form.g2_upper }}
- {{ hidden_a11y_label(form.g2_upper, row_name) }}
- |
-
- {{ form.g3_lower }}
- {{ hidden_a11y_label(form.g3_lower, row_name ,) }}
- |
-
- {{ form.g3_upper }}
- {{ hidden_a11y_label(form.g3_upper, row_name) }}
- |
-
- {{ form.g4_lower }}
- {{ hidden_a11y_label(form.g4_lower, row_name) }}
- |
-
- {{ form.g4_upper }}
- {{ hidden_a11y_label(form.g4_upper, row_name) }}
- |
-
- {{ form.g5 }}
- {{ hidden_a11y_label(form.g5, row_name) }}
- |
-
| {{ tm("quintile") }} | +{{ vb_name('cpho.Indicator', 'g1') }} | +{{ vb_name('cpho.Indicator', 'g2_lower') }} | +{{ vb_name('cpho.Indicator', 'g2_upper') }} | +{{ vb_name('cpho.Indicator', 'g3_lower') }} | +{{ vb_name('cpho.Indicator', 'g3_upper') }} | +{{ vb_name('cpho.Indicator', 'g4_lower') }} | +{{ vb_name('cpho.Indicator', 'g4_upper') }} | +{{ vb_name('cpho.Indicator', 'g5') }} | +
|---|---|---|---|---|---|---|---|---|
| {{ row_name }} | +
+ {{ form.g1 }}
+ {{ hidden_a11y_label(form.g1, row_name) }}
+ |
+
+ {{ form.g2_lower }}
+ {{ hidden_a11y_label(form.g2_lower, row_name) }}
+ |
+
+ {{ form.g2_upper }}
+ {{ hidden_a11y_label(form.g2_upper, row_name) }}
+ |
+
+ {{ form.g3_lower }}
+ {{ hidden_a11y_label(form.g3_lower, row_name ,) }}
+ |
+
+ {{ form.g3_upper }}
+ {{ hidden_a11y_label(form.g3_upper, row_name) }}
+ |
+
+ {{ form.g4_lower }}
+ {{ hidden_a11y_label(form.g4_lower, row_name) }}
+ |
+
+ {{ form.g4_upper }}
+ {{ hidden_a11y_label(form.g4_upper, row_name) }}
+ |
+
+ {{ form.g5 }}
+ {{ hidden_a11y_label(form.g5, row_name) }}
+ |
+
| {{ indicator.name }} | +{{ indicator.bilingual_name }} | {{ indicator.get_category_display() }} | {{ indicator.get_topic_display() }} | {{ tm("view_indicator") }} + aria-label="{{ tm("view_indicator") }}, {{ indicator.bilingual_name }}">{{ tm("view_indicator") }} |
| {{ tm("field") }} | -{{ tm("value") }} | -
|---|
| {{ tm("field") }} | +{{ tm("value") }} | +
|---|---|
| {{ tm("relevant_dimensions") }} | -
-
|
-
| {{ tm("relevant_dimensions") }} | +
+
|
+
{{ tm("quintile_metadata_description") }}
-| {{ tm("quintile") }} | -G1 | -G2 {{ tm("lower") }} | -G2 {{ tm("upper") }} | -G3 {{ tm("lower") }} | -G3 {{ tm("upper") }} | -G4 {{ tm("lower") }} | -G4 {{ tm("upper") }} | -G5 | -
|---|---|---|---|---|---|---|---|---|
| {{ tm("quintile_values") }} | -{{ ind.g1 }} | -{{ ind.g2_lower }} | -{{ ind.g2_upper }} | -{{ ind.g3_lower }} | -{{ ind.g3_upper }} | -{{ ind.g4_lower }} | -{{ ind.g4_upper }} | -{{ ind.g5 }} | -
| {{ tm("quintile") }} | +G1 | +G2 {{ tm("lower") }} | +G2 {{ tm("upper") }} | +G3 {{ tm("lower") }} | +G3 {{ tm("upper") }} | +G4 {{ tm("lower") }} | +G4 {{ tm("upper") }} | +G5 | +
|---|---|---|---|---|---|---|---|---|
| {{ tm("quintile_values") }} | +{{ ind.g1 }} | +{{ ind.g2_lower }} | +{{ ind.g2_upper }} | +{{ ind.g3_lower }} | +{{ ind.g3_upper }} | +{{ ind.g4_lower }} | +{{ ind.g4_upper }} | +{{ ind.g5 }} | +
| {{ tm("oecd_country") }} | -{{ tm("value") }} | -{{ tm("unit") }} | -{{ tm("year") }} | -{{ tm("comparison_to_oecd_average") }} | -{{ tm("labels") }} | -{{ tm("methodology_differences") }} | -
|---|
| {{ item.oecd_country }} | -{{ item.value }} | -{{ item.get_unit_display() }} | -{{ item.year }} | -{{ item.get_comparison_to_oecd_avg_display() }} | -{{ item.get_labels_display() }} | -{{ tm(item.get_methodology_differences_display() ) }} | +{{ tm("oecd_country") }} | +{{ tm("value") }} | +{{ tm("unit") }} | +{{ tm("year") }} | +{{ tm("comparison_to_oecd_average") }} | +{{ tm("labels") }} | +{{ tm("methodology_differences") }} |
|---|
| {{ tm("year_or_range") }} | -{{ tm("data_point") }} | -{{ tm("line_of_best_fit_point") }} | -{{ tm("trend_segment") }} | -{{ tm("trend") }} | -{{ tm("data_quality") }} | -{{ tm("unit") }} | -{{ tm("data_lower_ci") }} | -{{ tm("data_upper_ci") }} | -
|---|
| {{ item.year }} | -{{ item.data_point }} | -{{ item.line_of_best_fit_point }} | -{{ item.trend_segment }} | -{{ item.get_trend_display() }} | -{{ item.get_data_quality_display() }} | -{{ item.get_unit_display() }} | -{{ item.data_point_lower_ci }} | -{{ item.data_point_upper_ci }} | +{{ tm("year_or_range") }} | +{{ tm("data_point") }} | +{{ tm("line_of_best_fit_point") }} | +{{ tm("trend_segment") }} | +{{ tm("trend") }} | +{{ tm("data_quality") }} | +{{ tm("unit") }} | +{{ tm("data_lower_ci") }} | +{{ tm("data_upper_ci") }} |
|---|
{{ tm("users") }}
-| {{ tm("user") }} | -{{ tm("last_login") }} | - - - {% for user in indicator_directory.users.all() %} -
|---|---|
| {{ user }} | -- {% if user.last_login %} - {{ date_display(user.last_login) }} - {% else %} - {{ tm("never") }} - {% endif %} - | -
| {{ tm("user") }} | +{{ tm("last_login") }} | + + + {% for user in indicator_directory.users.all() %} +
|---|---|
| {{ user }} | ++ {% if user.last_login %} + {{ date_display(user.last_login) }} + {% else %} + {{ tm("never") }} + {% endif %} + | +
| {{ tdt("Username") }} | -{{ tdt("Special roles") }} | -{{ tdt("Last login") }} | -{{ tdt("Modify") }} | -
|---|
| {{ user }} | -- {% if user.is_admin %}{{ tdt("Admin") }}{% endif %} - {% if user.is_hso %}{{ tdt("HSO") }}{% endif %} - | -- {% if user.last_login %}{{ date_display(user.last_login) }}{% endif %} - | -- {{ tdt("Modify") }} - | +{{ tdt("Username") }} | +{{ tdt("Special roles") }} | +{{ tdt("Last login") }} | +{{ tdt("Modify") }} |
|---|