diff --git a/.github/actions/publish-libs/npm-publish.sh b/.github/actions/publish-libs/npm-publish.sh index f8f3727de6..f3c9e666da 100755 --- a/.github/actions/publish-libs/npm-publish.sh +++ b/.github/actions/publish-libs/npm-publish.sh @@ -12,7 +12,8 @@ fi export PROJECTS=( 'aca-content' - 'aca-shared' + 'aca-shared', + 'aca-playwright-shared' ); for PROJECT in ${PROJECTS[@]} diff --git a/.github/actions/update-library-versions/update-lib-versions.sh b/.github/actions/update-library-versions/update-lib-versions.sh index a7254d6c8c..4a3dd0748f 100755 --- a/.github/actions/update-library-versions/update-lib-versions.sh +++ b/.github/actions/update-library-versions/update-lib-versions.sh @@ -11,7 +11,8 @@ fi export PROJECTS=( 'aca-content' - 'aca-shared' + 'aca-shared', + 'aca-playwright-shared' ); for PROJECT in ${PROJECTS[@]} diff --git a/app/src/main.ts b/app/src/main.ts index c4ab8eadee..bb9b989efc 100644 --- a/app/src/main.ts +++ b/app/src/main.ts @@ -32,4 +32,4 @@ if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule); +void platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/cspell.json b/cspell.json index 1cfdc84f5b..03f786373b 100644 --- a/cspell.json +++ b/cspell.json @@ -7,7 +7,6 @@ "package.json" ], "words": [ - "Hyland", "ADDFEATURES", "afts", "androidamw", @@ -20,6 +19,7 @@ "folderlink", "formcontrolname", "hruser", + "Hyland", "iosamw", "mobileapps", "mysites", @@ -31,6 +31,7 @@ "qshare", "repo", "reportportal", + "sfdc", "sharedlinks", "sidenav", "simpletask", @@ -38,7 +39,8 @@ "textitem", "thumbnailed", "versionable", - "sfdc" + "любимый", + "сайт" ], "dictionaries": [ "html", diff --git a/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.e2e.ts b/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.e2e.ts index e741cd12b5..6eca4c5b64 100755 --- a/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.e2e.ts +++ b/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.e2e.ts @@ -71,7 +71,9 @@ test.describe('Unshare a file from Search Results', () => { await apiClientFactory.createUser({ username }); nodesApi = await NodesApi.initialize(username, username); trashcanApi = await TrashcanApi.initialize(username, username); - sitesApi = await SitesApi.initialize(username, username); + sitesApi = await SitesApi.initialize('admin'); + const nodesApiAdmin = await NodesApi.initialize('admin'); + const shareApiAdmin = await SharedLinksApi.initialize('admin'); const shareApi = await SharedLinksApi.initialize(username, username); const filesAction = await FileActionsApi.initialize(username, username); parentId = (await nodesApi.createFolder(parent)).entry.id; @@ -84,13 +86,13 @@ test.describe('Unshare a file from Search Results', () => { await sitesApi.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); const docLibId = await sitesApi.getDocLibId(sitePrivate); - const fileSite1Id = (await nodesApi.createFile(fileSite1, docLibId)).entry.id; - fileSite2Id = (await nodesApi.createFile(fileSite2, docLibId)).entry.id; + const fileSite1Id = (await nodesApiAdmin.createFile(fileSite1, docLibId)).entry.id; + fileSite2Id = (await nodesApiAdmin.createFile(fileSite2, docLibId)).entry.id; await sitesApi.addSiteMember(sitePrivate, username, Site.RoleEnum.SiteConsumer); - await shareApi.shareFilesByIds([fileSite1Id]); - await shareApi.waitForFilesToBeShared([fileSite1Id]); + await shareApiAdmin.shareFilesByIds([fileSite1Id]); + await shareApiAdmin.waitForFilesToBeShared([fileSite1Id]); await shareApi.shareFilesByIds([file1Id, file2Id, file3Id, file4Id, fileSite2Id]); await shareApi.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id, fileSite2Id]); diff --git a/projects/aca-playwright-shared/.eslintrc.js b/projects/aca-playwright-shared/.eslintrc.js new file mode 100644 index 0000000000..3ada66a23a --- /dev/null +++ b/projects/aca-playwright-shared/.eslintrc.js @@ -0,0 +1,17 @@ +const path = require('path'); +module.exports = { + extends: '../../.eslintrc.json', + ignorePatterns: ['!**/*'], + overrides: [ + { + files: ['*.ts'], + parserOptions: { + project: [path.join(__dirname, 'tsconfig.lib.json'), path.join(__dirname, 'tsconfig.spec.json')], + createDefaultProgram: true + }, + rules: { + 'no-console': ['error', {'allow': ['info', 'log', 'warn', 'error'] }] + } + } + ] +}; diff --git a/projects/aca-playwright-shared/ng-package.json b/projects/aca-playwright-shared/ng-package.json new file mode 100644 index 0000000000..eda9e71901 --- /dev/null +++ b/projects/aca-playwright-shared/ng-package.json @@ -0,0 +1,6 @@ +{ + "dest": "../../dist/@alfresco/aca-playwright-shared", + "lib": { + "entryFile": "src/index.ts" + } +} diff --git a/projects/aca-playwright-shared/package.json b/projects/aca-playwright-shared/package.json index 75014efa30..960c474aa7 100644 --- a/projects/aca-playwright-shared/package.json +++ b/projects/aca-playwright-shared/package.json @@ -1,5 +1,5 @@ { - "name": "aca-playwright-shared", + "name": "@alfresco/aca-playwright-shared", "version": "3.0.0", "license": "LGPL-3.0", "main": "src/index.ts", diff --git a/projects/aca-playwright-shared/project.json b/projects/aca-playwright-shared/project.json index 606c10ad7a..975c1aadf7 100644 --- a/projects/aca-playwright-shared/project.json +++ b/projects/aca-playwright-shared/project.json @@ -1,7 +1,28 @@ { - "name": "playwright-shared", + "name": "aca-playwright-shared", "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "projects/aca-playwright-shared/src", "projectType": "library", - "prefix": "lib" + "prefix": "lib", + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:ng-packagr", + "options": { + "tsConfig": "projects/aca-playwright-shared/tsconfig.lib.json", + "project": "projects/aca-playwright-shared/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "projects/aca-playwright-shared/tsconfig.lib.prod.json" + } + }, + "defaultConfiguration": "production", + "outputs": [ + "{workspaceRoot}/dist/@alfresco/aca-playwright-shared" + ] + }, + "lint": { + "executor": "@angular-eslint/builder:lint" + } + } } diff --git a/projects/aca-playwright-shared/src/api/categories-api.ts b/projects/aca-playwright-shared/src/api/categories-api.ts index 9f0fd96aeb..5e6e3de0e6 100644 --- a/projects/aca-playwright-shared/src/api/categories-api.ts +++ b/projects/aca-playwright-shared/src/api/categories-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { ApiClientFactory } from './api-client-factory'; @@ -40,7 +40,7 @@ export class CategoriesApi { async createCategory(categoryId: string, categoryBodyCreate: CategoryBody[], opts?: CategoryQuery): Promise { try { - return await this.apiService.categoriesApi.createSubcategories(categoryId, categoryBodyCreate, opts); + return this.apiService.categoriesApi.createSubcategories(categoryId, categoryBodyCreate, opts); } catch (error) { console.error(error); return null; @@ -49,7 +49,7 @@ export class CategoriesApi { async deleteCategory(categoryId: string): Promise { if (categoryId === null) { - console.log('categoryId is null, skipping deletion'); + console.error('categoryId is null, skipping deletion'); return; } @@ -66,7 +66,7 @@ export class CategoriesApi { opts?: CategoryQuery ): Promise { try { - return await this.apiService.categoriesApi.linkNodeToCategory(nodeId, categoryLinkBodyCreate, opts); + return this.apiService.categoriesApi.linkNodeToCategory(nodeId, categoryLinkBodyCreate, opts); } catch (error) { console.error(`${this.constructor.name} ${this.linkNodeToCategory.name}: ${error}`); return null; diff --git a/projects/aca-playwright-shared/src/api/favorites-api.ts b/projects/aca-playwright-shared/src/api/favorites-api.ts index d676a81c73..3cc02dd98a 100755 --- a/projects/aca-playwright-shared/src/api/favorites-api.ts +++ b/projects/aca-playwright-shared/src/api/favorites-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { ApiClientFactory } from './api-client-factory'; @@ -38,7 +38,7 @@ export class FavoritesPageApi { return classObj; } async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise { - let guid = nodeType === 'site' ? (await this.apiService.sites.getSite(id)).entry.guid : id; + const guid = nodeType === 'site' ? (await this.apiService.sites.getSite(id)).entry.guid : id; const data = { target: { [nodeType]: { @@ -46,7 +46,7 @@ export class FavoritesPageApi { } } }; - return await this.apiService.favorites.createFavorite('-me-', data); + return this.apiService.favorites.createFavorite('-me-', data); } async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]): Promise { @@ -64,7 +64,7 @@ export class FavoritesPageApi { private async getFavorites(username: string): Promise { try { - return await this.apiService.favorites.listFavorites(username); + return this.apiService.favorites.listFavorites(username); } catch { return new FavoritePaging(); } @@ -89,7 +89,7 @@ export class FavoritesPageApi { return Promise.resolve(isFavorite); } }; - return await Utils.retryCall(favorite); + return Utils.retryCall(favorite); } catch (error) {} return isFavorite; } @@ -112,7 +112,7 @@ export class FavoritesPageApi { return Promise.resolve(totalItems); } }; - return await Utils.retryCall(favoriteFiles); + return Utils.retryCall(favoriteFiles); } catch {} } diff --git a/projects/aca-playwright-shared/src/api/file-actions.ts b/projects/aca-playwright-shared/src/api/file-actions.ts index 938c3b4712..122f47a743 100644 --- a/projects/aca-playwright-shared/src/api/file-actions.ts +++ b/projects/aca-playwright-shared/src/api/file-actions.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import * as fs from 'fs'; @@ -43,7 +43,7 @@ export class FileActionsApi { async uploadFile(fileLocation: string, fileName: string, parentFolderId: string): Promise { const file = fs.createReadStream(fileLocation); - return await this.apiService.upload.uploadFile(file, '', parentFolderId, null, { + return this.apiService.upload.uploadFile(file, '', parentFolderId, null, { name: fileName, nodeType: 'cm:content', renditions: 'doclib' @@ -71,7 +71,7 @@ export class FileActionsApi { }; try { - return await this.apiService.upload.uploadFile(file, '', parentId, nodeProps, opts); + return this.apiService.upload.uploadFile(file, '', parentId, nodeProps, opts); } catch (error) { return Promise.reject(error); } @@ -87,7 +87,7 @@ export class FileActionsApi { async getNodeById(id: string): Promise { try { - return await this.apiService.nodes.getNode(id); + return this.apiService.nodes.getNode(id); } catch { return null; } @@ -126,7 +126,7 @@ export class FileActionsApi { return Promise.resolve(isLocked); } }; - return await Utils.retryCall(locked, data.retry); + return Utils.retryCall(locked, data.retry); } catch {} return isLocked; } @@ -141,7 +141,7 @@ export class FileActionsApi { }; try { - return await this.apiService.search.search(data); + return this.apiService.search.search(data); } catch { return new ResultSetPaging(); } @@ -172,7 +172,7 @@ export class FileActionsApi { comment: comment, name: newName }; - return await this.apiService.nodes.updateNodeContent(nodeId, content, opts); + return this.apiService.nodes.updateNodeContent(nodeId, content, opts); } catch (error) { console.error(`${this.constructor.name} ${this.updateNodeContent.name}`, error); return Promise.reject(error); diff --git a/projects/aca-playwright-shared/src/api/node-content-tree.ts b/projects/aca-playwright-shared/src/api/node-content-tree.ts index c1d2953264..d61b4adc4f 100644 --- a/projects/aca-playwright-shared/src/api/node-content-tree.ts +++ b/projects/aca-playwright-shared/src/api/node-content-tree.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { NodeBodyCreate } from '@alfresco/js-api'; @@ -41,9 +41,8 @@ export function flattenNodeContentTree(content: NodeContentTree, relativePath: s const { name, files, folders, title, description } = content; const aspectNames: string[] = ['cm:versionable']; let data: NodeBodyCreate[] = []; - let properties: any; - properties = { + const properties = { [NODE_TITLE]: title, [NODE_DESCRIPTION]: description }; diff --git a/projects/aca-playwright-shared/src/api/nodes-api.ts b/projects/aca-playwright-shared/src/api/nodes-api.ts index 21f58dc40a..0b932a972e 100755 --- a/projects/aca-playwright-shared/src/api/nodes-api.ts +++ b/projects/aca-playwright-shared/src/api/nodes-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { ApiClientFactory } from './api-client-factory'; @@ -48,7 +48,7 @@ export class NodesApi { aspectNames: string[] = null ): Promise { try { - return await this.createNode('cm:folder', name, parentId, title, description, null, author, null, aspectNames); + return this.createNode('cm:folder', name, parentId, title, description, null, author, null, aspectNames); } catch (error) { console.error(`${this.constructor.name} ${this.createFolder.name}`, error); return null; @@ -65,7 +65,7 @@ export class NodesApi { aspectNames: string[] = null ): Promise { try { - return await this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion, aspectNames); + return this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion, aspectNames); } catch (error) { console.error(`${this.constructor.name} ${this.createFile.name}`, error); return null; @@ -74,7 +74,7 @@ export class NodesApi { async createFiles(names: string[], relativePath = '/'): Promise { try { - return await this.createContent({ files: names }, relativePath); + return this.createContent({ files: names }, relativePath); } catch (error) { console.error(`${this.constructor.name} ${this.createFiles.name}: ${error}`); return null; @@ -83,7 +83,7 @@ export class NodesApi { async createFolders(names: string[], relativePath = '/'): Promise { try { - return await this.createContent({ folders: names }, relativePath); + return this.createContent({ folders: names }, relativePath); } catch (error) { console.error(`${this.constructor.name} ${this.createFolders.name}: ${error}`); return null; @@ -128,7 +128,7 @@ export class NodesApi { } try { - return await this.apiService.nodes.createNode(parentId, nodeBody, { + return this.apiService.nodes.createNode(parentId, nodeBody, { majorVersion }); } catch (error) { @@ -139,7 +139,7 @@ export class NodesApi { async renameNode(nodeId: string, newName: string): Promise { try { - return await this.apiService.nodes.updateNode(nodeId, { name: newName }); + return this.apiService.nodes.updateNode(nodeId, { name: newName }); } catch (error) { console.error(`${this.constructor.name} ${this.renameNode.name}`, error); return null; @@ -195,7 +195,7 @@ export class NodesApi { async createContent(content: NodeContentTree, relativePath: string = '/'): Promise { try { - return await this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath) as any); + return this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath) as any); } catch (error) { console.error(`${this.constructor.name} ${this.createContent.name}`, error); return null; @@ -204,7 +204,7 @@ export class NodesApi { async getNodeById(id: string): Promise { try { - return await this.apiService.nodes.getNode(id); + return this.apiService.nodes.getNode(id); } catch (error) { console.error(`${this.constructor.name} ${this.getNodeById.name}`, error); return null; @@ -226,7 +226,7 @@ export class NodesApi { const opts = { include: ['properties'] }; - return await this.apiService.nodes.listNodeChildren(nodeId, opts); + return this.apiService.nodes.listNodeChildren(nodeId, opts); } catch (error) { console.error(`${this.constructor.name} ${this.getNodeChildren.name}`, error); return null; @@ -304,7 +304,7 @@ export class NodesApi { }; try { - return await this.apiService.nodes.updateNode(nodeId, data); + return this.apiService.nodes.updateNode(nodeId, data); } catch (error) { console.error(`${this.constructor.name} ${this.setGranularPermission.name}`, error); return null; @@ -343,7 +343,7 @@ export class NodesApi { }; try { - return await this.apiService.nodes.updateNode(nodeId, data); + return this.apiService.nodes.updateNode(nodeId, data); } catch (error) { console.error(`${this.constructor.name} ${this.setInheritPermissions.name}`, error); return null; @@ -352,7 +352,7 @@ export class NodesApi { private async addAspects(nodeId: string, aspectNames: string[]): Promise { try { - return await this.apiService.nodes.updateNode(nodeId, { aspectNames }); + return this.apiService.nodes.updateNode(nodeId, { aspectNames }); } catch (error) { console.error(`${this.constructor.name} ${this.addAspects.name}`, error); return null; diff --git a/projects/aca-playwright-shared/src/api/people-api-models.ts b/projects/aca-playwright-shared/src/api/people-api-models.ts index 38a3bd6d51..cadc419567 100755 --- a/projects/aca-playwright-shared/src/api/people-api-models.ts +++ b/projects/aca-playwright-shared/src/api/people-api-models.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ export interface PersonModel { diff --git a/projects/aca-playwright-shared/src/api/queries-api.ts b/projects/aca-playwright-shared/src/api/queries-api.ts index 4fbf54aa61..d9b6c615ce 100755 --- a/projects/aca-playwright-shared/src/api/queries-api.ts +++ b/projects/aca-playwright-shared/src/api/queries-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { FindQuery } from '@alfresco/js-api'; @@ -50,7 +50,7 @@ export class QueriesApi { } }; - return await Utils.retryCall(sites); + return Utils.retryCall(sites); } catch (error) { console.error(`QueriesApi waitForSites : catch : `); console.error(`\tExpected: ${data.expect} items, but found ${error}`); diff --git a/projects/aca-playwright-shared/src/api/rules-api.ts b/projects/aca-playwright-shared/src/api/rules-api.ts index 086bc723c9..add9e79457 100644 --- a/projects/aca-playwright-shared/src/api/rules-api.ts +++ b/projects/aca-playwright-shared/src/api/rules-api.ts @@ -53,7 +53,7 @@ export class RulesApi { async createRandomRule(folderId: string, ruleName: string): Promise { const randomActionsIndex = crypto.randomInt(0, ActionTypes.actions.length); const randomAction = ActionTypes.actions[randomActionsIndex]; - return await this.createRule(folderId, { + return this.createRule(folderId, { name: ruleName, isEnabled: true, actions: [randomAction] @@ -66,13 +66,13 @@ export class RulesApi { } const randomActionsIndex = crypto.randomInt(0, ActionTypes.actions.length); const randomAction = ActionTypes.actions[randomActionsIndex]; - let conditionsArray = []; + const conditionsArray = []; for (let i = 0; i < numOfConditions; i++) { const randomIndex = crypto.randomInt(0, ConditionsTypes.conditions.length); const randomCondition = ConditionsTypes.conditions[randomIndex]; conditionsArray.push(randomCondition); } - return await this.createRule(folderId, { + return this.createRule(folderId, { name: ruleName, isEnabled: true, actions: [randomAction], @@ -88,24 +88,30 @@ export class RulesApi { if (numOfActions > ActionTypes.actions.length) { numOfActions = ActionTypes.actions.length; } - let actionsArray = []; + const actionsArray = []; for (let i = 0; i < numOfActions; i++) { const randomIndex = crypto.randomInt(0, ActionTypes.actions.length); const randomAction = ActionTypes.actions[randomIndex]; actionsArray.push(randomAction); } - return await this.createRule(folderId, { + return this.createRule(folderId, { name: ruleName, isEnabled: true, actions: actionsArray }); } - async createRandomComplexRule(folderId: string, ruleName: string, numOfConditions: number, numOfActions: number, ruleDescription?: string): Promise { + async createRandomComplexRule( + folderId: string, + ruleName: string, + numOfConditions: number, + numOfActions: number, + ruleDescription?: string + ): Promise { if (numOfConditions > ConditionsTypes.conditions.length) { numOfConditions = ConditionsTypes.conditions.length; } - let conditionsArray = []; + const conditionsArray = []; for (let i = 0; i < numOfConditions; i++) { const randomIndex = crypto.randomInt(0, ConditionsTypes.conditions.length); const randomCondition = ConditionsTypes.conditions[randomIndex]; @@ -114,13 +120,13 @@ export class RulesApi { if (numOfActions > ActionTypes.actions.length) { numOfActions = ActionTypes.actions.length; } - let actionsArray = []; + const actionsArray = []; for (let i = 0; i < numOfActions; i++) { const randomIndex = crypto.randomInt(0, ActionTypes.actions.length); const randomAction = ActionTypes.actions[randomIndex]; actionsArray.push(randomAction); } - return await this.createRule(folderId, { + return this.createRule(folderId, { name: ruleName, description: ruleDescription, isEnabled: true, @@ -134,7 +140,7 @@ export class RulesApi { } async createRuleWithRandomAspects(folderId: string, ruleName: string): Promise { - return await this.createRule(folderId, { + return this.createRule(folderId, { name: ruleName, isEnabled: true, actions: [ @@ -166,7 +172,7 @@ export class RulesApi { actionType: 'move' | 'copy' | 'import', destinationFolderId: string ): Promise { - return await this.createRule(folderId, { + return this.createRule(folderId, { name: ruleName, isEnabled: true, actions: [ diff --git a/projects/aca-playwright-shared/src/api/search-api.ts b/projects/aca-playwright-shared/src/api/search-api.ts index f5f764529c..4a792a4e9b 100755 --- a/projects/aca-playwright-shared/src/api/search-api.ts +++ b/projects/aca-playwright-shared/src/api/search-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { ApiClientFactory } from './api-client-factory'; @@ -52,7 +52,7 @@ export class SearchPageApi { }; try { - return await this.apiService.search.search(data); + return this.apiService.search.search(data); } catch { return new ResultSetPaging(); } @@ -73,7 +73,7 @@ export class SearchPageApi { } }; - return await Utils.retryCall(searchFiles); + return Utils.retryCall(searchFiles); } catch {} } } diff --git a/projects/aca-playwright-shared/src/api/shared-links-api.ts b/projects/aca-playwright-shared/src/api/shared-links-api.ts index 232e89cdaa..48aee37826 100755 --- a/projects/aca-playwright-shared/src/api/shared-links-api.ts +++ b/projects/aca-playwright-shared/src/api/shared-links-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { ApiClientFactory } from './api-client-factory'; @@ -44,7 +44,7 @@ export class SharedLinksApi { nodeId: id, expiresAt: expireDate }; - return await this.apiService.share.createSharedLink(data); + return this.apiService.share.createSharedLink(data); } catch (error) { return null; } @@ -70,7 +70,7 @@ export class SharedLinksApi { const opts = { maxItems }; - return await this.apiService.share.listSharedLinks(opts); + return this.apiService.share.listSharedLinks(opts); } catch (error) { console.error(`SharedLinksApi getSharedLinks : catch : `, error); return new SharedLinkPaging(); @@ -89,7 +89,7 @@ export class SharedLinksApi { } }; - return await Utils.retryCall(sharedFile); + return Utils.retryCall(sharedFile); } catch (error) { console.error(`SharedLinksApi waitForFilesToBeShared : catch : ${error}`); console.error(`\tWait timeout reached waiting for files to be shared`); @@ -110,7 +110,7 @@ export class SharedLinksApi { async unshareFileById(fileId: string): Promise { try { const sharedId = await this.getSharedIdOfNode(fileId); - return await this.apiService.share.deleteSharedLink(sharedId); + return this.apiService.share.deleteSharedLink(sharedId); } catch (error) { console.error(`SharedLinksApi unshareFileById : catch : `, error); } @@ -132,7 +132,7 @@ export class SharedLinksApi { } }; - return await Utils.retryCall(sharedFile); + return Utils.retryCall(sharedFile); } catch (error) { console.error(`SharedLinksApi waitForFilesToNotBeShared : catch : ${error}`); console.error(`\tWait timeout reached waiting for files to no longer be shared`); diff --git a/projects/aca-playwright-shared/src/api/sites-api.ts b/projects/aca-playwright-shared/src/api/sites-api.ts index 8007e3db4a..b2e29f560a 100755 --- a/projects/aca-playwright-shared/src/api/sites-api.ts +++ b/projects/aca-playwright-shared/src/api/sites-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { ApiClientFactory } from './api-client-factory'; @@ -55,7 +55,7 @@ export class SitesApi { } as SiteBodyCreate; try { - return await this.apiService.sites.createSite(site); + return this.apiService.sites.createSite(site); } catch (error) { console.error(`SitesApi createSite : catch : `, error); return null; @@ -94,7 +94,7 @@ export class SitesApi { } as SiteMembershipBodyUpdate; try { - return await this.apiService.sites.updateSiteMembership(siteId, userId, siteRole); + return this.apiService.sites.updateSiteMembership(siteId, userId, siteRole); } catch (error) { console.error(`SitesApi updateSiteMember : catch : `, error); return new SiteMemberEntry(); @@ -108,7 +108,7 @@ export class SitesApi { } as SiteMembershipBodyCreate; try { - return await this.apiService.sites.createSiteMembership(siteId, memberBody); + return this.apiService.sites.createSiteMembership(siteId, memberBody); } catch (error) { if (error.status === 409) { return this.updateSiteMember(siteId, userId, role); @@ -125,7 +125,7 @@ export class SitesApi { } as SiteMembershipRequestBodyCreate; try { - return await this.apiService.sites.createSiteMembershipRequestForPerson(personId, body); + return this.apiService.sites.createSiteMembershipRequestForPerson(personId, body); } catch (error) { console.error(`SitesApi createSiteMembershipRequestForPerson : catch : `, error); return null; @@ -134,7 +134,7 @@ export class SitesApi { async approveSiteMembershipRequest(siteId: string, inviteeId: string): Promise { try { - return await this.apiService.sites.approveSiteMembershipRequest(siteId, inviteeId); + return this.apiService.sites.approveSiteMembershipRequest(siteId, inviteeId); } catch (error) { console.error(`SitesApi approveSiteMembershipRequest : catch : `, error); return null; @@ -153,7 +153,7 @@ export class SitesApi { async deleteSiteMember(siteId: string, userId: string) { try { - return await this.apiService.sites.deleteSiteMembership(siteId, userId); + return this.apiService.sites.deleteSiteMembership(siteId, userId); } catch (error) { console.error(`SitesApi deleteSiteMember : catch : `, error); } @@ -161,7 +161,7 @@ export class SitesApi { async getSite(siteId: string): Promise { try { - return await this.apiService.sites.getSite(siteId); + return this.apiService.sites.getSite(siteId); } catch (error) { console.error(`SitesApi getSite : catch : `, error); return null; diff --git a/projects/aca-playwright-shared/src/api/tags-api.ts b/projects/aca-playwright-shared/src/api/tags-api.ts index 750aebe5c8..23c9189696 100644 --- a/projects/aca-playwright-shared/src/api/tags-api.ts +++ b/projects/aca-playwright-shared/src/api/tags-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { TagBody, TagEntry } from '@alfresco/js-api'; @@ -40,7 +40,7 @@ export class TagsApi { async createTags(tags: TagBody[]): Promise { try { - return await this.apiService.tagsApi.createTags(tags); + return this.apiService.tagsApi.createTags(tags); } catch (error) { console.error(error); return null; @@ -49,7 +49,7 @@ export class TagsApi { async assignTagToNode(nodeId: string, tag: TagBody): Promise { try { - return await this.apiService.tagsApi.assignTagToNode(nodeId, tag); + return this.apiService.tagsApi.assignTagToNode(nodeId, tag); } catch (error) { console.error(error); return null; @@ -58,7 +58,7 @@ export class TagsApi { async deleteTag(tagId: string): Promise { try { - return await this.apiService.tagsApi.deleteTag(tagId); + return this.apiService.tagsApi.deleteTag(tagId); } catch (error) { console.error(error); } diff --git a/projects/aca-playwright-shared/src/api/trashcan-api.ts b/projects/aca-playwright-shared/src/api/trashcan-api.ts index 8f8559ba78..44a9aa45e2 100644 --- a/projects/aca-playwright-shared/src/api/trashcan-api.ts +++ b/projects/aca-playwright-shared/src/api/trashcan-api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { ApiClientFactory } from './api-client-factory'; @@ -33,25 +33,24 @@ export class TrashcanApi { return classObj; } - /** + /** * Empties the trashcan. Uses multiple batches 1000 nodes each. */ - async emptyTrashcan(): Promise { - try { - const nodes = await this.apiService.trashCan.listDeletedNodes({ - maxItems: 1000 - }); + async emptyTrashcan(): Promise { + try { + const nodes = await this.apiService.trashCan.listDeletedNodes({ + maxItems: 1000 + }); - if (nodes?.list?.entries?.length > 0) { - const ids = nodes.list.entries.map((entries) => entries.entry.id); + if (nodes?.list?.entries?.length > 0) { + const ids = nodes.list.entries.map((entries) => entries.entry.id); - for (const nodeId of ids) { - await this.apiService.trashCan.deleteDeletedNode(nodeId); - } + for (const nodeId of ids) { + await this.apiService.trashCan.deleteDeletedNode(nodeId); } - } catch (error) { - console.error('User Actions - emptyTrashcan failed : ', error); } + } catch (error) { + console.error('User Actions - emptyTrashcan failed : ', error); } - + } } diff --git a/projects/aca-playwright-shared/src/base-config/global.setup.ts b/projects/aca-playwright-shared/src/base-config/global.setup.ts index 59c4bc1be7..7fe588ce3d 100644 --- a/projects/aca-playwright-shared/src/base-config/global.setup.ts +++ b/projects/aca-playwright-shared/src/base-config/global.setup.ts @@ -42,10 +42,13 @@ async function globalSetup(config: FullConfig) { const page = await browser.newPage(); const loginPage = new LoginPage(page); await page.goto(use.baseURL); - await loginPage.loginUser({ username: users[user].username, password: users[user].password }, { - withNavigation: false, - waitForLoading: true - }); + await loginPage.loginUser( + { username: users[user].username, password: users[user].password }, + { + withNavigation: false, + waitForLoading: true + } + ); await page.context().storageState({ path: `${paths.userStates}/${user}UserState.json` }); await browser.close(); } else { diff --git a/projects/aca-playwright-shared/src/base-config/playwright.config.ts b/projects/aca-playwright-shared/src/base-config/playwright.config.ts index e21b96e546..a721f7112e 100644 --- a/projects/aca-playwright-shared/src/base-config/playwright.config.ts +++ b/projects/aca-playwright-shared/src/base-config/playwright.config.ts @@ -56,7 +56,7 @@ export const getGlobalConfig: PlaywrightTestConfig = { actionTimeout: 0, /* Base URL to use in actions like `await page.goto('/')`. */ baseURL: env.PLAYWRIGHT_E2E_HOST, - headless: !!env.PLAYWRIGHT_HEADLESS ? (env.PLAYWRIGHT_HEADLESS === 'true') : !!env.CI, + headless: env.PLAYWRIGHT_HEADLESS === 'true' || !!env.CI, ignoreHTTPSErrors: true, bypassCSP: true, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ @@ -77,5 +77,5 @@ export const getGlobalConfig: PlaywrightTestConfig = { ...devices['Desktop Chrome'] } } - ], + ] }; diff --git a/projects/aca-playwright-shared/src/base-config/report-portal.config.ts b/projects/aca-playwright-shared/src/base-config/report-portal.config.ts index 18eb2292e3..c32b70271a 100644 --- a/projects/aca-playwright-shared/src/base-config/report-portal.config.ts +++ b/projects/aca-playwright-shared/src/base-config/report-portal.config.ts @@ -1,9 +1,25 @@ -/* +/*! * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. * - * License rights for this program may be obtained from Hyland Software, Inc. - * pursuant to a written agreement and any use of this program without such an - * agreement is prohibited. + * Alfresco Example Content Application + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * from Hyland Software. If not, see . */ import { ReporterDescription } from '@playwright/test'; @@ -36,6 +52,4 @@ export const getReportPortalConfig = () => { }; export const getReporter = (): ReporterDescription[] => - env.CI - ? [['@reportportal/agent-js-playwright', getReportPortalConfig()], ['github']] - : [['html']]; + env.CI ? [['@reportportal/agent-js-playwright', getReportPortalConfig()], ['github']] : [['html']]; diff --git a/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts b/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts index df6539fa4c..74fc04169f 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts @@ -67,8 +67,8 @@ export class AcaHeader extends BaseComponent { } async verifyToolbarPrimaryActions(expectedToolbarPrimary: string[]): Promise { - let buttons = await this.page.$$('aca-toolbar button'); - let actualPrimaryActions: string[] = await Promise.all( + const buttons = await this.page.$$('aca-toolbar button'); + const actualPrimaryActions: string[] = await Promise.all( buttons.map(async (button) => { const title = await button.getAttribute('title'); return title || ''; 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 27cb62623b..5045916105 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 @@ -52,7 +52,8 @@ export enum ActionType { 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('.mat-mdc-select-panel .mdc-list-item__primary-text', { 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"]'); 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 1a55644f54..0fcdad919b 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 @@ -32,7 +32,8 @@ export class AdfInfoDrawerComponent extends BaseComponent { super(page, AdfInfoDrawerComponent.rootElement); } - public getNameField = (labelText: string) => this.getChild(`[data-automation-id="library-name-properties-wrapper"] input[placeholder='${labelText}']`); + public getNameField = (labelText: string) => + 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}']`); @@ -66,7 +67,7 @@ export class AdfInfoDrawerComponent extends BaseComponent { async checkCommentsHeaderCount(): Promise { const commentsCountTextContent = await this.commentsHeader.textContent(); const commentsCountString = commentsCountTextContent.match(/\d+/g)[0]; - return parseInt(commentsCountString); + return parseInt(commentsCountString, 10); } async verifyCommentsCountFromList(expectedNumber: number): Promise { diff --git a/projects/aca-playwright-shared/src/page-objects/components/breadcrumb/breadcrumb.component.ts b/projects/aca-playwright-shared/src/page-objects/components/breadcrumb/breadcrumb.component.ts index 72e75acd64..f0f4711a7e 100755 --- a/projects/aca-playwright-shared/src/page-objects/components/breadcrumb/breadcrumb.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/breadcrumb/breadcrumb.component.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { BaseComponent } from '.././base.component'; 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 4459a9cc25..d14ddbf6ad 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,8 @@ 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'); - uncheckedChecbox = this.page.locator('.mat-mdc-checkbox'); - checkedChecbox = this.page.locator('.mat-mdc-checkbox-checked'); + uncheckedCheckbox = this.page.locator('.mat-mdc-checkbox'); + checkedCheckbox = this.page.locator('.mat-mdc-checkbox-checked'); /** Locator for row (or rows) */ getRowLocator = this.page.getByRole('rowgroup').nth(1).locator('adf-datatable-row'); @@ -244,17 +244,17 @@ export class DataTableComponent extends BaseComponent { for (const name of names) { const isSelected = await this.isRowSelected(name); if (!isSelected) { - let row = this.getRowByName(name); + const row = this.getRowByName(name); await row.hover(); - await row.locator(this.uncheckedChecbox).click(); - await row.locator(this.checkedChecbox).waitFor({ state: 'attached' }); + await row.locator(this.uncheckedCheckbox).click(); + await row.locator(this.checkedCheckbox).waitFor({ state: 'attached' }); } } } async isRowSelected(itemName: string): Promise { const row = this.getRowByName(itemName); - return await row.locator(this.checkedChecbox).isVisible(); + return row.locator(this.checkedCheckbox).isVisible(); } async getColumnHeaders(): Promise> { @@ -341,7 +341,7 @@ export class DataTableComponent extends BaseComponent { */ async getSitesNameAndVisibility(): Promise<{ [siteName: string]: string }> { const rowsCount = await this.sitesName.count(); - let sitesInfo: { [siteName: string]: string } = {}; + const sitesInfo: { [siteName: string]: string } = {}; for (let i = 0; i < rowsCount; i++) { let siteVisibilityText = await this.sitesVisibility.nth(i).textContent(); let siteNameText = await this.sitesName.nth(i).textContent(); @@ -359,7 +359,7 @@ export class DataTableComponent extends BaseComponent { */ async getSitesNameAndRole(): Promise<{ [siteName: string]: string }> { const rowsCount = await this.sitesName.count(); - let sitesInfo: { [siteName: string]: string } = {}; + const sitesInfo: { [siteName: string]: string } = {}; for (let i = 0; i < rowsCount; i++) { let siteNameText = await this.sitesName.nth(i).textContent(); let siteRoleText = await this.sitesRole.nth(i).textContent(); 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 5e207fe218..314811967e 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 @@ -56,13 +56,13 @@ export class MatMenuComponent extends BaseComponent { async isMenuItemVisible(menuItem: string): Promise { const menuElement = this.getButtonByText(menuItem); await menuElement.waitFor({ state: 'attached' }); - return await menuElement.isVisible(); + return menuElement.isVisible(); } async verifyActualMoreActions(expectedToolbarMore: string[]): Promise { await this.page.locator('.mat-mdc-menu-content').waitFor({ state: 'attached' }); - let menus = await this.page.$$('.mat-mdc-menu-content .mat-mdc-menu-item'); - let actualMoreActions: string[] = await Promise.all( + const menus = await this.page.$$('.mat-mdc-menu-content .mat-mdc-menu-item'); + const actualMoreActions: string[] = await Promise.all( menus.map(async (button) => { const title = await (await button.$('.mdc-list-item__primary-text 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 ba816af0c3..14a802ce07 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 @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Page } from '@playwright/test'; diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-confirm-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-confirm-dialog.component.ts index fb3c4e3d98..7a0f8ccb20 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-confirm-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-confirm-dialog.component.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Page } from '@playwright/test'; 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 3e2ee9e392..0285f2511b 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 @@ -1,26 +1,26 @@ /*! - * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * from Hyland Software. If not, see . - */ + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Alfresco Example Content Application + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * from Hyland Software. If not, see . + */ import { BaseComponent } from '../base.component'; import { Page } from '@playwright/test'; @@ -49,10 +49,14 @@ export class AdfFolderDialogComponent extends BaseComponent { * @param titleInput input for Title field * @param descriptionInput input for Description field */ - async createNewFolderDialog(nameInput: string, titleInput?: string, descriptionInput?: string): Promise { - await this.folderNameInputLocator.fill(nameInput); - if (titleInput) { await this.folderTitleInput.fill(titleInput); } - if (descriptionInput) { await this.folderDescriptionInput.fill(descriptionInput); } - await this.createButton.click(); - } + async createNewFolderDialog(nameInput: string, titleInput?: string, descriptionInput?: string): Promise { + await this.folderNameInputLocator.fill(nameInput); + if (titleInput) { + await this.folderTitleInput.fill(titleInput); + } + if (descriptionInput) { + await this.folderDescriptionInput.fill(descriptionInput); + } + await this.createButton.click(); + } } 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 4255aea948..2a7f31ad5c 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 @@ -1,26 +1,26 @@ /*! - * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * from Hyland Software. If not, see . - */ + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Alfresco Example Content Application + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * from Hyland Software. If not, see . + */ import { timeouts } from '../../../utils'; import { BaseComponent } from '../base.component'; @@ -39,9 +39,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 getErrorByText = (text: string): Locator => this.page.locator('mat-error', { hasText: text }); - /** + /** * This method is used when we want to fill in Create Library Dialog and choose Create button * * @param nameInput input for the Name field @@ -49,18 +49,22 @@ export class AdfLibraryDialogComponent extends BaseComponent { * @param descriptionInput input for Description field * @param visibility visibility of the library */ - async createLibraryWithNameAndId(nameInput: string, libraryIdInput: string, descriptionInput?: string, visibility?: string): Promise { - await this.getLabelText('Name').fill(nameInput); - await this.getLabelText('Library ID').clear(); - await this.getLabelText('Library ID').fill(libraryIdInput); - if (descriptionInput) { await this.getLabelText('Description').fill(descriptionInput); } - if (visibility) { await this.getLabelText(visibility).click(); } - await this.createButton.click(); - await this.spinnerWaitForReload(); + async createLibraryWithNameAndId(nameInput: string, libraryIdInput: string, descriptionInput?: string, visibility?: string): Promise { + await this.getLabelText('Name').fill(nameInput); + await this.getLabelText('Library ID').clear(); + await this.getLabelText('Library ID').fill(libraryIdInput); + if (descriptionInput) { + await this.getLabelText('Description').fill(descriptionInput); } - - async isErrorMessageDisplayed(errorText: string): Promise { - await this.getErrorByText(errorText).waitFor({ state: 'visible', timeout: timeouts.large }); - return await this.getErrorByText(errorText).isVisible(); + if (visibility) { + await this.getLabelText(visibility).click(); } + await this.createButton.click(); + await this.spinnerWaitForReload(); + } + + async isErrorMessageDisplayed(errorText: string): Promise { + await this.getErrorByText(errorText).waitFor({ state: 'visible', timeout: timeouts.large }); + return this.getErrorByText(errorText).isVisible(); + } } 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 12bb388d41..bee8eea39d 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 @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Locator, Page, expect } from '@playwright/test'; @@ -36,7 +36,8 @@ export class ContentNodeSelectorDialog extends BaseComponent { 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 }); + 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() }); 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 }); 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 e61c3e5965..4f175c8d43 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 @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Locator, Page } from '@playwright/test'; @@ -37,21 +37,24 @@ export class CreateFromTemplateDialogComponent extends BaseComponent { createButton = this.getChild('[data-automation-id="create-from-template-dialog-create-button"]'); getDialogTitle = (text: string) => this.getChild('.mat-dialog-title', { hasText: text }); getDialogLabel = (text: string) => this.getChild('label', { hasText: text }); - getErrorByText = (text: string): Locator => this.page.locator('mat-error', {hasText: text}); - + getErrorByText = (text: string): Locator => this.page.locator('mat-error', { hasText: text }); async isErrorMessageDisplayed(errorText: string): Promise { await this.getErrorByText(errorText).waitFor({ state: 'visible', timeout: timeouts.large }); - return await this.getErrorByText(errorText).isVisible(); + return this.getErrorByText(errorText).isVisible(); } - /** + /** * This method is used when we want to fill in Create new folder/document/file from template dialog and choose Create button */ - async createFromTemplateAction( nameInput: string, titleInput?: string, descriptionInput?: string): Promise { - await this.getDialogLabel('Name *').fill(nameInput); - if (titleInput) { await this.getDialogLabel('Title').fill(titleInput); } - if (descriptionInput) { await this.getDialogLabel('Description').fill(descriptionInput); } - await this.createButton.click(); + async createFromTemplateAction(nameInput: string, titleInput?: string, descriptionInput?: string): Promise { + await this.getDialogLabel('Name *').fill(nameInput); + if (titleInput) { + await this.getDialogLabel('Title').fill(titleInput); + } + if (descriptionInput) { + await this.getDialogLabel('Description').fill(descriptionInput); } + await this.createButton.click(); + } } diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/delete-trash-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/delete-trash-dialog.component.ts index e238a70c49..63e1720887 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/delete-trash-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/delete-trash-dialog.component.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Page } from '@playwright/test'; 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 d4e3edac13..def366d920 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 @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Page } from '@playwright/test'; @@ -39,4 +39,4 @@ export class EditDialog extends BaseComponent { constructor(page: Page) { super(page, EditDialog.rootElement); } -} \ No newline at end of file +} 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 1f7c45c4e1..89f878fd39 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 @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Locator, Page, expect } from '@playwright/test'; @@ -35,7 +35,8 @@ export class LinkRulesDialog extends BaseComponent { 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 }); + 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() }); 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 }); diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/manage-versions-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/manage-versions-dialog.component.ts index 4a647f9e3b..3113789237 100755 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/manage-versions-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/manage-versions-dialog.component.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Page } from '@playwright/test'; diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/password-overlay-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/password-overlay-dialog.component.ts index 4d3cb07e73..96a3690dc0 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/password-overlay-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/password-overlay-dialog.component.ts @@ -50,24 +50,24 @@ export class PasswordOverlayDialogComponent extends BaseComponent { async isDialogOpen(): Promise { await this.waitForDialogToOpen(); - return await this.passwordInput.isVisible(); + return this.passwordInput.isVisible(); } async isCloseVisible(): Promise { - return await this.closeButton.isVisible(); + return this.closeButton.isVisible(); } async isSubmitHidden(): Promise { - return await this.submitButton.isHidden(); + return this.submitButton.isHidden(); } async isPasswordInputDisplayed(): Promise { - return await this.passwordInput.isVisible(); + return this.passwordInput.isVisible(); } async isErrorDisplayed(): Promise { await this.errorMessage.waitFor({ state: 'visible', timeout: timeouts.short }); - return await this.errorMessage.isVisible(); + return this.errorMessage.isVisible(); } async getErrorMessage(): Promise { 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 fa30159e50..aef0457688 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 @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { ElementHandle, Locator, Page } from '@playwright/test'; @@ -51,19 +51,19 @@ export class ShareDialogComponent extends BaseComponent { getErrorByText = (text: string): Locator => this.page.locator('mat-error', { hasText: text }); async getLabels(): Promise> { - return await this.page.$$eval('.adf-share-link__label', (elements) => elements.map((element) => element.textContent)); + return this.page.$$eval('.adf-share-link__label', (elements) => elements.map((element) => element.textContent)); } async getDialogTitle(): Promise { - return await this.dialogTitle.innerText(); + return this.dialogTitle.innerText(); } async getInfoText(): Promise { - return await this.infoText.innerText(); + return this.infoText.innerText(); } async getLinkUrl(): Promise { - return await this.url.first().inputValue(); + return this.url.first().inputValue(); } async isUrlReadOnly(): Promise { @@ -72,7 +72,7 @@ export class ShareDialogComponent extends BaseComponent { } async isCloseEnabled(): Promise { - return await this.closeButton.isEnabled(); + return this.closeButton.isEnabled(); } async clickClose(): Promise { @@ -96,6 +96,6 @@ export class ShareDialogComponent extends BaseComponent { } async getExpireDate(): Promise { - return await this.expireInput.inputValue(); + return this.expireInput.inputValue(); } } diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-dialog.component.ts index dde2d8d0d8..be4781f900 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-dialog.component.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Page } from '@playwright/test'; diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-new-version-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-new-version-dialog.component.ts index 7d1406cf76..c79278251d 100755 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-new-version-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-new-version-dialog.component.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Page } from '@playwright/test'; diff --git a/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules-dialog.component.ts index 6d3f960062..a9ba4e8849 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules-dialog.component.ts @@ -54,14 +54,16 @@ export class ManageRulesDialogComponent extends BaseComponent { } async deleteActions(noActions: number): Promise { - for(let i = 0; i < noActions; i++) { - await this.actionsEllipsisButtons.first().click(); - await this.actionsEllipsisDelete.click(); - }} + for (let i = 0; i < noActions; i++) { + await this.actionsEllipsisButtons.first().click(); + await this.actionsEllipsisDelete.click(); + } + } async deleteConditions(noConditions: number): Promise { - for(let i = 0; i < noConditions; i++) { - await this.conditionsEllipsisButtons.first().click(); - await this.conditionsEllipsisDelete.click(); - }} + for (let i = 0; i < noConditions; i++) { + await this.conditionsEllipsisButtons.first().click(); + await this.conditionsEllipsisDelete.click(); + } + } } 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 575f2dc2f1..8e862fae30 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 @@ -53,7 +53,7 @@ export class ManageRules extends BaseComponent { } async checkIfRuleListEmpty(): Promise { - return await this.rulesEmptyListTitle.isVisible(); + return this.rulesEmptyListTitle.isVisible(); } async checkIfRuleIsOnTheList(ruleName: string): Promise { @@ -61,7 +61,7 @@ export class ManageRules extends BaseComponent { } async countConditionsInGroup(): Promise { - return await this.ruleConditionsInGroup.count(); + return this.ruleConditionsInGroup.count(); } async turnOffRuleToggle(): Promise { 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 07a3b83d18..10c19bb140 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 @@ -152,7 +152,7 @@ export class PaginationComponent extends BaseComponent { } async getItemsCount(): Promise { - return await this.page.getByRole('menuitem').count(); + return this.page.getByRole('menuitem').count(); } async clickNthItem(nth: number): Promise { 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 10c758698b..f35d31c14d 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 @@ -39,10 +39,10 @@ export class SearchFilters extends BaseComponent { public locationFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Location' }); public tagsFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Tags' }); public categoriesFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Categories' }); - public resetButton = this.page.locator('button' , { hasText: 'Reset' }); + public resetButton = this.page.locator('button', { hasText: 'Reset' }); public menuCardTitle = this.page.locator('.adf-search-filter-title'); 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`); -} \ No newline at end of file +} diff --git a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-date.component.ts b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-date.component.ts index 92282c930d..e22d17b699 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-date.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-date.component.ts @@ -89,17 +89,7 @@ export class SearchFiltersDate extends BaseComponent { * @param endDay end day for time-frame search. DD-MMMM-YY */ async filterFilesByDate(params: FilterFilesByDateParams) { - const { - searchPage, - filterType, - dateFilterTab, - searchPhrase, - searchType, - expectSearchResults, - inTheLastInputValue, - startDay, - endDay - } = params; + const { searchPage, filterType, dateFilterTab, searchPhrase, searchType, expectSearchResults, inTheLastInputValue, startDay, endDay } = params; await searchPage.searchWithin(searchPhrase, searchType); await searchPage.searchFilters.dateFilter.click(); 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 a0aae8d1b4..fadb3234e5 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 @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ import { Page } from '@playwright/test'; @@ -58,15 +58,15 @@ export class SearchSortingPicker extends BaseComponent { } async getSortByOptionsList(): Promise { - let sortOptionsCount = await this.sortByList.count(); - let sortByOptions: string[] = []; + const sortOptionsCount = await this.sortByList.count(); + const sortByOptions: string[] = []; for (let i = 1; i < sortOptionsCount; i++) { - let textContent = (await this.sortByList.nth(i).textContent()).trim(); - sortByOptions.push(textContent); + const textContent = (await this.sortByList.nth(i).textContent()).trim(); + sortByOptions.push(textContent); } sortByOptions.sort((a, b) => a.localeCompare(b)); return sortByOptions; -} + } async sortBy(option: SortByType, direction: SortByDirection): Promise { await this.actionMenu.click(); @@ -76,7 +76,7 @@ export class SearchSortingPicker extends BaseComponent { await this.clickSortByDropdown(); } const elem = this.sortByList.getByText(option); - const optionId = await elem.locator("..").getAttribute('id'); + const optionId = await elem.locator('..').getAttribute('id'); await elem.click(); const directionSortElement = this.page.locator(`[id="${optionId}-${direction.toLocaleLowerCase()}"]`); await directionSortElement.click(); diff --git a/projects/aca-playwright-shared/src/page-objects/components/snackBar/snack-bar.component.ts b/projects/aca-playwright-shared/src/page-objects/components/snackBar/snack-bar.component.ts index ab7e74a932..505958614a 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/snackBar/snack-bar.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/snackBar/snack-bar.component.ts @@ -45,7 +45,7 @@ export class SnackBarComponent extends BaseComponent { } async getSnackBarActionText(): Promise { - if (await this.actionButton.isVisible()){ + if (await this.actionButton.isVisible()) { return this.actionButton.textContent(); } else { return ''; diff --git a/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts b/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts index 2c00d9f7ee..6a7bd5ef31 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts @@ -59,17 +59,17 @@ export class ViewerComponent extends BaseComponent { async isViewerOpened(): Promise { await this.waitForViewerToOpen(); - return await this.viewerLocator.isVisible(); + return this.viewerLocator.isVisible(); } async isCloseButtonDisplayed(): Promise { await this.closeButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal }); - return await this.closeButtonLocator.isEnabled({ timeout: timeouts.normal }); + return this.closeButtonLocator.isEnabled({ timeout: timeouts.normal }); } async isFileTitleDisplayed(): Promise { await this.fileTitleButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal }); - return await this.fileTitleButtonLocator.isVisible(); + return this.fileTitleButtonLocator.isVisible(); } async getFileTitle(): Promise { @@ -79,14 +79,14 @@ export class ViewerComponent extends BaseComponent { async getCloseButtonTooltip(): Promise { await this.closeButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal }); - return await this.closeButtonLocator.getAttribute('title'); + return this.closeButtonLocator.getAttribute('title'); } async verifyViewerPrimaryActions(expectedToolbarPrimary: string[]): Promise { const toRemove = ['Close', 'Previous File', 'Next File', 'View details']; const removeClosePreviousNextOldInfo = (actions: string[]): string[] => actions.filter((elem) => !toRemove.includes(elem)); - let buttons = await this.page.$$('adf-viewer button'); + const buttons = await this.page.$$('adf-viewer button'); let actualPrimaryActions: string[] = await Promise.all( buttons.map(async (button) => { const title = await button.getAttribute('title'); diff --git a/projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts index 2d83766541..55d1ca2984 100644 --- a/projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts @@ -24,7 +24,15 @@ import { Page } from '@playwright/test'; import { BasePage } from './base.page'; -import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, PaginationComponent, Breadcrumb, AdfInfoDrawerComponent } from '../components'; +import { + DataTableComponent, + MatMenuComponent, + ViewerComponent, + SidenavComponent, + PaginationComponent, + Breadcrumb, + AdfInfoDrawerComponent +} from '../components'; import { AcaHeader } from '../components/aca-header.component'; import { AdfFolderDialogComponent, ViewerOverlayDialogComponent, ManageVersionsDialog } from '../components/dialogs'; diff --git a/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts index b3e10e94cd..6743c2f1f4 100644 --- a/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts @@ -68,8 +68,8 @@ export class LoginPage extends BasePage { } async verifyUserLogin(): Promise { - if (this.username.isVisible()) { - await this.page.reload({ waitUntil:"load" }); + if (await this.username.isVisible()) { + await this.page.reload({ waitUntil: 'load' }); } } } diff --git a/projects/aca-playwright-shared/src/page-objects/pages/shared.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/shared.page.ts index a86fe3f46a..248859746b 100644 --- a/projects/aca-playwright-shared/src/page-objects/pages/shared.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/shared.page.ts @@ -45,5 +45,4 @@ export class SharedPage extends BasePage { public breadcrumb = new Breadcrumb(this.page); public infoDrawer = new AdfInfoDrawerComponent(this.page); public manageVersionsDialog = new ManageVersionsDialog(this.page); - } diff --git a/projects/aca-playwright-shared/src/utils/api.ts b/projects/aca-playwright-shared/src/utils/api.ts index dd8b20b34d..2e6a406890 100644 --- a/projects/aca-playwright-shared/src/utils/api.ts +++ b/projects/aca-playwright-shared/src/utils/api.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ export type ApiResultPredicate = (result: T) => boolean; @@ -40,7 +40,12 @@ export async function waitForApi(apiCall: ApiCall, predicate: ApiResultPre function retryCall(fn: () => Promise, retry: number = 30, delay: number = 1000): Promise { const pause = (duration) => new Promise((res) => setTimeout(res, duration)); - const run = (retries) => fn().catch((err) => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(new Error(`API call did not satisfy predicate: ${JSON.stringify(err)}`)))); + const run = (retries) => + fn().catch((err) => + retries > 1 + ? pause(delay).then(() => run(retries - 1)) + : Promise.reject(new Error(`API call did not satisfy predicate: ${JSON.stringify(err)}`)) + ); return run(retry); } diff --git a/projects/aca-playwright-shared/src/utils/config.ts b/projects/aca-playwright-shared/src/utils/config.ts index d082747cce..b7e312c533 100644 --- a/projects/aca-playwright-shared/src/utils/config.ts +++ b/projects/aca-playwright-shared/src/utils/config.ts @@ -19,7 +19,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . + * from Hyland Software. If not, see . */ export const APP_ROUTES = { diff --git a/projects/aca-playwright-shared/src/utils/error-strings.ts b/projects/aca-playwright-shared/src/utils/error-strings.ts index f1c95fcd20..68726510c8 100644 --- a/projects/aca-playwright-shared/src/utils/error-strings.ts +++ b/projects/aca-playwright-shared/src/utils/error-strings.ts @@ -23,7 +23,6 @@ */ export const errorStrings = { - errorMessageNotPresent: 'Error message is not displayed', nameIsRequiredError: 'Name is required', nameWithSpecialCharactersError: `Name can't contain these characters * " < > \\ / ? : |`, @@ -38,4 +37,4 @@ export const errorStrings = { folderNameCantContainTheseCharacters: `Folder name can't contain these characters`, folderNameCantContainOnlySpaces: `Folder name can't contain only spaces`, thereIsAlreadyAFolderWithThisName: `There's already a folder with this name. Try a different name.` -} +}; diff --git a/projects/aca-playwright-shared/src/utils/exclude-tests.ts b/projects/aca-playwright-shared/src/utils/exclude-tests.ts index 223e77a224..a8dc17436b 100644 --- a/projects/aca-playwright-shared/src/utils/exclude-tests.ts +++ b/projects/aca-playwright-shared/src/utils/exclude-tests.ts @@ -1,20 +1,36 @@ -/* - * Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved. +/*! + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. * - * License rights for this program may be obtained from Alfresco Software, Ltd. - * pursuant to a written agreement and any use of this program without such an - * agreement is prohibited. + * Alfresco Example Content Application + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * from Hyland Software. If not, see . */ export const getExcludedTestsRegExpArray = (excludedJson: any, projectName: string) => { - const prefix = `[ 🎭 Playwright Excludes - ${projectName} ]`; - const objectKeys = Object.keys(excludedJson); + const prefix = `[ 🎭 Playwright Excludes - ${projectName} ]`; + const objectKeys = Object.keys(excludedJson); - if (!objectKeys.length) { - console.info(`${prefix} ✅ No excluded tests 🎉 `); - } else { - console.warn(`${prefix} ❌ Tests excluded because of 🐛 : ${objectKeys}`); - } + if (!objectKeys.length) { + console.info(`${prefix} ✅ No excluded tests 🎉 `); + } else { + console.warn(`${prefix} ❌ Tests excluded because of 🐛 : ${objectKeys}`); + } - return objectKeys.map((key) => new RegExp(key)); + return objectKeys.map((key) => new RegExp(key)); }; diff --git a/projects/aca-playwright-shared/src/utils/library-errors.ts b/projects/aca-playwright-shared/src/utils/library-errors.ts index 5c7a82e79f..c105df1393 100644 --- a/projects/aca-playwright-shared/src/utils/library-errors.ts +++ b/projects/aca-playwright-shared/src/utils/library-errors.ts @@ -24,6 +24,6 @@ export const libraryErrors = { libraryIdIsNotAvailable: "This Library ID isn't available. Try a different Library ID.", - libraryIdIsAlreadyUsed: "This Library ID is already used. Check the trashcan.", - useNumbersAndLettersOnly: "Use numbers and letters only" -} + libraryIdIsAlreadyUsed: 'This Library ID is already used. Check the trashcan.', + useNumbersAndLettersOnly: 'Use numbers and letters only' +}; diff --git a/projects/aca-playwright-shared/src/utils/paths.ts b/projects/aca-playwright-shared/src/utils/paths.ts index 951c14134c..fd8be75b25 100644 --- a/projects/aca-playwright-shared/src/utils/paths.ts +++ b/projects/aca-playwright-shared/src/utils/paths.ts @@ -25,9 +25,9 @@ const rootFolder = 'e2e-output'; export const paths = { - rootFolder, - allData: `${rootFolder}/playwright-data`, - files: `${rootFolder}/playwright-data/downloads`, - report: `${rootFolder}/playwright-data/report`, - userStates: `${rootFolder}/playwright-data/user-states`, + rootFolder, + allData: `${rootFolder}/playwright-data`, + files: `${rootFolder}/playwright-data/downloads`, + report: `${rootFolder}/playwright-data/report`, + userStates: `${rootFolder}/playwright-data/user-states` }; diff --git a/projects/aca-playwright-shared/src/utils/state-helper.ts b/projects/aca-playwright-shared/src/utils/state-helper.ts index 00967e610b..397eb5cfa0 100644 --- a/projects/aca-playwright-shared/src/utils/state-helper.ts +++ b/projects/aca-playwright-shared/src/utils/state-helper.ts @@ -22,13 +22,12 @@ * from Hyland Software. If not, see . */ - import { resolve } from 'path'; import { paths } from '.'; import { users } from '../base-config'; export function getUserState(user: UserType) { - return resolve(process.cwd(), `${paths.userStates}/${user}UserState.json`); + return resolve(process.cwd(), `${paths.userStates}/${user}UserState.json`); } type UserType = keyof typeof users; diff --git a/projects/aca-playwright-shared/tsconfig.lib.prod.json b/projects/aca-playwright-shared/tsconfig.lib.prod.json new file mode 100644 index 0000000000..2a2faa884c --- /dev/null +++ b/projects/aca-playwright-shared/tsconfig.lib.prod.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/tsconfig.adf.json b/tsconfig.adf.json index 8a664748c3..f313ee7fb8 100644 --- a/tsconfig.adf.json +++ b/tsconfig.adf.json @@ -36,7 +36,6 @@ "@alfresco/aca-shared/store": ["projects/aca-shared/store/src/public-api.ts"], "@alfresco/aca-shared/rules": ["projects/aca-shared/rules/src/public-api.ts"], "@alfresco/aca-content/ms-office": ["projects/aca-content/ms-office/src/public-api.ts"], - "@alfresco/aca-testing-shared": ["projects/aca-testing-shared/src/index.ts"], "@alfresco/aca-content/about": ["projects/aca-content/about/src/public-api.ts"], "@alfresco/aca-content/folder-rules": ["projects/aca-content/folder-rules/src/public-api.ts"], "@alfresco/aca-content": ["projects/aca-content/src/public-api.ts"], diff --git a/tsconfig.json b/tsconfig.json index 165e23eeba..94e0afb059 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,7 +30,6 @@ "@alfresco/aca-shared": ["projects/aca-shared/src/public-api.ts"], "@alfresco/aca-shared/rules": ["projects/aca-shared/rules/src/public-api.ts"], "@alfresco/aca-shared/store": ["projects/aca-shared/store/src/public-api.ts"], - "@alfresco/aca-testing-shared": ["projects/aca-testing-shared/src/index.ts"], "@alfresco/playwright-shared": ["projects/aca-playwright-shared/src/index.ts"], "package.json": ["package.json"] }