Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion froide/account/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ def create_export(request):
format_html(
_(
"Your next export will be possible at {date}. "
'<a href="{url}">You can download your current '
'<a href="{url}" class="alert-link">You can download your current '
"export here</a>."
),
date=formats.date_format(result, "SHORT_DATETIME_FORMAT"),
Expand Down
2 changes: 1 addition & 1 deletion froide/foirequest/models/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def get_throttle_config(cls):
def get_throttle_message(cls):
return mark_safe(
_(
'You exceeded your request limit of %(count)s requests in %(time)s. <a href="%(url)s">Learn more</a>'
'You exceeded your request limit of %(count)s requests in %(time)s. <a href="%(url)s" class="alert-link">Learn more</a>'
)
)

Expand Down
8 changes: 4 additions & 4 deletions froide/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -9315,8 +9315,8 @@ msgstr "Sie haben die Begrenzung von %(count)s Nachrichten in %(time)s überschr

#: froide/foirequest/models/request.py
#, python-format
msgid "You exceeded your request limit of %(count)s requests in %(time)s. <a href=\"%(url)s\">Learn more</a>"
msgstr "Sie haben die Begrenzung von %(count)s Anfragen in %(time)s überschritten. Dies ist eine automatische Vorsichtsmaßnahme. <a href=\"%(url)s\">Mehr erfahren</a>"
msgid "You exceeded your request limit of %(count)s requests in %(time)s. <a href=\"%(url)s\" class=\"alert-link\">Learn more</a>"
msgstr "Sie haben die Begrenzung von %(count)s Anfragen in %(time)s überschritten. Dies ist eine automatische Vorsichtsmaßnahme. <a href=\"%(url)s\" class=\"alert-link\">Mehr erfahren</a>"

#: froide/helper/spam.py
msgid "You filled this form out too quickly."
Expand Down Expand Up @@ -9782,8 +9782,8 @@ msgstr "Ihr Name:"

#: froide/account/views.py
#, python-brace-format
msgid "Your next export will be possible at {date}. <a href=\"{url}\">You can download your current export here</a>."
msgstr "Ihr nächster Datenexport ist möglich am {date}. <a href=\"{url}\">Sie können Ihren Export hier herunterladen</a>."
msgid "Your next export will be possible at {date}. <a href=\"{url}\" class=\"alert-link\">You can download your current export here</a>."
msgstr "Ihr nächster Datenexport ist möglich am {date}. <a href=\"{url}\" class=\"alert-link\">Sie können Ihren Export hier herunterladen</a>."

#: froide/account/views.py
msgid "Your password has been changed."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
incomplete:color-contrast
violations:color-contrast
violations:select-name
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:label
violations:link-in-text-block
violations:link-in-text-block
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
incomplete:aria-required-children
incomplete:color-contrast
violations:color-contrast
violations:label
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:aria-prohibited-attr
incomplete:aria-required-children
incomplete:color-contrast
violations:color-contrast
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
violations:link-in-text-block
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:link-in-text-block
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:link-in-text-block
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:color-contrast
violations:landmark-unique
violations:page-has-heading-one
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
incomplete:aria-prohibited-attr
incomplete:color-contrast
incomplete:link-in-text-block
violations:aria-required-children
violations:aria-required-parent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
incomplete:color-contrast
violations:label
violations:label-title-only
violations:select-name
28 changes: 25 additions & 3 deletions froide_a11y/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@
"resultTypes": RESULT_TYPES,
}

# Findings that depend on how the platform renders the page, not on the page itself,
# so they differ between machines.
DEFAULT_IGNORED_FINDINGS = frozenset({"incomplete:color-contrast"})


@pytest.fixture
def check_a11y(request, snapshot_regression, a11y_axe_options, pytestconfig):
def check_a11y(
request,
snapshot_regression,
a11y_axe_options,
a11y_ignored_findings,
pytestconfig,
):
"""Assert that a page turns up nothing new since the last snapshot.

The snapshot is named after the test, `suffix` is appended to that. `context` and
Expand Down Expand Up @@ -56,7 +66,9 @@ async def _check_a11y(
page, context=context, options={**a11y_axe_options, **(options or {})}
)
snapshot_regression.check(
"\n".join(f"{finding}" for finding in _findings(results)),
"\n".join(
f"{finding}" for finding in _findings(results, a11y_ignored_findings)
),
extension=".txt",
basename=_basename(request.node.name, suffix),
check_fn=lambda obtained, expected: _compare(
Expand Down Expand Up @@ -145,6 +157,15 @@ def a11y_axe_options() -> dict:
return DEFAULT_AXE_OPTIONS


@pytest.fixture(scope="session")
def a11y_ignored_findings() -> frozenset[str]:
"""`<result type>:<rule id>` findings that are not recorded or reported.

Override in a conftest to ignore a different set.
"""
return DEFAULT_IGNORED_FINDINGS


@pytest.fixture(scope="session")
def snapshot_dirname() -> str:
"""Directory, relative to a test module, that regression data is kept in.
Expand Down Expand Up @@ -173,14 +194,15 @@ def snapshot_regression(
return FileRegressionFixture(LazyDataDir(datadir, tmp_path), datadir, request)


def _findings(results: "AxeResults") -> list[str]:
def _findings(results: "AxeResults", ignored: frozenset[str]) -> list[str]:
"""The `<result type>:<rule id>` label of every finding on the page."""
return sorted(
{
f"{result_type}:{finding['id']}"
for result_type in RESULT_TYPES
for finding in results.response[result_type]
}
- ignored
)


Expand Down
Loading