@alfresco/aca-playwright-shared 8.1.0-32006365178 → 8.1.0-32112887922

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -600,6 +600,105 @@ async function cleanupRepositoryTestData(testData, apis) {
600
600
  }
601
601
  }
602
602
 
603
+ /*!
604
+ * Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
605
+ *
606
+ * Alfresco Example Content Application
607
+ *
608
+ * This file is part of the Alfresco Example Content Application.
609
+ * If the software was purchased under a paid Alfresco license, the terms of
610
+ * the paid license agreement will prevail. Otherwise, the software is
611
+ * provided under the following open source license terms:
612
+ *
613
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
614
+ * it under the terms of the GNU Lesser General Public License as published by
615
+ * the Free Software Foundation, either version 3 of the License, or
616
+ * (at your option) any later version.
617
+ *
618
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
619
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
620
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
621
+ * GNU Lesser General Public License for more details.
622
+ *
623
+ * You should have received a copy of the GNU Lesser General Public License
624
+ * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
625
+ */
626
+ const INTERACTIVE_TAG_NAMES = ['button', 'a', 'input', 'select', 'textarea'];
627
+ const INTERACTIVE_ROLES = ['button', 'link', 'menuitem', 'checkbox', 'radio', 'tab', 'switch', 'option'];
628
+ async function hasAccessibleName(element) {
629
+ const ariaLabelledBy = await element.getAttribute('aria-labelledby');
630
+ const ariaLabel = await element.getAttribute('aria-label');
631
+ const title = await element.getAttribute('title');
632
+ const text = await element.textContent();
633
+ return Boolean(ariaLabelledBy || ariaLabel || title || text?.trim());
634
+ }
635
+ async function hasAccessibleAttribute(element) {
636
+ const ariaLabelledBy = await element.getAttribute('aria-labelledby');
637
+ const ariaLabel = await element.getAttribute('aria-label');
638
+ return Boolean(ariaLabelledBy || ariaLabel);
639
+ }
640
+ async function isInteractiveElement(element) {
641
+ const tagName = await element.evaluate((el) => el.tagName.toLowerCase());
642
+ const role = await element.getAttribute('role');
643
+ const tabindexAttr = await element.getAttribute('tabindex');
644
+ const tabindex = tabindexAttr === null ? null : parseInt(tabindexAttr, 10);
645
+ const hasFocusableTabIndex = tabindex !== null && !Number.isNaN(tabindex) && tabindex >= 0;
646
+ return INTERACTIVE_TAG_NAMES.includes(tagName) || INTERACTIVE_ROLES.includes(role || '') || hasFocusableTabIndex;
647
+ }
648
+ async function verifyElementsHaveNames(page, selector) {
649
+ const elements = page.locator(selector);
650
+ const count = await elements.count();
651
+ for (let i = 0; i < count; i++) {
652
+ const element = elements.nth(i);
653
+ if (await element.isVisible()) {
654
+ const hasName = await hasAccessibleName(element);
655
+ if (!hasName) {
656
+ return false;
657
+ }
658
+ }
659
+ }
660
+ return true;
661
+ }
662
+ async function verifyRegionAccessibleNames(page, regionSelector, elementSelector = 'button, [role="button"], a') {
663
+ const selector = regionSelector ? `${regionSelector} ${elementSelector}` : elementSelector;
664
+ return verifyElementsHaveNames(page, selector);
665
+ }
666
+ async function verifyDataTableAccessibility(page, tableSelector = 'adf-datatable, [role="grid"]') {
667
+ const table = page.locator(tableSelector).first();
668
+ if (!(await table.isVisible().catch(() => false))) {
669
+ throw new Error(`Table not visible with selector: ${tableSelector}`);
670
+ }
671
+ const headers = table.locator('[role="columnheader"]');
672
+ const headerCount = await headers.count();
673
+ if (headerCount === 0) {
674
+ throw new Error('Table has no columnheader elements');
675
+ }
676
+ const firstHeader = headers.first();
677
+ if (!(await hasAccessibleName(firstHeader))) {
678
+ throw new Error('First header lacks accessible name (aria-label, title, or text content)');
679
+ }
680
+ const firstDataRow = table.locator('[role="row"]').nth(1);
681
+ if (await firstDataRow.isVisible({ timeout: 3000 }).catch(() => false)) {
682
+ const cells = firstDataRow.locator('[role="gridcell"]');
683
+ const cellCount = await cells.count();
684
+ if (cellCount !== headerCount) {
685
+ throw new Error(`First data row has ${cellCount} cells but ${headerCount} headers`);
686
+ }
687
+ const firstCell = cells.first();
688
+ if (!(await hasAccessibleName(firstCell))) {
689
+ throw new Error('First cell lacks accessible name');
690
+ }
691
+ }
692
+ const checkboxes = table.locator('[role="checkbox"]');
693
+ const checkboxCount = await checkboxes.count();
694
+ if (checkboxCount > 0) {
695
+ const firstCheckbox = checkboxes.first();
696
+ if (!(await hasAccessibleName(firstCheckbox))) {
697
+ throw new Error('Checkbox lacks accessible name');
698
+ }
699
+ }
700
+ }
701
+
603
702
  /*!
604
703
  * Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
605
704
  *
@@ -7738,5 +7837,5 @@ const TEST_FILES = {
7738
7837
  * Generated bundle index. Do not edit.
7739
7838
  */
7740
7839
 
