diff --git a/.eslintrc.e2e.json b/.eslintrc.e2e.json new file mode 100644 index 000000000..d0ea874a3 --- /dev/null +++ b/.eslintrc.e2e.json @@ -0,0 +1,37 @@ +{ + "extends": ["plugin:playwright/playwright-test"], + "plugins": ["@alfresco/eslint-angular"], + "rules": { + "@typescript-eslint/no-floating-promises": "warn", + "@typescript-eslint/no-misused-promises": "warn", + "max-lines": "off", + "@alfresco/eslint-angular/no-angular-material-selectors": "error", + "no-empty-pattern": "off", + "playwright/expect-expect": "off", + "playwright/max-nested-describe": "off", + "playwright/missing-playwright-await": "error", + "playwright/no-conditional-expect": "off", + "playwright/no-conditional-in-test": "off", + "playwright/no-duplicate-hooks": "error", + "playwright/no-element-handle": "warn", + "playwright/no-eval": "warn", + "playwright/no-focused-test": "error", + "playwright/no-force-option": "warn", + "playwright/no-nested-step": "warn", + "playwright/no-networkidle": "warn", + "playwright/no-page-pause": "error", + "playwright/no-raw-locators": "warn", + "playwright/no-skipped-test": "error", + "playwright/no-standalone-expect": "error", + "playwright/no-unsafe-references": "warn", + "playwright/no-useless-await": "warn", + "playwright/no-useless-not": "warn", + "playwright/no-wait-for-selector": "warn", + "playwright/no-wait-for-timeout": "off", + "playwright/prefer-web-first-assertions": "off", + "playwright/valid-describe-callback": "warn", + "playwright/valid-expect": "warn", + "playwright/valid-expect-in-promise": "off", + "playwright/valid-title": "off" + } +} diff --git a/.eslintrc.json b/.eslintrc.json index 2b098d9e0..9ffa28776 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -323,7 +323,7 @@ } }, { - "files": ["*.spec.ts", "*.test.ts", "*.e2e.ts"], + "files": ["*.spec.ts"], "plugins": ["@alfresco/eslint-angular"], "rules": { "@typescript-eslint/no-floating-promises": "warn", @@ -332,39 +332,6 @@ "@alfresco/eslint-angular/no-angular-material-selectors": "error" } }, - { - "files": ["*.e2e.ts"], - "extends": ["plugin:playwright/playwright-test"], - "rules": { - "no-empty-pattern": "off", - "playwright/expect-expect": "off", - "playwright/max-nested-describe": "off", - "playwright/missing-playwright-await": "error", - "playwright/no-conditional-expect": "off", - "playwright/no-conditional-in-test": "off", - "playwright/no-duplicate-hooks": "error", - "playwright/no-element-handle": "warn", - "playwright/no-eval": "warn", - "playwright/no-focused-test": "error", - "playwright/no-force-option": "warn", - "playwright/no-nested-step": "warn", - "playwright/no-networkidle": "warn", - "playwright/no-page-pause": "error", - "playwright/no-raw-locators": "warn", - "playwright/no-skipped-test": "error", - "playwright/no-standalone-expect": "error", - "playwright/no-unsafe-references": "warn", - "playwright/no-useless-await": "warn", - "playwright/no-useless-not": "warn", - "playwright/no-wait-for-selector": "warn", - "playwright/no-wait-for-timeout": "off", - "playwright/prefer-web-first-assertions": "off", - "playwright/valid-describe-callback": "warn", - "playwright/valid-expect": "warn", - "playwright/valid-expect-in-promise": "off", - "playwright/valid-title": "off" - } - }, { "files": ["*.json"], "parser": "jsonc-eslint-parser", diff --git a/e2e/playwright/authentication/.eslintrc.json b/e2e/playwright/authentication/.eslintrc.json index 0e3d5cf2e..5c26789f7 100644 --- a/e2e/playwright/authentication/.eslintrc.json +++ b/e2e/playwright/authentication/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/authentication/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/copy-move-actions/.eslintrc.json b/e2e/playwright/copy-move-actions/.eslintrc.json index 4bb02c94e..f8ac8793f 100644 --- a/e2e/playwright/copy-move-actions/.eslintrc.json +++ b/e2e/playwright/copy-move-actions/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/copy-move-actions/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/create-actions/.eslintrc.json b/e2e/playwright/create-actions/.eslintrc.json index 34217df95..179776d67 100644 --- a/e2e/playwright/create-actions/.eslintrc.json +++ b/e2e/playwright/create-actions/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/create-actions/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/delete-actions/.eslintrc.json b/e2e/playwright/delete-actions/.eslintrc.json index 1777b0a6e..590fdb427 100644 --- a/e2e/playwright/delete-actions/.eslintrc.json +++ b/e2e/playwright/delete-actions/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/delete-actions/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/edit-actions/.eslintrc.json b/e2e/playwright/edit-actions/.eslintrc.json index 0e10e816d..41809091c 100644 --- a/e2e/playwright/edit-actions/.eslintrc.json +++ b/e2e/playwright/edit-actions/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/edit-actions/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/favorite-actions/.eslintrc.json b/e2e/playwright/favorite-actions/.eslintrc.json index 582353ca8..10e6a53f4 100644 --- a/e2e/playwright/favorite-actions/.eslintrc.json +++ b/e2e/playwright/favorite-actions/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/favorite-actions/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/folder-information-actions/.eslintrc.json b/e2e/playwright/folder-information-actions/.eslintrc.json index eaa4081d9..c64a806aa 100644 --- a/e2e/playwright/folder-information-actions/.eslintrc.json +++ b/e2e/playwright/folder-information-actions/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/folder-information-actions/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/folder-rules/.eslintrc.json b/e2e/playwright/folder-rules/.eslintrc.json index d241111e1..1c09477b1 100644 --- a/e2e/playwright/folder-rules/.eslintrc.json +++ b/e2e/playwright/folder-rules/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/folder-rules/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/folder-rules/src/tests/create-rules.e2e.ts b/e2e/playwright/folder-rules/src/tests/create-rules.e2e.ts index 69b3f0e5b..93aebdcc3 100644 --- a/e2e/playwright/folder-rules/src/tests/create-rules.e2e.ts +++ b/e2e/playwright/folder-rules/src/tests/create-rules.e2e.ts @@ -26,6 +26,7 @@ import { expect } from '@playwright/test'; import { ActionType, ApiClientFactory, test, Utils, TrashcanApi, NodesApi, Comparator, Field } from '@alfresco/aca-playwright-shared'; test.use({ launchOptions: { slowMo: 300 } }); + test.describe('Folder Rules Actions', () => { const apiClientFactory = new ApiClientFactory(); let nodesApi: NodesApi; diff --git a/e2e/playwright/folder-rules/src/tests/delete-view-rules.e2e.ts b/e2e/playwright/folder-rules/src/tests/delete-view-rules.e2e.ts index 3542682e6..4761c0f85 100644 --- a/e2e/playwright/folder-rules/src/tests/delete-view-rules.e2e.ts +++ b/e2e/playwright/folder-rules/src/tests/delete-view-rules.e2e.ts @@ -26,6 +26,7 @@ import { ApiClientFactory, test, Utils, NodesApi, TrashcanApi, RulesApi } from ' import { expect } from '@playwright/test'; test.use({ launchOptions: { slowMo: 300 } }); + test.describe('Rules - Manage Rules', () => { const apiClientFactory = new ApiClientFactory(); let nodesApi: NodesApi; diff --git a/e2e/playwright/folder-rules/src/tests/transform-rules.e2e.ts b/e2e/playwright/folder-rules/src/tests/transform-rules.e2e.ts index 7b11bc619..7723ff4a9 100644 --- a/e2e/playwright/folder-rules/src/tests/transform-rules.e2e.ts +++ b/e2e/playwright/folder-rules/src/tests/transform-rules.e2e.ts @@ -106,6 +106,7 @@ async function verifyTransformation( } test.use({ launchOptions: { slowMo: 300 } }); + test.describe('Folder Rules Actions', () => { const apiClientFactory = new ApiClientFactory(); let nodesApi: NodesApi; diff --git a/e2e/playwright/folder-rules/src/tests/update-rules.e2e.ts b/e2e/playwright/folder-rules/src/tests/update-rules.e2e.ts index ab36d7394..628d5af48 100644 --- a/e2e/playwright/folder-rules/src/tests/update-rules.e2e.ts +++ b/e2e/playwright/folder-rules/src/tests/update-rules.e2e.ts @@ -26,6 +26,7 @@ import { ApiClientFactory, test, Utils, NodesApi, TrashcanApi, ActionType, Rules import { expect } from '@playwright/test'; test.use({ launchOptions: { slowMo: 300 } }); + test.describe('Rules - Manage Rules', () => { const apiClientFactory = new ApiClientFactory(); let nodesApi: NodesApi; diff --git a/e2e/playwright/info-drawer/.eslintrc.json b/e2e/playwright/info-drawer/.eslintrc.json index 44e7bcef4..8129ac4f5 100644 --- a/e2e/playwright/info-drawer/.eslintrc.json +++ b/e2e/playwright/info-drawer/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/info-drawer/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/info-drawer/src/tests/library-properties.e2e.ts b/e2e/playwright/info-drawer/src/tests/library-properties.e2e.ts index 47477fcb5..8893a29df 100644 --- a/e2e/playwright/info-drawer/src/tests/library-properties.e2e.ts +++ b/e2e/playwright/info-drawer/src/tests/library-properties.e2e.ts @@ -195,8 +195,8 @@ test.describe('Library properties', () => { await myLibrariesPage.libraryDetails.editButton.click(); await myLibrariesPage.libraryDetails.nameField.fill(Utils.string257Long); - await expect(myLibrariesPage.libraryDetails.errorMessage).toBeVisible(); - expect((await myLibrariesPage.libraryDetails.errorMessage.textContent()).trim()).toEqual('Use 256 characters or less for title'); + await expect(myLibrariesPage.libraryDetails.errorNameMessage).toBeVisible(); + expect((await myLibrariesPage.libraryDetails.errorNameMessage.textContent()).trim()).toEqual('Use 256 characters or less for title'); await expect(myLibrariesPage.libraryDetails.updateButton).toBeDisabled(); }); @@ -210,8 +210,8 @@ test.describe('Library properties', () => { await myLibrariesPage.libraryDetails.editButton.click(); await myLibrariesPage.libraryDetails.descriptionField.fill(Utils.string513Long); - await expect(myLibrariesPage.libraryDetails.errorMessage).toBeVisible(); - expect((await myLibrariesPage.libraryDetails.errorMessage.textContent()).trim()).toEqual('Use 512 characters or less for description'); + await expect(myLibrariesPage.libraryDetails.errorDescriptionMessage).toBeVisible(); + expect((await myLibrariesPage.libraryDetails.errorDescriptionMessage.textContent()).trim()).toEqual('Use 512 characters or less for description'); await expect(myLibrariesPage.libraryDetails.updateButton).toBeDisabled(); }); }); diff --git a/e2e/playwright/library-actions/.eslintrc.json b/e2e/playwright/library-actions/.eslintrc.json index fd40996c4..ca8f69dc5 100644 --- a/e2e/playwright/library-actions/.eslintrc.json +++ b/e2e/playwright/library-actions/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/library-actions/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/list-views/.eslintrc.json b/e2e/playwright/list-views/.eslintrc.json index 9e1357d87..4634e5b29 100644 --- a/e2e/playwright/list-views/.eslintrc.json +++ b/e2e/playwright/list-views/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/list-views/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/list-views/src/tests/permissions.e2e.ts b/e2e/playwright/list-views/src/tests/permissions.e2e.ts index b18e15403..01569fd36 100755 --- a/e2e/playwright/list-views/src/tests/permissions.e2e.ts +++ b/e2e/playwright/list-views/src/tests/permissions.e2e.ts @@ -40,6 +40,7 @@ import { Site } from '@alfresco/js-api'; test.describe('Special permissions', () => { const username = `userPermissions-${Utils.random()}`; let siteApiAdmin: SitesApi; + test.beforeAll(async () => { const apiClientFactory = new ApiClientFactory(); await apiClientFactory.setUpAcaBackend('admin'); diff --git a/e2e/playwright/list-views/src/tests/sort-list.e2e.ts b/e2e/playwright/list-views/src/tests/sort-list.e2e.ts index f534747ff..b72951642 100644 --- a/e2e/playwright/list-views/src/tests/sort-list.e2e.ts +++ b/e2e/playwright/list-views/src/tests/sort-list.e2e.ts @@ -240,6 +240,7 @@ test.describe('Remember sorting', () => { test.describe('User Tests', () => { test.describe.configure({ mode: 'serial' }); + test('[XAT-4520] Size sort order is retained when user logs out and logs back in', async ({ personalFiles, loginPage }) => { await personalFiles.dataTable.sortBy('Name', 'desc'); await personalFiles.dataTable.spinnerWaitForReload(); diff --git a/e2e/playwright/navigation/.eslintrc.json b/e2e/playwright/navigation/.eslintrc.json index 48ca1a8b0..c0ba3c95f 100644 --- a/e2e/playwright/navigation/.eslintrc.json +++ b/e2e/playwright/navigation/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/navigation/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/pagination/.eslintrc.json b/e2e/playwright/pagination/.eslintrc.json index 9bacf995f..beeeb6753 100644 --- a/e2e/playwright/pagination/.eslintrc.json +++ b/e2e/playwright/pagination/.eslintrc.json @@ -4,11 +4,10 @@ "overrides": [ { "files": ["*.ts"], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { - "project": ["e2e/playwright/pagination/tsconfig.e2e.json"], - "createDefaultProgram": true + "project": ["e2e/playwright/pagination/tsconfig.e2e.json"] }, - "plugins": ["rxjs", "unicorn"], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/pagination/src/tests/multiple-pages-files.e2e.ts b/e2e/playwright/pagination/src/tests/multiple-pages-files.e2e.ts index 45628c7f1..35f9da4f2 100755 --- a/e2e/playwright/pagination/src/tests/multiple-pages-files.e2e.ts +++ b/e2e/playwright/pagination/src/tests/multiple-pages-files.e2e.ts @@ -68,6 +68,7 @@ test.describe('Pagination on multiple pages : ', () => { test.beforeAll(async () => { await favoritesApi.waitForApi(username, { expect: initialFavoritesTotalItems + 51 }); }); + favoritesTests(username); }); }); diff --git a/e2e/playwright/search/.eslintrc.json b/e2e/playwright/search/.eslintrc.json index 44c4872a8..fdfccc30f 100644 --- a/e2e/playwright/search/.eslintrc.json +++ b/e2e/playwright/search/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/search/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/search/src/tests/search-filters-date.e2e.ts b/e2e/playwright/search/src/tests/search-filters-date.e2e.ts index 6afa6394c..b37044741 100644 --- a/e2e/playwright/search/src/tests/search-filters-date.e2e.ts +++ b/e2e/playwright/search/src/tests/search-filters-date.e2e.ts @@ -26,6 +26,7 @@ import { expect } from '@playwright/test'; import { ApiClientFactory, Utils, test, NodesApi, TrashcanApi, FileActionsApi, TEST_FILES } from '@alfresco/aca-playwright-shared'; test.use({ launchOptions: { slowMo: 500 } }); + test.describe('Search - Filters - Date', () => { let nodesApi: NodesApi; let trashcanApi: TrashcanApi; diff --git a/e2e/playwright/search/src/tests/search-highlighting.e2e.ts b/e2e/playwright/search/src/tests/search-highlighting.e2e.ts index 653effcd6..f71136661 100644 --- a/e2e/playwright/search/src/tests/search-highlighting.e2e.ts +++ b/e2e/playwright/search/src/tests/search-highlighting.e2e.ts @@ -26,6 +26,7 @@ import { expect } from '@playwright/test'; import { ApiClientFactory, Utils, test, NodesApi, TrashcanApi, TEST_FILES, FileActionsApi } from '@alfresco/aca-playwright-shared'; test.use({ launchOptions: { slowMo: 500 } }); + test.describe('Search Highlighting', () => { let nodesApi: NodesApi; let trashcanApi: TrashcanApi; diff --git a/e2e/playwright/search/src/tests/search-sorting.e2e.ts b/e2e/playwright/search/src/tests/search-sorting.e2e.ts index 1d7cc4b30..e7727a153 100644 --- a/e2e/playwright/search/src/tests/search-sorting.e2e.ts +++ b/e2e/playwright/search/src/tests/search-sorting.e2e.ts @@ -37,6 +37,7 @@ import { } from '@alfresco/aca-playwright-shared'; test.use({ launchOptions: { slowMo: 500 } }); + test.describe('Search sorting', () => { const random = Utils.random(); diff --git a/e2e/playwright/share-action/.eslintrc.json b/e2e/playwright/share-action/.eslintrc.json index 48440bfc3..572212d2f 100644 --- a/e2e/playwright/share-action/.eslintrc.json +++ b/e2e/playwright/share-action/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/share-action/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/share-action/src/tests/share/share-file.e2e.ts b/e2e/playwright/share-action/src/tests/share/share-file.e2e.ts index 9ad2bdb6d..176820de5 100644 --- a/e2e/playwright/share-action/src/tests/share/share-file.e2e.ts +++ b/e2e/playwright/share-action/src/tests/share/share-file.e2e.ts @@ -182,6 +182,10 @@ test.describe('Share a file', () => { await personalFiles.shareDialog.expireToggle.click(); expect(await personalFiles.shareDialog.isExpireToggleEnabled()).toBe(true); + await personalFiles.shareDialog.expireInput.click(); + await personalFiles.shareDialog.clockIcon.click(); + await expect(personalFiles.shareDialog.dateErrorText).toContainText('Invalid date'); + await personalFiles.shareDialog.datetimePickerButton.click(); expect(await personalFiles.shareDialog.dateTimePicker.isCalendarOpen()).toBe(true); diff --git a/e2e/playwright/smoke-test/.eslintrc.json b/e2e/playwright/smoke-test/.eslintrc.json index bd35b2f90..755ae6f6d 100644 --- a/e2e/playwright/smoke-test/.eslintrc.json +++ b/e2e/playwright/smoke-test/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/smoke-test/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/special-permissions-actions-available/.eslintrc.json b/e2e/playwright/special-permissions-actions-available/.eslintrc.json index c72703a55..8c846d923 100644 --- a/e2e/playwright/special-permissions-actions-available/.eslintrc.json +++ b/e2e/playwright/special-permissions-actions-available/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/special-permissions-actions-available/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/folders-actions.e2e.ts b/e2e/playwright/special-permissions-actions-available/src/tests/folders-actions.e2e.ts index 22f4ad202..f298cf813 100644 --- a/e2e/playwright/special-permissions-actions-available/src/tests/folders-actions.e2e.ts +++ b/e2e/playwright/special-permissions-actions-available/src/tests/folders-actions.e2e.ts @@ -32,18 +32,6 @@ test.describe('Folders - available actions : ', () => { let trashcanApi: TrashcanApi; async function checkActionsAvailable( - myPersonalFiles: PersonalFilesPage, - item: string, - expectedToolbarPrimary: string[], - expectedToolbarMore: string[] - ): Promise { - await myPersonalFiles.dataTable.selectItems(item); - await myPersonalFiles.acaHeader.verifyToolbarPrimaryActions(expectedToolbarPrimary); - await myPersonalFiles.acaHeader.clickMoreActions(); - await myPersonalFiles.matMenu.verifyActualMoreActions(expectedToolbarMore); - } - - async function checkMultipleSelActionsAvailable( myPersonalFiles: PersonalFilesPage, expectedToolbarPrimary: string[], expectedToolbarMore: string[] @@ -84,18 +72,13 @@ test.describe('Folders - available actions : ', () => { test('[XAT-4637] Actions for a folder, not favorite', async ({ personalFiles }) => { await personalFiles.dataTable.getRowByName(testData.folderFile.name).click({ button: 'right' }); await personalFiles.matMenu.verifyActualMoreActions(testData.folderFile.contextMenu); - await checkActionsAvailable(personalFiles, testData.folderFile.name, testData.folderFile.toolbarPrimary, testData.folderFile.toolbarMore); + await checkActionsAvailable(personalFiles, testData.folderFile.toolbarPrimary, testData.folderFile.toolbarMore); }); test('[XAT-4638] Actions for a folder, favorite', async ({ personalFiles }) => { await personalFiles.dataTable.getRowByName(testData.folderFavFile.name).click({ button: 'right' }); await personalFiles.matMenu.verifyActualMoreActions(testData.folderFavFile.contextMenu); - await checkActionsAvailable( - personalFiles, - testData.folderFavFile.name, - testData.folderFavFile.toolbarPrimary, - testData.folderFavFile.toolbarMore - ); + await checkActionsAvailable(personalFiles, testData.folderFavFile.toolbarPrimary, testData.folderFavFile.toolbarMore); }); test('[XAT-4642] Actions on multiple folders', async ({ personalFiles }) => { @@ -103,14 +86,14 @@ test.describe('Folders - available actions : ', () => { await personalFiles.dataTable.getRowByName(testData.folderFavFile.name).click({ button: 'right' }); await personalFiles.page.reload({ waitUntil: 'load' }); await personalFiles.dataTable.selectItems(testData.folderFavFile.name, testData.folderFile.name); - await checkMultipleSelActionsAvailable(personalFiles, testData.multipleSelFile.toolbarPrimary, testData.multipleSelFile.toolbarMore); + await checkActionsAvailable(personalFiles, testData.multipleSelFile.toolbarPrimary, testData.multipleSelFile.toolbarMore); }); test('[XAT-4643] Actions on multiple selection - files and folders', async ({ personalFiles }) => { await personalFiles.dataTable.selectItems(testData.file.name, testData.folderFile.name); await personalFiles.dataTable.getRowByName(testData.folderFile.name).click({ button: 'right' }); await personalFiles.matMenu.verifyActualMoreActions(testData.multipleSelFile.contextMenu); - await checkMultipleSelActionsAvailable(personalFiles, testData.multipleSelFile.toolbarPrimary, testData.multipleSelFile.toolbarMore); + await checkActionsAvailable(personalFiles, testData.multipleSelFile.toolbarPrimary, testData.multipleSelFile.toolbarMore); }); }); }); diff --git a/e2e/playwright/upload-download-actions/.eslintrc.json b/e2e/playwright/upload-download-actions/.eslintrc.json index 597571811..4ecf24173 100644 --- a/e2e/playwright/upload-download-actions/.eslintrc.json +++ b/e2e/playwright/upload-download-actions/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/upload-download-actions/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/viewer/.eslintrc.json b/e2e/playwright/viewer/.eslintrc.json index 20cbee6e3..fe30e94c2 100644 --- a/e2e/playwright/viewer/.eslintrc.json +++ b/e2e/playwright/viewer/.eslintrc.json @@ -8,16 +8,12 @@ "files": [ "*.ts" ], + "extends": ["../../../.eslintrc.e2e.json"], "parserOptions": { "project": [ "e2e/playwright/viewer/tsconfig.e2e.json" - ], - "createDefaultProgram": true + ] }, - "plugins": [ - "rxjs", - "unicorn" - ], "rules": { "@typescript-eslint/no-floating-promises": "off" } diff --git a/e2e/playwright/viewer/src/tests/viewer-action.e2e.ts b/e2e/playwright/viewer/src/tests/viewer-action.e2e.ts index 6aa188ea0..cea76d5a6 100644 --- a/e2e/playwright/viewer/src/tests/viewer-action.e2e.ts +++ b/e2e/playwright/viewer/src/tests/viewer-action.e2e.ts @@ -26,6 +26,7 @@ import { expect } from '@playwright/test'; import { ApiClientFactory, getUserState, test, TEST_FILES, timeouts, Utils } from '@alfresco/aca-playwright-shared'; test.use({ storageState: getUserState('hruser') }); + test.describe('viewer action file', () => { const apiClientFactory = new ApiClientFactory(); const randomFolderName = `viewer-action-${Utils.random()}`; diff --git a/e2e/playwright/viewer/src/tests/viewer-file-types.e2e.ts b/e2e/playwright/viewer/src/tests/viewer-file-types.e2e.ts index 1889faba5..cd1fbbe8f 100644 --- a/e2e/playwright/viewer/src/tests/viewer-file-types.e2e.ts +++ b/e2e/playwright/viewer/src/tests/viewer-file-types.e2e.ts @@ -36,6 +36,7 @@ import { } from '@alfresco/aca-playwright-shared'; test.use({ channel: 'chrome' }); + test.describe('viewer file types', () => { const randomString = Utils.random(); const username = `user-${randomString}`; diff --git a/e2e/playwright/viewer/src/tests/viewer-protected.e2e.ts b/e2e/playwright/viewer/src/tests/viewer-protected.e2e.ts index cfb7d8211..24b4133ad 100644 --- a/e2e/playwright/viewer/src/tests/viewer-protected.e2e.ts +++ b/e2e/playwright/viewer/src/tests/viewer-protected.e2e.ts @@ -26,6 +26,7 @@ import { expect } from '@playwright/test'; import { ApiClientFactory, getUserState, test, TEST_FILES, Utils } from '@alfresco/aca-playwright-shared'; test.use({ storageState: getUserState('hruser') }); + test.describe('viewer file', () => { const apiClientFactory = new ApiClientFactory(); const randomFolderName = `viewer-protected-${Utils.random()}`; diff --git a/projects/aca-content/src/lib/components/info-drawer/library-metadata-tab/library-metadata-form.component.html b/projects/aca-content/src/lib/components/info-drawer/library-metadata-tab/library-metadata-form.component.html index 3d1ec3b5a..8bd5f71e4 100644 --- a/projects/aca-content/src/lib/components/info-drawer/library-metadata-tab/library-metadata-form.component.html +++ b/projects/aca-content/src/lib/components/info-drawer/library-metadata-tab/library-metadata-form.component.html @@ -14,9 +14,9 @@ [errorStateMatcher]="matcher" /> @if (libraryTitleExists) { - {{ 'LIBRARY.HINTS.SITE_TITLE_EXISTS' | translate }} + {{ 'LIBRARY.HINTS.SITE_TITLE_EXISTS' | translate }} } - + {{ titleErrorTranslationKey | translate }} diff --git a/projects/aca-playwright-shared/.eslintrc.js b/projects/aca-playwright-shared/.eslintrc.js index 3ada66a23..9eda41454 100644 --- a/projects/aca-playwright-shared/.eslintrc.js +++ b/projects/aca-playwright-shared/.eslintrc.js @@ -1,6 +1,6 @@ const path = require('path'); module.exports = { - extends: '../../.eslintrc.json', + extends: ['../../.eslintrc.json', '../../.eslintrc.e2e.json'], ignorePatterns: ['!**/*'], overrides: [ { @@ -10,7 +10,15 @@ module.exports = { createDefaultProgram: true }, rules: { - 'no-console': ['error', {'allow': ['info', 'log', 'warn', 'error'] }] + 'no-console': ['error', {'allow': ['info', 'log', 'warn', 'error'] }], + 'playwright/no-raw-locators': 'off' + } + }, + { + files: ['*.js'], + rules: { + '@typescript-eslint/no-floating-promises': 'off', + '@typescript-eslint/no-misused-promises': 'off' } } ] diff --git a/projects/aca-playwright-shared/src/page-objects/components/actions-dropdown.component.ts b/projects/aca-playwright-shared/src/page-objects/components/actions-dropdown.component.ts index 13dc4c08d..b6fe9289a 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/actions-dropdown.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/actions-dropdown.component.ts @@ -62,21 +62,19 @@ export enum MimeType { export class ActionsDropdownComponent extends BaseComponent { private static rootElement = 'aca-edit-rule-dialog aca-rule-action-list'; - private getOptionLocator = (optionName: string): Locator => - this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-text', { hasText: optionName }).first(); + private getOptionLocator = (optionName: string): Locator => this.page.locator('[role=listbox] [role=option]', { hasText: optionName }).first(); private ruleActionLocator = this.getChild('aca-rule-action'); private addActionButtonLocator = this.getChild('[data-automation-id="rule-action-list-add-action-button"]'); private actionDropdownLocator = this.getChild('[data-automation-id="rule-action-select"]'); private actionAspectNameLocator = '[data-automation-id="header-aspect-name"] .adf-property-field'; private actionCheckInInputLocator = '[data-automation-id="header-description"] input'; - private actionAutoDeclareLocator = '[data-automation-id="header-version"] mat-select'; - private actionSpecialiseTypeLocator = '[data-automation-id="header-type-name"] mat-select'; private actionSimpleWorkflowStepInputLocator = '[data-automation-id="header-approve-step"] input'; - private actionSimpleWorkflowApproveFolderLocator = `[data-automation-id="header-approve-folder"] mat-icon`; private actionSimpleWorkflowActionChoiceLocator = '[data-automation-id="content-node-selector-actions-choose"]'; private actionSimpleWorkflowLabelApproveLocator = `[data-automation-id="card-boolean-label-approve-move"]`; private actionSimpleWorkflowSRejectStepLocator = '[data-automation-id="header-reject-step"] input'; private actionSimpleWorkflowRejectFolderLocator = `[data-automation-id="header-reject-folder"] input`; + private readonly actionSimpleWorkflowApproveFolderLocator = `[data-automation-id="header-approve-folder"] [role="img"]`; + private readonly actionSpecialiseTypeLocator = '[data-automation-id="header-type-name"] [role="combobox"]'; private readonly mimeTypeDropdownLocator = this.getChild('[data-automation-id="select-box"][aria-label="Mimetype *"]'); private readonly actionTransformAndCopyContentDestinationFolderLocator = '[data-automation-id="card-textitem-value-destination-folder"]'; private readonly contentNodeSelectorSearchInput = '[data-automation-id="content-node-selector-search-input"]'; @@ -108,10 +106,6 @@ export class ActionsDropdownComponent extends BaseComponent { await this.dropdownSelection(AspectValue, this.actionAspectNameLocator, index); } - async insertAutoDeclareOptionsActionValues(autoDeclareOptionsValue: string, index: number): Promise { - await this.dropdownSelection(autoDeclareOptionsValue, this.actionAutoDeclareLocator, index); - } - async insertSpecialiseTypeActionValues(specialiseTypeValue: string, index: number): Promise { await this.dropdownSelection(specialiseTypeValue, this.actionSpecialiseTypeLocator, index); } diff --git a/projects/aca-playwright-shared/src/page-objects/components/adf-info-drawer.component.ts b/projects/aca-playwright-shared/src/page-objects/components/adf-info-drawer.component.ts index 62713eaab..d8a1ff58b 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/adf-info-drawer.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/adf-info-drawer.component.ts @@ -39,7 +39,7 @@ export class AdfInfoDrawerComponent extends BaseComponent { this.getChild(`[data-automation-id="library-name-properties-wrapper"] input[placeholder='${labelText}']`); public getIdField = (labelText: string) => this.getChild(`[data-automation-id="library-id-properties-wrapper"] input[placeholder='${labelText}']`); public getVisibilityField = (labelText: string) => - this.getChild(`[data-automation-id="library-visibility-properties-wrapper"] mat-select[ng-reflect-placeholder='${labelText}']`); + this.getChild(`[data-automation-id="library-visibility-properties-wrapper"] [role="combobox"][ng-reflect-placeholder='${labelText}']`); public getDescriptionField = this.getChild('[data-automation-id="library-description-properties-wrapper"] textarea'); public propertiesTab = this.page.getByRole('tab', { name: 'Properties' }); public commentsTab = this.page.getByRole('tab', { name: 'Comments' }); @@ -56,10 +56,11 @@ export class AdfInfoDrawerComponent extends BaseComponent { public editButton = this.page.getByRole('button', { name: 'Edit' }); public cancelButton = this.page.getByRole('button', { name: 'Cancel' }); public updateButton = this.page.getByRole('button', { name: 'Update' }); - public hintMessage = this.page.locator('mat-hint'); - public errorMessage = this.page.locator('mat-error'); + public hintMessage = this.getChild('[data-automation-id="app-library-metadata-form-name-hint"]'); + public errorNameMessage = this.getChild('[data-automation-id="library-name-properties-wrapper"] [aria-atomic="true"]'); + public errorDescriptionMessage = this.getChild('[data-automation-id="library-description-properties-wrapper"] [aria-atomic="true"]'); public expandDetailsButton = this.getChild(`button[title='Expand panel']`); - public expandedDetailsTabs = this.page.locator('.aca-details-container .mdc-tab__text-label'); + public expandedDetailsTabs = this.page.locator('.aca-details-container [role="tab"]'); public expandedDetailsPermissionsTab = this.expandedDetailsTabs.getByText('Permissions'); public nameField = this.page.locator('input[placeholder=Name]'); public idField = this.page.locator(`input[placeholder='Library ID']`); @@ -72,7 +73,7 @@ export class AdfInfoDrawerComponent extends BaseComponent { public categoriesAccordionPenButton = this.categoriesAccordion.locator('[data-automation-id="meta-data-categories-edit"]'); public tagsInput = this.tagsCreator.locator('input'); public createTagButton = this.tagsCreator.locator('.adf-create-tag-label'); - public tagsChips = this.tagsCreator.locator('mat-chip'); + public tagsChips = this.tagsCreator.locator('[role="listitem"]'); public tagsChipsXButton = this.tagsChips.locator('.adf-dynamic-chip-list-delete-icon'); public tagsAccordionCancelButton = this.getChild('[data-automation-id="reset-tags-metadata"]'); public tagsAccordionConfirmButton = this.getChild('[data-automation-id="save-tags-metadata"]'); diff --git a/projects/aca-playwright-shared/src/page-objects/components/base.component.ts b/projects/aca-playwright-shared/src/page-objects/components/base.component.ts index 2d7403e59..47497387c 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/base.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/base.component.ts @@ -29,7 +29,7 @@ import { timeouts } from '../../utils'; export abstract class BaseComponent extends PlaywrightBase { private readonly rootElement: string; private overlayElement = this.page.locator('.cdk-overlay-backdrop-showing'); - private progressBar = this.page.locator('mat-progress-bar'); + private progressBar = this.page.locator('[role="progressbar"]'); protected constructor(page: Page, rootElement: string) { super(page); @@ -57,8 +57,8 @@ export abstract class BaseComponent extends PlaywrightBase { async spinnerWaitForReload(): Promise { try { - await this.page.locator('mat-progress-spinner').waitFor({ state: 'attached', timeout: timeouts.medium }); - await this.page.locator('mat-progress-spinner').waitFor({ state: 'detached', timeout: timeouts.normal }); + await this.page.locator('[role="progressbar"]').waitFor({ state: 'attached', timeout: timeouts.medium }); + await this.page.locator('[role="progressbar"]').waitFor({ state: 'detached', timeout: timeouts.normal }); } catch (e) { this.logger.info('Spinner was not present'); } diff --git a/projects/aca-playwright-shared/src/page-objects/components/conditions.component.ts b/projects/aca-playwright-shared/src/page-objects/components/conditions.component.ts index 4362d2e58..5ef57e62d 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/conditions.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/conditions.component.ts @@ -43,7 +43,7 @@ export enum Comparator { } export class ConditionComponent extends ManageRulesDialogComponent { - private getOptionLocator = (optionName: string): Locator => this.page.locator(`.cdk-overlay-pane .mat-mdc-option span`, { hasText: optionName }); + private getOptionLocator = (optionName: string): Locator => this.page.locator('[role=listbox] [role=option]', { hasText: optionName }).first(); private async selectField(fields: Partial, index: number): Promise { await this.fieldDropDown.nth(index).click(); diff --git a/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts index 3dbe2a516..eb2a81a60 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts @@ -56,8 +56,6 @@ export class DataTableComponent extends BaseComponent { sitesName = this.page.locator('.adf-datatable-body [data-automation-id*="datatable-row"] [aria-label="Name"]'); sitesRole = this.page.locator('.adf-datatable-body [data-automation-id*="datatable-row"] [aria-label="My Role"]'); lockOwner = this.page.locator('.aca-locked-by--name'); - uncheckedCheckbox = this.page.locator('.mat-mdc-checkbox'); - checkedCheckbox = this.page.locator('.mat-mdc-checkbox-checked'); highlightedText = '.aca-highlight'; searchFileName = '.search-file-name'; searchFileDescription = '[data-automation-id="search-results-entry-description"]'; @@ -107,14 +105,6 @@ export class DataTableComponent extends BaseComponent { */ getByAriaLabelTitle = (title: string): Locator => this.getChild(`[aria-label="${title}"]`); - /** - * Method used in cases where we want to get the button (hamburger menu) for row element - * - * @returns reference to menu placed in row localized by the name - */ - getActionsButtonByName = (name: string): Locator => - this.getRowByName(name).locator('mat-icon', { hasText: new RegExp(`^\\s*more_vert\\s*$`, 'g') }); - /** * Method used in cases where we want to get the edit button and there is no hamburger menu * @@ -142,7 +132,7 @@ export class DataTableComponent extends BaseComponent { * * @returns reference to checkbox placed in row localized by the name */ - getCheckboxForElement = (item: string): Locator => this.getRowByName(item).locator('.mat-mdc-checkbox'); + getCheckboxForElement = (item: string): Locator => this.getRowByName(item).locator('[type="checkbox"]'); getColumnHeaderByTitleLocator = (headerTitle: string): Locator => this.getChild('[role="columnheader"]', { hasText: headerTitle }); @@ -179,22 +169,6 @@ export class DataTableComponent extends BaseComponent { await this.spinnerWaitForReload(); } - /** - * Click action from the expandable kebab menu for the element in datatable - * - * @param name title of the record you would like to proceed - * @param action provide button title for the action - * @param subAction if the action is in sub menu, then provide it here - */ - async performActionForElement(name: string, action: string, subAction?: string): Promise { - await this.getActionsButtonByName(name).click(); - await this.contextMenuActions.getButtonByText(action).click(); - - if (subAction) { - await this.contextMenuActions.getButtonByText(subAction).click(); - } - } - /** * This method is used when we want to perform double click on the dataTable row to open a file or folder * @@ -251,15 +225,17 @@ export class DataTableComponent extends BaseComponent { if (!isSelected) { const row = this.getRowByName(name); await row.hover(); - await row.locator(this.uncheckedCheckbox).click(); - await row.locator(this.checkedCheckbox).waitFor({ state: 'visible', timeout: timeouts.large }); + if (!(await this.getCheckboxForElement(name).isChecked())) { + await this.getCheckboxForElement(name).click(); + } } } } async isRowSelected(itemName: string): Promise { const row = this.getRowByName(itemName); - return row.locator(this.checkedCheckbox).isVisible(); + await row.hover(); + return this.getCheckboxForElement(itemName).isChecked(); } async getColumnHeaders(): Promise> { diff --git a/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts index d83c1570c..d153fa189 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts @@ -26,7 +26,7 @@ import { expect, Page } from '@playwright/test'; import { BaseComponent } from '../base.component'; export class MatMenuComponent extends BaseComponent { - private static rootElement = '.mat-mdc-menu-content'; + private static rootElement = '[role="menu"]'; constructor(page: Page) { super(page, MatMenuComponent.rootElement); @@ -60,11 +60,11 @@ export class MatMenuComponent extends BaseComponent { } async verifyActualMoreActions(expectedToolbarMore: string[]): Promise { - await this.page.locator('.mat-mdc-menu-content').waitFor({ state: 'attached' }); - const menus = await this.page.$$('.mat-mdc-menu-content .mat-mdc-menu-item'); + await this.getChild('').waitFor(); + const menus = await this.getChild('[role="menuitem"]').all(); const actualMoreActions: string[] = await Promise.all( menus.map(async (button) => { - const title = await (await button.$('.mat-mdc-menu-item-text span')).innerText(); + const title = await button.locator('span span').innerText(); return title || ''; }) ); diff --git a/projects/aca-playwright-shared/src/page-objects/components/datetime-picker/datetime-picker.component.ts b/projects/aca-playwright-shared/src/page-objects/components/datetime-picker/datetime-picker.component.ts index b7201a8a8..69fb465a9 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/datetime-picker/datetime-picker.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/datetime-picker/datetime-picker.component.ts @@ -26,18 +26,16 @@ import { Page } from '@playwright/test'; import { BaseComponent } from '../base.component'; export class DateTimePicker extends BaseComponent { - private static rootElement = '.mat-calendar'; - calendar = this.getChild('.mat-datepicker-popup'); - dayPicker = this.getChild('mat-month-view'); - nextMonthBtn = this.getChild('.mat-calendar-next-button'); - rootElemLocator = this.page.locator('.mat-datepicker-popup'); + private static rootElement = '[role="dialog"]'; + dayPicker = this.getChild('[role="grid"]'); + nextMonthBtn = this.getChild('[aria-label="Next month"]'); constructor(page: Page) { super(page, DateTimePicker.rootElement); } async isCalendarOpen(): Promise { - const element = this.rootElemLocator; + const element = this.getChild(''); return element.isVisible(); } diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-folder-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-folder-dialog.component.ts index 625582e9e..8c53dc9b9 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-folder-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-folder-dialog.component.ts @@ -29,7 +29,7 @@ export class AdfFolderDialogComponent extends BaseComponent { private static rootElement = 'adf-folder-dialog'; public folderNameInputLocator = this.getChild('[id="adf-folder-name-input"]'); - public folderNameInputHint = this.getChild('mat-hint'); + public folderNameInputHint = this.getChild('[aria-atomic="true"] span'); public folderTitleInput = this.getChild('[id="adf-folder-title-input"]'); public folderDescriptionInput = this.getChild('[id="adf-folder-description-input"]'); public createButton = this.getChild('[id="adf-folder-create-button"]'); @@ -40,7 +40,7 @@ export class AdfFolderDialogComponent extends BaseComponent { } public getLabelText = (text: string) => this.getChild('label', { hasText: text }); - public getRequiredMarker = (text: string) => this.getLabelText(text).locator('.mat-mdc-form-field-required-marker'); + public getRequiredMarker = (text: string) => this.getLabelText(text).locator('span'); /** * This method is used when we want to fill in Create new Folder Dialog and choose Create button diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-library-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-library-dialog.component.ts index 0635716bf..b41f76eaf 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-library-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-library-dialog.component.ts @@ -37,9 +37,9 @@ export class AdfLibraryDialogComponent extends BaseComponent { } public getLabelText = (text: string) => this.getChild('label', { hasText: text }); - public getRequiredMarker = (text: string) => this.getLabelText(text).locator('.mat-mdc-form-field-required-marker'); - public getDialogTitle = (text: string) => this.getChild('.mat-mdc-dialog-title', { hasText: text }); - public getErrorByText = (text: string): Locator => this.page.locator('mat-error', { hasText: text }); + public getRequiredMarker = (text: string) => this.getLabelText(text).locator('span'); + public getDialogTitle = (text: string) => this.getChild('h2', { hasText: text }); + public getErrorByText = (text: string): Locator => this.getChild('.adf-library-dialog-form-field').getByText(text); /** * This method is used when we want to fill in Create Library Dialog and choose Create button diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/content-node-selector-dialog.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/content-node-selector-dialog.ts index d4df7d7a6..bd5d7def4 100755 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/content-node-selector-dialog.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/content-node-selector-dialog.ts @@ -27,23 +27,23 @@ import { BaseComponent } from '../base.component'; export class ContentNodeSelectorDialog extends BaseComponent { private static rootElement = 'adf-content-node-selector'; - - constructor(page: Page) { - super(page, ContentNodeSelectorDialog.rootElement); - } + private selectedRow = this.getChild('.adf-is-selected'); + private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() }); public cancelButton = this.getChild('[data-automation-id="content-node-selector-actions-cancel"]'); public actionButton = this.getChild('[data-automation-id="content-node-selector-actions-choose"]'); - public locationDropDown = this.getChild('[id="site-dropdown-container"] mat-form-field'); - private selectedRow = this.getChild('.adf-is-selected'); - getOptionLocator = (optionName: string): Locator => - this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-text', { hasText: optionName }); - private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() }); + public locationDropDown = this.getChild('[id="site-dropdown-container"] .adf-sites-dropdown-form-field'); + + getOptionLocator = (optionName: string): Locator => this.page.locator('[role=listbox] [role=option]', { hasText: optionName }).first(); getDialogTitle = (text: string) => this.getChild('[data-automation-id="content-node-selector-title"]', { hasText: text }); getBreadcrumb = (text: string) => this.getChild('[data-automation-id="current-folder"]', { hasText: text }); getFolderIcon = this.getChild('[data-automation-id="dropdown-breadcrumb-trigger"]'); loadMoreButton = this.getChild('[data-automation-id="adf-infinite-pagination-button"]'); + constructor(page: Page) { + super(page, ContentNodeSelectorDialog.rootElement); + } + async loadMoreNodes(): Promise { await this.spinnerWaitForReload(); while (await this.loadMoreButton.isVisible()) { diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/create-from-template-dialog-component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/create-from-template-dialog-component.ts index 3c3babdd6..161120075 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/create-from-template-dialog-component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/create-from-template-dialog-component.ts @@ -27,7 +27,7 @@ import { BaseComponent } from '../base.component'; import { timeouts } from '../../../utils'; export class CreateFromTemplateDialogComponent extends BaseComponent { - private static rootElement = 'mat-dialog-container'; + private static rootElement = '.aca-create-from-template-dialog'; constructor(page: Page) { super(page, CreateFromTemplateDialogComponent.rootElement); diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/edit-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/edit-dialog.component.ts index 457d486b0..3bd29dcea 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/edit-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/edit-dialog.component.ts @@ -26,7 +26,7 @@ import { Page } from '@playwright/test'; import { BaseComponent } from '../base.component'; export class EditDialog extends BaseComponent { - private static rootElement = 'mat-dialog-container'; + private static rootElement = 'adf-folder-dialog'; public editDialog = this.getChild(''); public titleInput = this.getChild('[data-automation-id="adf-folder-dialog-title"]'); @@ -34,7 +34,7 @@ export class EditDialog extends BaseComponent { public updateButton = this.getChild('#adf-folder-create-button'); public descriptionInput = this.getChild('#adf-folder-description-input'); public nameInput = this.getChild('#adf-folder-name-input'); - public fieldHint = this.getChild('mat-hint'); + public fieldHint = this.getChild('[aria-atomic="true"] span'); constructor(page: Page) { super(page, EditDialog.rootElement); diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/link-rules.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/link-rules.component.ts index 8d93fe609..72086cb91 100755 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/link-rules.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/link-rules.component.ts @@ -27,22 +27,21 @@ import { BaseComponent } from '../base.component'; export class LinkRulesDialog extends BaseComponent { private static rootElement = 'aca-rule-set-picker'; - - constructor(page: Page) { - super(page, LinkRulesDialog.rootElement); - } + private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() }); cancelButton = this.getChild('[data-automation-id="content-node-selector-actions-cancel"]'); selectFolderButton = this.getChild('button', { hasText: ' Select folder ' }); emptyLinkRules = this.getChild('.adf-empty-content__title'); - getOptionLocator = (optionName: string): Locator => - this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-text', { hasText: optionName }); - private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() }); + getOptionLocator = (optionName: string): Locator => this.page.locator('[role=listbox] [role=option]', { hasText: optionName }).first(); getDialogTitle = (text: string) => this.getChild('[data-automation-id="content-node-selector-title"]', { hasText: text }); getBreadcrumb = (text: string) => this.getChild('[data-automation-id="current-folder"]', { hasText: text }); getFolderIcon = this.getChild('.adf-dropdown-breadcrumb-icon', { hasText: 'folder' }); getLibraryIcon = this.getChild('.adf-empty-content__icon', { hasText: 'library_books' }); + constructor(page: Page) { + super(page, LinkRulesDialog.rootElement); + } + async selectDestination(folderName: string): Promise { const row = this.getRowByName(folderName); diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts index b7feaad15..8f2f9f11f 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts @@ -22,7 +22,7 @@ * from Hyland Software. If not, see . */ -import { ElementHandle, Locator, Page } from '@playwright/test'; +import { ElementHandle, Page } from '@playwright/test'; import { BaseComponent } from '../base.component'; import { timeouts } from '../../../utils'; import { DateTimePicker } from '../datetime-picker/datetime-picker.component'; @@ -43,12 +43,13 @@ export class ShareDialogComponent extends BaseComponent { urlAction = this.getChild('.adf-input-action'); expireToggle = this.getChild(`[data-automation-id='adf-expire-toggle']`); expireInput = this.getChild('input[formcontrolname="time"]'); - datetimePickerButton = this.getChild('.mat-datepicker-toggle'); + datetimePickerButton = this.getChild('[data-automation-id="adf-content-share-expiration-field"] button'); + dateErrorText = this.getChild('[data-automation-id="adf-share-link-input-warning"]'); + clockIcon = this.getChild('[adf-icon="timer"]'); dateTimePicker = new DateTimePicker(this.page); getDialogLabel = () => this.getChild('label').innerText(); - getErrorByText = (text: string): Locator => this.page.locator('mat-error', { hasText: text }); async getLabels(): Promise> { return this.page.$$eval('.adf-share-link__label', (elements) => elements.map((element) => element.textContent)); diff --git a/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules.component.ts b/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules.component.ts index b82db85a7..9ad09b34a 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules.component.ts @@ -29,8 +29,8 @@ export class ManageRules extends BaseComponent { private static rootElement = '.aca-manage-rules'; public getGroupsList = (optionName: string): Locator => this.getChild('.aca-rule-list-item__header', { hasText: optionName }); - public ruleToggle = this.getChild('.aca-manage-rules__container .mdc-switch').first(); - public ruleToggleFalse = this.getChild('aca-rule-list-grouping aca-rule-list-item .mdc-switch--unselected').first(); + public ruleToggle = this.getChild('.aca-manage-rules__container [role="switch"]').first(); + public ruleToggleFalse = this.getChild('aca-rule-list-grouping aca-rule-list-item [role="switch"][aria-checked="false"]').first(); public ruleDetailsTitle = this.getChild('.aca-manage-rules__container__rule-details__header__title__name'); public ruleDetailsDeleteButton = this.getChild('#delete-rule-btn'); public ruleDetailsEditButton = this.getChild('#edit-rule-btn'); diff --git a/projects/aca-playwright-shared/src/page-objects/components/pagination.component.ts b/projects/aca-playwright-shared/src/page-objects/components/pagination.component.ts index 98a04469b..57f70f92f 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/pagination.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/pagination.component.ts @@ -68,8 +68,8 @@ export class PaginationComponent extends BaseComponent { async spinnerWaitForReload(): Promise { try { - await this.page.locator('mat-progress-spinner').waitFor({ state: 'attached', timeout: 2000 }); - await this.page.locator('mat-progress-spinner').waitFor({ state: 'detached', timeout: 2000 }); + await this.page.locator('[role="progressbar"]').waitFor({ state: 'attached', timeout: 2000 }); + await this.page.locator('[role="progressbar"]').waitFor({ state: 'detached', timeout: 2000 }); } catch (e) { this.logger.info('Spinner was not present'); } diff --git a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters.component.ts b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters.component.ts index 1333ea62a..653d7c994 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters.component.ts @@ -44,5 +44,5 @@ export class SearchFilters extends BaseComponent { public menuCardClose = this.page.locator('.adf-search-filter-title-action'); public menuCardClear = this.page.locator('#cancel-filter-button'); public menuCardApply = this.page.locator('#apply-filter-button'); - public dropdownOptions = this.page.locator(`mat-option`); + public dropdownOptions = this.page.locator(`[role="option"]`); } diff --git a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts index 20d02cdeb..b5dff2f2a 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts @@ -37,13 +37,13 @@ export class SearchFiltersProperties extends BaseComponent { public fileSizeInput = this.getChild(`[placeholder$='Enter file size']`); public unitButton = this.getChild(`[data-automation-id='adf-search-properties-file-size-unit']`); public fileTypeInput = this.getChild(`[placeholder$='File Type']`); - public atLeastOption = this.page.locator(`mat-option`, { hasText: 'At Least' }); - public atMostOption = this.page.locator(`mat-option`, { hasText: 'At Most' }); - public exactlyOption = this.page.locator(`mat-option`, { hasText: 'Exactly' }); - public kbUnit = this.page.locator(`mat-option`, { hasText: 'KB' }); - public mbUnit = this.page.locator(`mat-option`, { hasText: 'MB' }); - public gbUnit = this.page.locator(`mat-option`, { hasText: 'GB' }); - public dropdownOptions = this.page.locator(`mat-option`); + public atLeastOption = this.page.locator(`[role="option"]`, { hasText: 'At Least' }); + public atMostOption = this.page.locator(`[role="option"]`, { hasText: 'At Most' }); + public exactlyOption = this.page.locator(`[role="option"]`, { hasText: 'Exactly' }); + public kbUnit = this.page.locator(`[role="option"]`, { hasText: 'KB' }); + public mbUnit = this.page.locator(`[role="option"]`, { hasText: 'MB' }); + public gbUnit = this.page.locator(`[role="option"]`, { hasText: 'GB' }); + public dropdownOptions = this.page.locator(`[role="option"]`); async setPropertiesParameters( page: SearchPage, diff --git a/projects/aca-playwright-shared/src/page-objects/components/search/search-overlay.components.ts b/projects/aca-playwright-shared/src/page-objects/components/search/search-overlay.components.ts index e56cc0d17..14e5afd45 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/search/search-overlay.components.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/search/search-overlay.components.ts @@ -41,18 +41,15 @@ export class SearchOverlayComponent extends BaseComponent { } async isFoldersOptionChecked() { - const optClass = await this.searchFoldersOption.getAttribute('class'); - return optClass.includes('.mat-mdc-checkbox-checked'); + return this.searchFoldersOption.isChecked(); } async isFilesOptionChecked() { - const optClass = await this.searchFilesOption.getAttribute('class'); - return optClass.includes('.mat-mdc-checkbox-checked'); + return this.searchFilesOption.isChecked(); } async isLibrariesOptionChecked() { - const optClass = await this.searchLibrariesOption.getAttribute('class'); - return optClass.includes('.mat-mdc-checkbox-checked'); + return this.searchLibrariesOption.isChecked(); } async clearOptions() { diff --git a/projects/aca-playwright-shared/src/page-objects/components/search/search-sorting-picker.components.ts b/projects/aca-playwright-shared/src/page-objects/components/search/search-sorting-picker.components.ts index 1e59010da..bb294c52d 100755 --- a/projects/aca-playwright-shared/src/page-objects/components/search/search-sorting-picker.components.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/search/search-sorting-picker.components.ts @@ -33,8 +33,8 @@ export class SearchSortingPicker extends BaseComponent { public actionMenu = this.page.locator('[data-automation-id="auto_header_content_id_$thumbnail"]'); public sortOrderButton = this.page.locator('#aca-button-sorting-menu'); - public sortByDropdownExpanded = this.page.locator('.mat-mdc-menu-panel').first(); - public sortByList = this.page.locator('.mat-mdc-menu-panel button'); + public sortByDropdownExpanded = this.page.locator('[role="menu"]').first(); + public sortByList = this.page.locator('[role="menu"] button'); constructor(page: Page, rootElement = SearchSortingPicker.rootElement) { super(page, rootElement); diff --git a/projects/aca-playwright-shared/src/page-objects/components/spinner.component.ts b/projects/aca-playwright-shared/src/page-objects/components/spinner.component.ts index caf25275c..023125afe 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/spinner.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/spinner.component.ts @@ -26,7 +26,7 @@ import { Page } from '@playwright/test'; import { BaseComponent } from './base.component'; export class SpinnerComponent extends BaseComponent { - private static rootElement = 'mat-progress-spinner'; + private static rootElement = '[role="progressbar"]'; constructor(page: Page, rootElement = SpinnerComponent.rootElement) { super(page, rootElement); diff --git a/projects/aca-playwright-shared/src/utils/exclude-tests.ts b/projects/aca-playwright-shared/src/utils/exclude-tests.ts index 45bd8832c..8f7149a32 100644 --- a/projects/aca-playwright-shared/src/utils/exclude-tests.ts +++ b/projects/aca-playwright-shared/src/utils/exclude-tests.ts @@ -50,7 +50,9 @@ export const getExcludedTestsRegExpArray = (excludedJson: any, projectName: stri if (testIdsToExclude.length > 0) { console.warn( - `${prefix} ❌ Tests excluded for browser '${currentBrowser}' because of 🐛 : ${testIdsToExclude.join(', ')} (from keys: ${relevantKeys.join(', ')})` + `${prefix} ❌ Tests excluded for browser '${currentBrowser}' because of 🐛 : ${testIdsToExclude.join(', ')} (from keys: ${relevantKeys.join( + ', ' + )})` ); } else { console.info(`${prefix} ✅ No excluded tests for browser '${currentBrowser}' 🎉`);