Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-8688] export playwright shared lib #4068

Merged
merged 6 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/publish-libs/npm-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ fi

export PROJECTS=(
'aca-content'
'aca-shared'
'aca-shared',
'aca-playwright-shared'
);

for PROJECT in ${PROJECTS[@]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ fi

export PROJECTS=(
'aca-content'
'aca-shared'
'aca-shared',
'aca-playwright-shared'
);

for PROJECT in ${PROJECTS[@]}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule);
void platformBrowserDynamic().bootstrapModule(AppModule);
6 changes: 4 additions & 2 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"package.json"
],
"words": [
"Hyland",
"ADDFEATURES",
"afts",
"androidamw",
Expand All @@ -20,6 +19,7 @@
"folderlink",
"formcontrolname",
"hruser",
"Hyland",
"iosamw",
"mobileapps",
"mysites",
Expand All @@ -31,14 +31,16 @@
"qshare",
"repo",
"reportportal",
"sfdc",
"sharedlinks",
"sidenav",
"simpletask",
"succes",
"textitem",
"thumbnailed",
"versionable",
"sfdc"
"любимый",
"сайт"
],
"dictionaries": [
"html",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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]);
Expand Down
17 changes: 17 additions & 0 deletions projects/aca-playwright-shared/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -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'] }]
}
}
]
};
2 changes: 1 addition & 1 deletion projects/aca-playwright-shared/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
25 changes: 23 additions & 2 deletions projects/aca-playwright-shared/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
{
"name": "playwright-shared",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ng-packge file is missing

"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"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's missing some configuration, the CI/CD says "nothing to lint"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I miss to add .eslintrc.js file, will add it in next commit.
seems like there any many lint issue after adding this on local to be resolved

}
}
}
8 changes: 4 additions & 4 deletions projects/aca-playwright-shared/src/api/categories-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://www.gnu.org/licenses/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { ApiClientFactory } from './api-client-factory';
Expand All @@ -40,7 +40,7 @@ export class CategoriesApi {

async createCategory(categoryId: string, categoryBodyCreate: CategoryBody[], opts?: CategoryQuery): Promise<CategoryPaging | CategoryEntry> {
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;
Expand All @@ -49,7 +49,7 @@ export class CategoriesApi {

async deleteCategory(categoryId: string): Promise<void> {
if (categoryId === null) {
console.log('categoryId is null, skipping deletion');
console.error('categoryId is null, skipping deletion');
return;
}

Expand All @@ -66,7 +66,7 @@ export class CategoriesApi {
opts?: CategoryQuery
): Promise<CategoryPaging | CategoryEntry> {
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;
Expand Down
12 changes: 6 additions & 6 deletions projects/aca-playwright-shared/src/api/favorites-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://www.gnu.org/licenses/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { ApiClientFactory } from './api-client-factory';
Expand All @@ -38,15 +38,15 @@ export class FavoritesPageApi {
return classObj;
}
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise<FavoriteEntry> {
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]: {
guid: guid
}
}
};
return await this.apiService.favorites.createFavorite('-me-', data);
return this.apiService.favorites.createFavorite('-me-', data);
}

async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]): Promise<FavoriteEntry[]> {
Expand All @@ -64,7 +64,7 @@ export class FavoritesPageApi {

private async getFavorites(username: string): Promise<FavoritePaging> {
try {
return await this.apiService.favorites.listFavorites(username);
return this.apiService.favorites.listFavorites(username);
} catch {
return new FavoritePaging();
}
Expand All @@ -89,7 +89,7 @@ export class FavoritesPageApi {
return Promise.resolve(isFavorite);
}
};
return await Utils.retryCall(favorite);
return Utils.retryCall(favorite);
} catch (error) {}
return isFavorite;
}
Expand All @@ -112,7 +112,7 @@ export class FavoritesPageApi {
return Promise.resolve(totalItems);
}
};
return await Utils.retryCall(favoriteFiles);
return Utils.retryCall(favoriteFiles);
} catch {}
}

Expand Down
14 changes: 7 additions & 7 deletions projects/aca-playwright-shared/src/api/file-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://www.gnu.org/licenses/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import * as fs from 'fs';
Expand All @@ -43,7 +43,7 @@ export class FileActionsApi {

async uploadFile(fileLocation: string, fileName: string, parentFolderId: string): Promise<NodeEntry> {
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'
Expand Down Expand Up @@ -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);
}
Expand All @@ -87,7 +87,7 @@ export class FileActionsApi {

async getNodeById(id: string): Promise<NodeEntry | null> {
try {
return await this.apiService.nodes.getNode(id);
return this.apiService.nodes.getNode(id);
} catch {
return null;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions projects/aca-playwright-shared/src/api/node-content-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://www.gnu.org/licenses/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { NodeBodyCreate } from '@alfresco/js-api';
Expand All @@ -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
};
Expand Down
Loading
Loading