7741
- export { APP_ROUTES, AcaHeader, ActionType, ActionTypes, ActionsDropdownComponent, AdfConfirmDialogComponent, AdfDeleteTrashComponent, AdfFolderDialogComponent, AdfInfoDrawerComponent, AdfLibraryDialogComponent, ApiClientFactory, BaseComponent, BasePage, Breadcrumb, CategoriesApi, Comparator, ConditionComponent, ConditionsTypes, ContentNodeSelectorDialog, CreateFromTemplateDialogComponent, DataTableComponent, DateTimePicker, EditDialog, EditModeComponent, ErrorComponent, FavoritesLibrariesPage, FavoritesPage, FavoritesPageApi, Field, FileActionsApi, FolderInformationDialogComponent, LinkRulesDialog, LoginPage, ManageRules, ManageRulesDialogComponent, ManageVersionsDialog, MatMenuComponent, MimeType, MyLibrariesPage, NodesApi, NodesPage, PaginationActionsType, PaginationComponent, PasswordOverlayDialogComponent, Person, PersonalFilesPage, QueriesApi, RecentFilesPage, RulesApi, RulesToolbarComponent, SIDEBAR_LABELS, SITE_ROLES, SITE_VISIBILITY, SearchApi, SearchFilters, SearchFiltersCategories, SearchFiltersDate, SearchFiltersLocation, SearchFiltersLogic, SearchFiltersProperties, SearchFiltersTags, SearchInputComponent, SearchMenuCard, SearchPage, SearchSortingPicker, ShareDialogComponent, SharedLinksApi, SharedPage, SidenavComponent, SitesApi, SnackBarComponent, TEST_FILES, TagsApi, TrashPage, TrashcanApi, UploadDialog, UploadNewVersionDialog, UserModel, Utils, ViewerComponent, ViewerOverlayDialogComponent, cleanupRepositoryTestData, collaboratorDocToolbarMore, collaboratorEditRowToolbarMore, collaboratorLockCurrentUserToolbarMore, collaboratorLockOtherUserSearchToolbarMore, collaboratorLockOtherUserToolbarMore, collaboratorSharedToolbarPrimary, collaboratorToolbarPrimary, createSuiteProjects, errorStrings, favoritesCollaboratorToolbarMore, file, fileDocx, fileDocxFav, fileDocxShared, fileDocxSharedFav, fileFav, fileFavLocked, fileGranularPermission, fileLocked, fileLockedByUser, fileNotVersionable, fileShared, fileSharedFav, fileSharedFavLocked, fileSharedLocked, flattenNodeContentTree, folder, folderFav, folderFav2, folderFavFile, folderFile, getBrowserProjects, getExcludedTestsRegExpArray, getGlobalConfig, getUserState, libraryErrors, logger, multipleSel, multipleSelAllFav, multipleSelFile, paths, random$1 as random, seedRepositoryTestData, test, testEmailDomain, timeouts, users, waitForApi };
7840
+ export { APP_ROUTES, AcaHeader, ActionType, ActionTypes, ActionsDropdownComponent, AdfConfirmDialogComponent, AdfDeleteTrashComponent, AdfFolderDialogComponent, AdfInfoDrawerComponent, AdfLibraryDialogComponent, ApiClientFactory, BaseComponent, BasePage, Breadcrumb, CategoriesApi, Comparator, ConditionComponent, ConditionsTypes, ContentNodeSelectorDialog, CreateFromTemplateDialogComponent, DataTableComponent, DateTimePicker, EditDialog, EditModeComponent, ErrorComponent, FavoritesLibrariesPage, FavoritesPage, FavoritesPageApi, Field, FileActionsApi, FolderInformationDialogComponent, LinkRulesDialog, LoginPage, ManageRules, ManageRulesDialogComponent, ManageVersionsDialog, MatMenuComponent, MimeType, MyLibrariesPage, NodesApi, NodesPage, PaginationActionsType, PaginationComponent, PasswordOverlayDialogComponent, Person, PersonalFilesPage, QueriesApi, RecentFilesPage, RulesApi, RulesToolbarComponent, SIDEBAR_LABELS, SITE_ROLES, SITE_VISIBILITY, SearchApi, SearchFilters, SearchFiltersCategories, SearchFiltersDate, SearchFiltersLocation, SearchFiltersLogic, SearchFiltersProperties, SearchFiltersTags, SearchInputComponent, SearchMenuCard, SearchPage, SearchSortingPicker, ShareDialogComponent, SharedLinksApi, SharedPage, SidenavComponent, SitesApi, SnackBarComponent, TEST_FILES, TagsApi, TrashPage, TrashcanApi, UploadDialog, UploadNewVersionDialog, UserModel, Utils, ViewerComponent, ViewerOverlayDialogComponent, cleanupRepositoryTestData, collaboratorDocToolbarMore, collaboratorEditRowToolbarMore, collaboratorLockCurrentUserToolbarMore, collaboratorLockOtherUserSearchToolbarMore, collaboratorLockOtherUserToolbarMore, collaboratorSharedToolbarPrimary, collaboratorToolbarPrimary, createSuiteProjects, errorStrings, favoritesCollaboratorToolbarMore, file, fileDocx, fileDocxFav, fileDocxShared, fileDocxSharedFav, fileFav, fileFavLocked, fileGranularPermission, fileLocked, fileLockedByUser, fileNotVersionable, fileShared, fileSharedFav, fileSharedFavLocked, fileSharedLocked, flattenNodeContentTree, folder, folderFav, folderFav2, folderFavFile, folderFile, getBrowserProjects, getExcludedTestsRegExpArray, getGlobalConfig, getUserState, hasAccessibleAttribute, hasAccessibleName, isInteractiveElement, libraryErrors, logger, multipleSel, multipleSelAllFav, multipleSelFile, paths, random$1 as random, seedRepositoryTestData, test, testEmailDomain, timeouts, users, verifyDataTableAccessibility, verifyElementsHaveNames, verifyRegionAccessibleNames, waitForApi };
7742
7841
  //# sourceMappingURL=alfresco-aca-playwright-shared.mjs.map