Skip to content

MENDELU/Fixed integration tests#1294

Merged
milanmajchrak merged 7 commits into
customer/mendelufrom
fix/customer-mendelu-e2e-a11y
May 27, 2026
Merged

MENDELU/Fixed integration tests#1294
milanmajchrak merged 7 commits into
customer/mendelufrom
fix/customer-mendelu-e2e-a11y

Conversation

@milanmajchrak
Copy link
Copy Markdown
Collaborator

@milanmajchrak milanmajchrak commented May 25, 2026

Summary

Fix Cypress accessibility failures on customer/mendelu by adding accessible names to thumbnail-only links.

Root Cause

Some search-result list templates rendered <a> around only <ds-thumbnail> with no discernible text/label, triggering axe link-name violations.

Change

Added:

  • [attr.aria-label]="dsoNameService.getName(dso)"

Updated templates:

  • journal-issue search result list element
  • journal-volume search result list element
  • journal search result list element
  • project search result list element
  • generic item search result list element

Impact

  • Fixes CI e2e a11y failures in item-edit and item-page specs
  • Improves screen-reader accessibility for thumbnail links
  • No business logic changes

Sync verification

If en.json5 or cs.json5 translation files were updated:

  • Run yarn run sync-i18n -t src/assets/i18n/cs.json5 -i to synchronize messages, and changes are included in this PR.

Manual Testing (if applicable)

Copilot review

  • Requested review from Copilot

Copilot AI review requested due to automatic review settings May 25, 2026 09:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates several search result list-element templates to improve accessibility (and likely address related integration/a11y assertions) by providing an accessible name for thumbnail-only links.

Changes:

  • Added aria-label to thumbnail <a> links using dsoNameService.getName(dso) across multiple item/entity list elements.
  • Kept existing link behavior (target, rel, routerLink, tabindex) unchanged while improving screen-reader support.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.html Adds aria-label to the thumbnail link for item search result list elements.
src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.html Adds aria-label to the thumbnail link for project search result list elements.
src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.html Adds aria-label to the thumbnail link for journal search result list elements.
src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.html Adds aria-label to the thumbnail link for journal volume search result list elements.
src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.html Adds aria-label to the thumbnail link for journal issue search result list elements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ull item-page render

MetadataLinkService is a singleton (providedIn: root) that fetches 5 backend
configuration properties in parallel via combineLatest. The template on the
full item page subscribes to it via async pipes inside an @for loop over
metadata entries; subscriber count fluctuates as rows render, and with
shareReplay({ refCount: true }) the inner subscription was torn down and
re-created repeatedly, causing the 5 HTTP calls to repeat and the metadata
table to render slowly or inconsistently on Cypress CI runners.

- Switch shareReplay to refCount: false so resolver values are cached for
  the lifetime of the service.
- Eagerly subscribe in the constructor so the fetches start as soon as the
  service is created (during the first FullItemPageComponent instantiation),
  warming the replay buffer before template subscriptions run.
…ilize /full item-page render"

This reverts commit 3b852c4.
…it for inner content before axe checks

- edit-item-page tablist had disabled <button> children without role=tab; when all tabs start with enabled|async = false the <ul role=tablist> momentarily has no role=tab children, triggering aria-required-children. Add role=tab + aria-disabled=true + aria-selected=false + tabindex=-1 to the disabled button so the tablist always has valid children.

- For 4 axe checks that failed with 'No elements found for include in page Context' on CI runners (collection delete, community delete, item-edit status, item /full), wait for a stable inner element to render before calling testA11y; the host element passes :visible due to its padding/header even when its main content hasn't streamed in yet.
…olver config permanently

Previous push reduced failures from 5 to 3 tests; remaining 3 all fail with 'No elements found for include in page Context': /full (despite 30s wait for .item-page + ds-item-page-title-field that PASSED), item-edit Bitstreams tab, community-edit Assign Roles tab.

1) testA11y(): when include is a CSS string, wait up to 30s for any child to exist on the host before running axe. Eliminates host-without-content races uniformly across every axe-checked spec.

2) MetadataLinkService: shareReplay refCount true -> false, plus eager subscribe in constructor. Service is providedIn root with combineLatest of 5 backend configuration HTTP calls. On /full item page, async pipes inside @for over metadata rows churn subscribers; with refCount true each churn tears down the inner subscription and re-fetches all 5 properties, causing the template to repeatedly re-evaluate and produce empty intermediate render states (visible as blank main content in the CI failure screenshot). Caching for the service lifetime stabilises the render.
… avoid 'No elements found' race

After previous push, CI improved 3->3 failures but the remaining 3 (community Delete, item-edit Curate, /full) all still fail with 'No elements found for include in page Context'.

Root cause: cypress-axe forwards the string selector context to axe.run, which re-resolves it via document.querySelectorAll at axe.run time. Between Cypress commands (injectAxe reads the axe-core source file, configureAxe evals window.axe.configure) several ms elapse; Angular can re-render and remove the host element from the document for one microtask, making the selector resolve to zero elements.

Fix: in testA11y, after waiting for the host with rendered descendants, resolve the selector ourselves and pass the live DOM Element reference (not the selector string) to cy.checkA11y. axe-core uses the Element directly and skips selector resolution, eliminating the race.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread cypress/support/utils.ts Outdated
Addresses Copilot review on PR #1294: when selector matches multiple elements, scanning only \[0] reduced coverage. Use \.toArray() so axe sees all matches like the original string-context did.
@milanmajchrak milanmajchrak merged commit cee36c5 into customer/mendelu May 27, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants